[gtk-doc] mkhtml2: handle id-references on structfields
- From: Stefan Sauer <stefkost src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-doc] mkhtml2: handle id-references on structfields
- Date: Wed, 2 May 2018 20:43:26 +0000 (UTC)
commit e252b0cb671b355c96f0b4f48e82ea54b227d151
Author: Stefan Sauer <ensonic users sf net>
Date: Wed May 2 20:03:01 2018 +0200
mkhtml2: handle id-references on structfields
We'll need to sprinkle more such calls as needed.
gtkdoc/mkhtml2.py | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/gtkdoc/mkhtml2.py b/gtkdoc/mkhtml2.py
index 4ea6bcf..b98f1ac 100644
--- a/gtkdoc/mkhtml2.py
+++ b/gtkdoc/mkhtml2.py
@@ -39,9 +39,6 @@ TODO:
- inside 'footnote' one can have many tags, we only handle 'para'/'simpara'
- inside 'inlinemediaobject'/'mediaobject' a 'textobject' becomes the 'alt'
attr on the <img> tag of the 'imageobject'
-- we're missing local anchors in refsect
- - we should create id attrs on the docbook xml, instead of injecting anchors
- in our xsl layer
- check each docbook tag if it can contain #PCDATA, if not don't check for
xml.text
- consider some perf-warnings flag
@@ -326,6 +323,11 @@ def convert_skip(ctx, xml):
return []
+def append_idref(attrib, result):
+ if 'id' in attrib:
+ result.append('<a name="%s"></a>' % attrib['id'])
+
+
def append_text(ctx, text, result):
if text and ('no-strip' in ctx or text.strip()):
result.append(text.replace('<', '<').replace('>', '>'))
@@ -485,6 +487,7 @@ def convert_emphasis(ctx, xml):
def convert_em_class(ctx, xml):
result = ['<em class="%s"><code>' % xml.tag]
+ append_idref(xml.attrib, result)
append_text(ctx, xml.text, result)
convert_inner(ctx, xml, result)
result.append('</code></em>')
@@ -859,8 +862,7 @@ def convert_span(ctx, xml):
def convert_table(ctx, xml):
result = ['<div class="table">']
- if 'id' in xml.attrib:
- result.append('<a name="%s"></a>' % xml.attrib['id'])
+ append_idref(xml.attrib, result)
title_tag = xml.find('title')
if title_tag is not None:
result.append('<p class="title"><b>')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]