# HG changeset patch # User Paul Boddie # Date 1551385501 -3600 # Node ID 57cffdabb67090f3471e20bd45568efcb7517cef # Parent 969d5eb584736c055e8f46d08521227c05eb2ef1# Parent 44df186028399104e7b846f8d4bfac6a7234ae44 Merged changes from the default branch. diff -r 969d5eb58473 -r 57cffdabb670 moinconvert --- a/moinconvert Thu Feb 14 23:35:58 2019 +0100 +++ b/moinconvert Thu Feb 28 21:25:01 2019 +0100 @@ -289,6 +289,8 @@ if macros: p.evaluate_macros() + p.update_metadata(metadata) + # Show a document tree for debugging purposes, if requested. if tree: @@ -332,9 +334,12 @@ help_text = """\ Usage: %s [ ] ( --all | ... ) +Input file options: + +--all Detect all document files in the specified input directory + Input options: ---all Detect all document files in the specified input directory --input-dir Indicate an input directory containing document files --input-dir-type Indicate the type of input directory involved (default: directory) diff -r 969d5eb58473 -r 57cffdabb670 moinformat/parsers/moin.py --- a/moinformat/parsers/moin.py Thu Feb 14 23:35:58 2019 +0100 +++ b/moinformat/parsers/moin.py Thu Feb 28 21:25:01 2019 +0100 @@ -123,6 +123,15 @@ macro = macro_cls(node, self.region) macro.evaluate() + # Metadata extraction. + + def update_metadata(self, metadata): + + "Update 'metadata' for the document." + + if self.headings: + metadata.set("title", self.headings[0].text_content()) + # Heading disambiguation. def identify_headings(self): diff -r 969d5eb58473 -r 57cffdabb670 moinformat/themes/html.py --- a/moinformat/themes/html.py Thu Feb 14 23:35:58 2019 +0100 +++ b/moinformat/themes/html.py Thu Feb 28 21:25:01 2019 +0100 @@ -3,7 +3,7 @@ """ Common HTML theme functionality. -Copyright (C) 2018 Paul Boddie +Copyright (C) 2018, 2019 Paul Boddie This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -71,7 +71,7 @@ "encoding" : self.output.encoding, "root" : self.linker.get_top_level() or ".", "text" : text, - "title" : self.metadata.get("pagename"), + "title" : self.metadata.get("title") or self.metadata.get("pagename"), } subs["links"] = self.get_links(subs) return template % subs