From b637c7e13a6bcd9c82903c7cf94bb6c1760e0e4a Mon Sep 17 00:00:00 2001 From: Stefan Sauer Date: Tue, 16 Jan 2018 18:51:24 +0100 Subject: [PATCH] db2html: add special handling for tgroup --- tools/db2html.py | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/tools/db2html.py b/tools/db2html.py index 0906daa..a555fc9 100644 --- a/tools/db2html.py +++ b/tools/db2html.py @@ -60,6 +60,9 @@ from anytree import Node, PreOrderIter from jinja2 import Environment, FileSystemLoader from lxml import etree +# TODO(ensonic): requires gtk-doc to be installed, rewrite later +from gtkdoc.fixxref import NoLinks + # http://www.sagehill.net/docbookxsl/Chunking.html CHUNK_TAGS = [ @@ -306,13 +309,20 @@ def convert_itemizedlist(xml): def convert_link(xml): - # TODO: inline fixxref functionality + # TODO: inline more fixxref functionality # TODO: need to build an 'id' map and resolve against internal links too - result = '' % xml.attrib.get('linkend', '') + linkend = xml.attrib['linkend'] + if linkend in NoLinks: + linkend = None + if linkend: + result = '' % linkend + else: + result = '' if xml.text: result += xml.text result += convert__inner(xml) - result += '' + if linkend: + result += '' if xml.tail: result += xml.tail return result @@ -429,11 +439,19 @@ def convert_tbody(xml): def convert_tgroup(xml): - result = '\n' - result += convert__inner(xml) - result += '\n' + # tgroup does not expand to anything, but the nested colspecs need to + # be put into a colgroup + cols = xml.findall('colspec') + result = [] + if cols: + result.append('\n') + for col in cols: + result.append(convert_colspec(col)) + xml.remove(col) + result.append('\n') + result.append(convert__inner(xml)) # is in informaltable and there can be no 'text' - return result + return ''.join(result) def convert_ulink(xml): -- 2.11.4.GIT