[gtk-doc] db2html: more planning
- From: Stefan Sauer <stefkost src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-doc] db2html: more planning
- Date: Sat, 16 Dec 2017 20:18:14 +0000 (UTC)
commit 27ccac13cbc388d8e7f1474aa8bfc634854b8a51
Author: Stefan Sauer <ensonic users sf net>
Date: Sat Dec 16 20:57:06 2017 +0100
db2html: more planning
Add some more comemnts for how to do things.
tools/db2html.py | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/tools/db2html.py b/tools/db2html.py
index 0dab266..f7f498d 100644
--- a/tools/db2html.py
+++ b/tools/db2html.py
@@ -25,6 +25,7 @@ The tool loaded the main xml document (<module>-docs.xml) and chunks it
like the xsl-stylesheets would do. For that it resolves all the xml-includes.
TODO: convert the docbook-xml to html
+- try macros for the navigation
Requirements:
sudo pip3 install anytree jinja2 lxml
@@ -153,6 +154,10 @@ def chunk(out_dir, xml_node, parent=None):
out_filename = os.path.join(out_dir, base)
# print('*** %s ***' % (out_filename))
# TODO: do we need to remove the xml-node from the parent?
+ # we generate toc from the files tree
+ # from copy import deepcopy
+ # ..., xml=deepcopy(xml_node), ...
+ # xml_node.getparent().remove(xml_node)
parent = Node(xml_node.tag, parent=parent, xml=xml_node, filename=out_filename)
for child in xml_node:
chunk(out_dir, child, parent)
@@ -166,6 +171,9 @@ def convert(node):
logging.info('Writing: %s', node.filename)
with open(node.filename, 'wt') as html:
if node.name in TEMPLATES:
+ # TODO: ideally precomiple common xpath exprs once:
+ # func = etree.XPath("//b")
+ # func(xml_node)[0]
def lxml_xpath(expr):
return node.xml.xpath(expr, smart_strings=False)[0]
@@ -205,6 +213,7 @@ def main(index_file):
# can generate navigation and link tags
files = chunk(out_dir, tree.getroot())
# 2) walk the tree and output files
+ # TODO: iterate with the anytree iterator and use multiprocessing
convert(files)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]