1.1 --- a/moinconvert Fri Apr 12 00:08:39 2019 +0200
1.2 +++ b/moinconvert Fri Apr 12 00:20:45 2019 +0200
1.3 @@ -85,6 +85,7 @@
1.4
1.5 # Option values.
1.6
1.7 + attachments_dir = []
1.8 document_indexes = []
1.9 filenames = []
1.10 formats = []
1.11 @@ -112,20 +113,35 @@
1.12
1.13 for arg in args:
1.14
1.15 - # Detect tree output.
1.16 + # Flags with no following arguments.
1.17 +
1.18 + # Detect all documents.
1.19
1.20 - if arg == "--tree":
1.21 - tree = True
1.22 + if arg == "--all":
1.23 + all = True
1.24 +
1.25 + # Detect fragment output (if serialising).
1.26 +
1.27 + elif arg == "--fragment":
1.28 + fragment = True
1.29
1.30 # Detect macro evaluation.
1.31
1.32 elif arg == "--macros":
1.33 macros = True
1.34
1.35 - # Detect all documents.
1.36 + # Detect tree output.
1.37 +
1.38 + elif arg == "--tree":
1.39 + tree = True
1.40
1.41 - elif arg == "--all":
1.42 - all = True
1.43 + # Options with following arguments.
1.44 +
1.45 + # Switch to document index.
1.46 +
1.47 + elif arg == "--attachments-dir":
1.48 + l = attachments_dir
1.49 + continue
1.50
1.51 # Switch to document index.
1.52
1.53 @@ -133,11 +149,6 @@
1.54 l = document_indexes
1.55 continue
1.56
1.57 - # Detect fragment output (if serialising).
1.58 -
1.59 - elif arg == "--fragment":
1.60 - fragment = True
1.61 -
1.62 # Switch to collecting formats.
1.63
1.64 elif arg == "--format":
1.65 @@ -225,6 +236,7 @@
1.66 # Define metadata.
1.67
1.68 metadata = Metadata({
1.69 + "attachments" : getvalue(attachments_dir, "attachments"),
1.70 "document_index" : getvalue(document_indexes),
1.71 "input_context" : input_dir and \
1.72 getvalue(input_dir_types, "directory") or \