[gtk-doc] db2html: add more content
- From: Stefan Sauer <stefkost src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-doc] db2html: add more content
- Date: Thu, 11 Jan 2018 17:47:57 +0000 (UTC)
commit 3be46ab1e1fd42bb35d62f2e35c813a083a14229
Author: Stefan Sauer <ensonic users sf net>
Date: Thu Jan 11 18:44:05 2018 +0100
db2html: add more content
Also recurse for unknown tags. Only warn once for them.
tools/db2html.py | 18 ++++++++++++++----
tools/templates/refentry.html | 2 ++
2 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/tools/db2html.py b/tools/db2html.py
index ab485d2..fac82cd 100644
--- a/tools/db2html.py
+++ b/tools/db2html.py
@@ -191,13 +191,22 @@ def chunk(xml_node, parent=None):
def convert__inner(xml):
result = ''
for child in xml:
- result += convert_tags.get(child.tag)(child)
+ result += convert_tags.get(child.tag, convert__unknown)(child)
return result
+missing_tags = {}
+
+
def convert__unknown(xml):
- logging.warning('Add tag converter for "%s"', xml.tag)
- return '<!-- ' + xml.tag + '-->\n'
+ # TODO: warn only once
+ if xml.tag not in missing_tags:
+ logging.warning('Add tag converter for "%s"', xml.tag)
+ missing_tags[xml.tag] = True
+ result = '<!-- ' + xml.tag + '-->\n'
+ result += convert__inner(xml)
+ result += '<!-- /' + xml.tag + '-->\n'
+ return result
def convert_para(xml):
@@ -207,7 +216,7 @@ def convert_para(xml):
if xml.text:
result += xml.text
result += convert__inner(xml)
- result += '\n</p>'
+ result += '</p>'
if xml.tail:
result += xml.tail
return result
@@ -243,6 +252,7 @@ def convert(out_dir, files, node):
template = TEMPLATES[node.name]
template.globals['convert_para'] = convert_para
+ template.globals['convert_inner'] = convert__inner
params = {
'xml': node.xml,
'title': node.title,
diff --git a/tools/templates/refentry.html b/tools/templates/refentry.html
index 152e798..9ec4e51 100644
--- a/tools/templates/refentry.html
+++ b/tools/templates/refentry.html
@@ -24,6 +24,8 @@
{%- for sect in xml.findall('refsect1') %}
<div class="refsect1">
<a name="{{ sect.attrib['id'] }}"></a><h2>{{ sect.findtext('title') }}</h2>
+{# TODO: can we remove title so that we don't copy this again #}
+{{ convert_inner(sect) }}
</div>
{%- endfor %}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]