1.1 --- a/moinconvert Wed Aug 07 15:44:50 2019 +0200
1.2 +++ b/moinconvert Wed Aug 07 15:48:00 2019 +0200
1.3 @@ -108,8 +108,10 @@
1.4
1.5 all = False
1.6 bundle = False
1.7 + common = False
1.8 fragment = False
1.9 macros = False
1.10 + no_inline = False
1.11 tree = False
1.12
1.13 for arg in args:
1.14 @@ -126,6 +128,11 @@
1.15 elif arg == "--bundle":
1.16 bundle = True
1.17
1.18 + # Detect use of a common attachments directory.
1.19 +
1.20 + elif arg == "--common":
1.21 + common = True
1.22 +
1.23 # Detect fragment output (if serialising).
1.24
1.25 elif arg == "--fragment":
1.26 @@ -136,6 +143,11 @@
1.27 elif arg == "--macros":
1.28 macros = True
1.29
1.30 + # Detect suppression of inline objects.
1.31 +
1.32 + elif arg == "--no-inline":
1.33 + no_inline = True
1.34 +
1.35 # Detect tree output.
1.36
1.37 elif arg == "--tree":
1.38 @@ -244,6 +256,7 @@
1.39 metadata = Metadata({
1.40 "attachments" : getvalue(attachments_dir, "attachments"),
1.41 "bundle" : bundle,
1.42 + "common_attachments": common,
1.43 "document_index" : getvalue(document_indexes),
1.44 "input_context" : input_dir and \
1.45 getvalue(input_dir_types, "directory") or \
1.46 @@ -253,6 +266,7 @@
1.47 "input_separator" : getvalue(input_page_seps),
1.48 "link_format" : format,
1.49 "mapping" : getmapping(mappings),
1.50 + "no_inline" : no_inline,
1.51 "output_context" : output_dir and "directory" or "standalone",
1.52 "output_encoding" : getvalue(output_encodings),
1.53 "output_format" : format,
1.54 @@ -362,6 +376,9 @@
1.55
1.56 Input options:
1.57
1.58 +--common Obtain attachments from a common directory for all pages,
1.59 + rather than each page having its own subdirectory of a
1.60 + top-level attachments directory.
1.61 --input-dir Indicate an input directory containing document files
1.62 --input-dir-type Indicate the type of input directory involved
1.63 (default: directory)
1.64 @@ -384,6 +401,8 @@
1.65 (default: html)
1.66 --fragment Indicates that an output fragment, not an entire document,
1.67 is to be generated, skipping any theming activities
1.68 +--no-inline Suppress inline objects in serialised documents, linking to
1.69 + separate objects instead.
1.70 --output-dir Indicate an output directory to contain serialised document
1.71 files
1.72 --output-encoding Indicate the character encoding used in serialised document
2.1 --- a/moinformat/input/directory.py Wed Aug 07 15:44:50 2019 +0200
2.2 +++ b/moinformat/input/directory.py Wed Aug 07 15:48:00 2019 +0200
2.3 @@ -53,6 +53,19 @@
2.4
2.5 self.attachments_dir = metadata.get("attachments")
2.6
2.7 + # Support a common attachments directory.
2.8 +
2.9 + self.common_attachments = metadata.get("common_attachments")
2.10 +
2.11 + def _get_attachments_dir(self, pagename):
2.12 +
2.13 + "Return the attachments directory for 'pagename'."
2.14 +
2.15 + if self.common_attachments:
2.16 + return join(self.dir.filename, self.attachments_dir)
2.17 + else:
2.18 + return join(self.dir.filename, self.attachments_dir, pagename)
2.19 +
2.20 def all(self):
2.21
2.22 "Return all pages in the context."
2.23 @@ -74,11 +87,7 @@
2.24 is relative to the appropriate attachment directory.
2.25 """
2.26
2.27 - attachments_dir = Directory(join(self.dir.filename,
2.28 - self.attachments_dir,
2.29 - pagename))
2.30 -
2.31 - return attachments_dir.select_files("*")
2.32 + return Directory(self._get_attachments_dir(pagename)).select_files("*")
2.33
2.34 # Page characteristics.
2.35
2.36 @@ -118,8 +127,8 @@
2.37 if not pagename:
2.38 return None
2.39
2.40 - return self.dir.get_filename(join(self.attachments_dir,
2.41 - pagename, filename))
2.42 + return self.dir.get_filename(join(self._get_attachments_dir(pagename),
2.43 + filename))
2.44
2.45 # NOTE: Translation methods should encode filenames appropriately.
2.46
3.1 --- a/moinformat/serialisers/html/graphviz.py Wed Aug 07 15:44:50 2019 +0200
3.2 +++ b/moinformat/serialisers/html/graphviz.py Wed Aug 07 15:48:00 2019 +0200
3.3 @@ -108,7 +108,7 @@
3.4
3.5 # Determine the inline status, with only SVG being appropriate.
3.6
3.7 - inline = format == "svg"
3.8 + inline = format == "svg" and not self.metadata.get("no_inline")
3.9
3.10 # Non-inline graph output is stored for a known page only.
3.11