[gtk-doc] db2html: enable the expression extension
- From: Stefan Sauer <stefkost src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-doc] db2html: enable the expression extension
- Date: Thu, 11 Jan 2018 20:44:32 +0000 (UTC)
commit 372edb6372bd02836013980ea6e04596c2e528bb
Author: Stefan Sauer <ensonic users sf net>
Date: Thu Jan 11 21:43:20 2018 +0100
db2html: enable the expression extension
This lets us remove the processes tile node. Also fix the ulink converter.
tools/db2html.py | 8 +++++---
tools/templates/refentry.html | 5 +++--
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 %}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]