1.1 --- a/moinconvert Mon Feb 25 21:34:41 2019 +0100
1.2 +++ b/moinconvert Thu Feb 28 21:24:35 2019 +0100
1.3 @@ -289,6 +289,8 @@
1.4 if macros:
1.5 p.evaluate_macros()
1.6
1.7 + p.update_metadata(metadata)
1.8 +
1.9 # Show a document tree for debugging purposes, if requested.
1.10
1.11 if tree:
2.1 --- a/moinformat/parsers/moin.py Mon Feb 25 21:34:41 2019 +0100
2.2 +++ b/moinformat/parsers/moin.py Thu Feb 28 21:24:35 2019 +0100
2.3 @@ -123,6 +123,15 @@
2.4 macro = macro_cls(node, self.region)
2.5 macro.evaluate()
2.6
2.7 + # Metadata extraction.
2.8 +
2.9 + def update_metadata(self, metadata):
2.10 +
2.11 + "Update 'metadata' for the document."
2.12 +
2.13 + if self.headings:
2.14 + metadata.set("title", self.headings[0].text_content())
2.15 +
2.16 # Heading disambiguation.
2.17
2.18 def identify_headings(self):
3.1 --- a/moinformat/themes/html.py Mon Feb 25 21:34:41 2019 +0100
3.2 +++ b/moinformat/themes/html.py Thu Feb 28 21:24:35 2019 +0100
3.3 @@ -3,7 +3,7 @@
3.4 """
3.5 Common HTML theme functionality.
3.6
3.7 -Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk>
3.8 +Copyright (C) 2018, 2019 Paul Boddie <paul@boddie.org.uk>
3.9
3.10 This program is free software; you can redistribute it and/or modify it under
3.11 the terms of the GNU General Public License as published by the Free Software
3.12 @@ -71,7 +71,7 @@
3.13 "encoding" : self.output.encoding,
3.14 "root" : self.linker.get_top_level() or ".",
3.15 "text" : text,
3.16 - "title" : self.metadata.get("pagename"),
3.17 + "title" : self.metadata.get("title") or self.metadata.get("pagename"),
3.18 }
3.19 subs["links"] = self.get_links(subs)
3.20 return template % subs