diff options
author | Stefan Sauer <ensonic@users.sf.net> | 2018-02-22 21:09:10 +0100 |
---|---|---|
committer | Stefan Sauer <ensonic@users.sf.net> | 2018-02-22 21:11:48 +0100 |
commit | 18f6c53608ef904c81ec4aebc5ee4e0258a77028 (patch) | |
tree | 1f472413ead6934c3b18b895e92670402952a3ab /tools | |
parent | 3188a2e3078ba8f9cf7221aa296d6bd2b5b82629 (diff) | |
download | gtk-doc-18f6c53608ef904c81ec4aebc5ee4e0258a77028.tar.gz |
db2html: change id generator to be based on the xml-tree
Diffstat (limited to 'tools')
-rw-r--r-- | tools/db2html.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/tools/db2html.py b/tools/db2html.py index 1cc3180..639ed46 100644 --- a/tools/db2html.py +++ b/tools/db2html.py @@ -685,18 +685,17 @@ def get_id(node): return node_id logging.warning('%d: No "id" attribute on "%s"', xml.sourceline, xml.tag) - # Generate the 'id'. We need to walk up the tree and check the positions - # for each sibling. - # TODO(ensonic): we're doing it on the chunk level, do we need to do this on - # the xml tree? For one example we expect 'id-1.2' but generated 'id-1' - # See docbook-xsl/common/common.xsl:468 ix = [] - while node.parent: - children = node.parent.children - ix.insert(0, str(children.index(node) + 1)) - node = node.parent - # logging.warning('indexes: %s', str(ix)) - return 'id-' + '.'.join(ix) + # Generate the 'id'. We need to walk up the xml-tree and check the positions + # for each sibling. + parent = xml.getparent() + while parent is not None: + children = parent.getchildren() + ix.insert(0, str(children.index(xml) + 1)) + xml = parent + parent = xml.getparent() + # logging.warning('%s: id indexes: %s', node.filename, str(ix)) + return 'id-1.' + '.'.join(ix) # docbook chunks |