implemented importing exclude globs from a file.
This commit is contained in:
parent
133e838447
commit
3ffc96453e
11
ASCIIsite.py
11
ASCIIsite.py
|
@ -11,8 +11,9 @@ def parse_arguments():
|
|||
parser=argparse.ArgumentParser(description='create a website directory structure by converting .adoc files in a directory strucutre to .html files.')
|
||||
parser.add_argument('inputDir', type=Path, help='The directory of adoc files to be copied and converted.')
|
||||
parser.add_argument('-o', '--output', type=Path, help='What to name the generated directory or tar file')
|
||||
parser.add_argument('-z', '--compress', action='store_true', help='whether to compress the resulting directory to a tar.gz file. can be usefull for scripting to transfer the site to a remote server.')
|
||||
parser.add_argument('--exclude-file', type=Path, help='A text file containing glob patterns to exclude, 1 per line.')
|
||||
parser.add_argument('--exclude', nargs='+', help='A list of glob patterns to ignore. Remember to quote them so your shell doesnt escape them!')
|
||||
parser.add_argument('-z', '--compress', action='store_true', help='whether to compress the resulting directory to a tar.gz file. can be usefull for scripting to transfer the site to a remote server.')
|
||||
args=parser.parse_args()
|
||||
|
||||
#set compress flag
|
||||
|
@ -44,7 +45,13 @@ def parse_arguments():
|
|||
logging.info(f'outputting to {outFile.resolve()}')
|
||||
logging.debug(f'compress is {compress}')
|
||||
|
||||
return args.inputDir.resolve(), outFile, compress, args.exclude
|
||||
with open(args.exclude_file, 'r') as file:
|
||||
exclude=[glob.strip() for glob in file]
|
||||
|
||||
if args.exclude != None:
|
||||
exclude.extend(args.exclude)
|
||||
|
||||
return args.inputDir.resolve(), outFile, compress, exclude
|
||||
|
||||
#Doing it in a tmpDir first, as some distrubutions put temp files on a ramdisk. this should speed up the operation sigificantly.
|
||||
class TmpDir:
|
||||
|
|
1
tests/globignore
Normal file
1
tests/globignore
Normal file
|
@ -0,0 +1 @@
|
|||
include*
|
65
tests/result/include/include.txt
Normal file
65
tests/result/include/include.txt
Normal file
|
@ -0,0 +1,65 @@
|
|||
== included section
|
||||
|
||||
Fusce maximus nec magna eu ultricies.
|
||||
Fusce quis tellus vitae arcu facilisis lobortis.
|
||||
Donec id erat at enim porta placerat in vitae sapien.
|
||||
Duis justo arcu, hendrerit nec nulla eu, dictum dapibus ipsum.
|
||||
Sed fermentum id elit eget fringilla.
|
||||
Suspendisse volutpat imperdiet justo, ut efficitur odio maximus et.
|
||||
Nunc interdum sollicitudin eros sit amet convallis.
|
||||
Praesent volutpat tempus metus id tincidunt.
|
||||
Proin aliquet justo a fermentum consectetur.
|
||||
Nunc scelerisque, nisi id scelerisque dictum, nibh lectus ultrices nunc, quis ultricies erat velit sit amet urna.
|
||||
Maecenas orci felis, volutpat at bibendum ut, mattis eu justo.
|
||||
|
||||
=== blocks
|
||||
|
||||
.listing block
|
||||
----
|
||||
example of _listing block_
|
||||
with verbatim line break
|
||||
----
|
||||
|
||||
.example block
|
||||
====
|
||||
example block
|
||||
with line break
|
||||
====
|
||||
|
||||
.literal block
|
||||
....
|
||||
_literal_ block
|
||||
with line break
|
||||
....
|
||||
|
||||
.pass block
|
||||
++++
|
||||
pass block
|
||||
with <u>underlined text</u>
|
||||
++++
|
||||
|
||||
.quote block
|
||||
____
|
||||
quote block
|
||||
with line break
|
||||
____
|
||||
|
||||
.sidebar block
|
||||
****
|
||||
sidebar block
|
||||
with line break
|
||||
****
|
||||
|
||||
[NOTE]
|
||||
====
|
||||
This is an example of an admonition block.
|
||||
|
||||
Unlike an admonition paragraph, it may contain any AsciiDoc content.
|
||||
The style can be any one of the admonition labels:
|
||||
|
||||
* NOTE
|
||||
* TIP
|
||||
* WARNING
|
||||
* CAUTION
|
||||
* IMPORTANT
|
||||
====
|
Loading…
Reference in a new issue