[gtk-doc] mkhtml2: add more tag converters
- From: Stefan Sauer <stefkost src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-doc] mkhtml2: add more tag converters
- Date: Sat, 24 Mar 2018 21:07:30 +0000 (UTC)
commit ed0b9d63d0964dc07fe9ee262408c574eb930fbb
Author: Stefan Sauer <ensonic users sf net>
Date: Sat Mar 24 22:00:54 2018 +0100
mkhtml2: add more tag converters
Add converters usually use in bookinfo.
gtkdoc/mkhtml2.py | 28 ++++++++++++++++++++++++----
1 files changed, 24 insertions(+), 4 deletions(-)
---
diff --git a/gtkdoc/mkhtml2.py b/gtkdoc/mkhtml2.py
index f867f1a..914a21f 100644
--- a/gtkdoc/mkhtml2.py
+++ b/gtkdoc/mkhtml2.py
@@ -278,8 +278,7 @@ def xml_get_title(xml):
def convert_bookinfo(ctx, xml):
result = ['<div class="titlepage">']
- for releaseinfo in xml.findall('releaseinfo'):
- result.extend(convert_para(ctx, releaseinfo))
+ convert_inner(ctx, xml, result)
result.append("""<hr>
</div>""")
if xml.tail:
@@ -310,6 +309,17 @@ def convert_colspec(ctx, xml):
return result
+def convert_corpauthor(ctx, xml):
+ result = ['<div><h3 class="corpauthor">\n']
+ if xml.text:
+ result.append(xml.text)
+ convert_inner(ctx, xml, result)
+ result.append('</h3></div>\n')
+ if xml.tail:
+ result.append(xml.tail)
+ return result
+
+
def convert_div(ctx, xml):
result = ['<div class="%s">\n' % xml.tag]
if xml.text:
@@ -428,9 +438,13 @@ def convert_orderedlist(ctx, xml):
def convert_para(ctx, xml):
- result = ['<p>']
+ result = []
+ if 'id' in xml.attrib:
+ result.append('<a name="%s"></a>' % xml.attrib['id'])
if xml.tag != 'para':
- result = ['<p class="%s">' % xml.tag]
+ result.append('<p class="%s">' % xml.tag)
+ else:
+ result.append('<p>')
if xml.text:
result.append(xml.text)
convert_inner(ctx, xml, result)
@@ -587,6 +601,7 @@ convert_tags = {
'bookinfo': convert_bookinfo,
'blockquote': convert_blockquote,
'colspec': convert_colspec,
+ 'corpauthor': convert_corpauthor,
'entry': convert_entry,
'function': convert_span,
'indexdiv': convert_indexdiv,
@@ -595,6 +610,7 @@ convert_tags = {
'informalexample': convert_div,
'informaltable': convert_informaltable,
'itemizedlist': convert_itemizedlist,
+ 'legalnotice': convert_para,
'link': convert_link,
'listitem': convert_listitem,
'literal': convert_literal,
@@ -782,6 +798,10 @@ def convert_book(ctx):
""" % node.title
]
bookinfo = node.xml.findall('bookinfo')[0]
+ # we already used the title
+ title = bookinfo.find('title')
+ if title is not None:
+ bookinfo.remove(title)
result.extend(convert_bookinfo(ctx, bookinfo))
result.append("""<div class="toc">
<dl class="toc">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]