summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorStefan Sauer <ensonic@users.sf.net>2018-01-11 21:43:20 +0100
committerStefan Sauer <ensonic@users.sf.net>2018-01-11 21:43:20 +0100
commit372edb6372bd02836013980ea6e04596c2e528bb (patch)
tree9ffa359a4b13d14cdb576d6440fced0dc8e64b7c /tools
parent23832909267359b06f888e3d2f225ac145bbd627 (diff)
downloadgtk-doc-372edb6372bd02836013980ea6e04596c2e528bb.tar.gz
db2html: enable the expression extension
This lets us remove the processes tile node. Also fix the ulink converter.
Diffstat (limited to 'tools')
-rw-r--r--tools/db2html.py8
-rw-r--r--tools/templates/refentry.html5
2 files changed, 8 insertions, 5 deletions
diff --git a/tools/db2html.py b/tools/db2html.py
index fac82cd..cdd3853 100644
--- a/tools/db2html.py
+++ b/tools/db2html.py
@@ -119,6 +119,7 @@ TEMPLATE_ENV = Environment(
# loader=PackageLoader('gtkdoc', 'templates'),
# autoescape=select_autoescape(['html', 'xml'])
loader=FileSystemLoader(os.path.join(TOOL_PATH, 'templates')),
+ extensions=['jinja2.ext.do'],
autoescape=False,
trim_blocks=True,
)
@@ -199,7 +200,7 @@ missing_tags = {}
def convert__unknown(xml):
- # TODO: warn only once
+ # warn only once
if xml.tag not in missing_tags:
logging.warning('Add tag converter for "%s"', xml.tag)
missing_tags[xml.tag] = True
@@ -223,8 +224,9 @@ def convert_para(xml):
def convert_ulink(xml):
- url = xml.text
- result = '<a class="%s" href="%s">%s</a>' % (xml.tag, url, url)
+ result = '<a class="%s" href="%s">%s</a>' % (xml.tag, xml.attrib['url'], xml.text)
+ if xml.tail:
+ result += xml.tail
return result
diff --git a/tools/templates/refentry.html b/tools/templates/refentry.html
index 9ec4e51..d98449a 100644
--- a/tools/templates/refentry.html
+++ b/tools/templates/refentry.html
@@ -23,8 +23,9 @@
{%- 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 #}
+{% set tag=sect.find('title') -%}
+<a name="{{ sect.attrib['id'] }}"></a><h2>{{ tag.text }}</h2>
+{% do sect.remove(tag) %}
{{ convert_inner(sect) }}
</div>
{%- endfor %}