[gtk-doc] mkhtml2: handle label attrs for titles



commit 529070076e7ae4b0bbf505cf3688772d027be75c
Author: Stefan Sauer <ensonic users sf net>
Date:   Fri Apr 27 09:28:51 2018 +0200

    mkhtml2: handle label attrs for titles
    
    Prepend the label if one is set on a chunk node.

 gtkdoc/mkhtml2.py |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/gtkdoc/mkhtml2.py b/gtkdoc/mkhtml2.py
index 5a49937..e98426a 100644
--- a/gtkdoc/mkhtml2.py
+++ b/gtkdoc/mkhtml2.py
@@ -39,10 +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'
-  - handle 'label' attributes on part/chapter/section-types
-    - the titles will have a generated prefix, such as 'Part I:'
-      (locale dependent)
-    - in the toc it would only be the label: 'I.'
   - handle the 'xref' tag
     - this needs the title + the type of the target
     - for the title, see add_id_links_and_titles(), we can also store the tag
@@ -207,8 +203,15 @@ def get_chunk_titles(module, node):
     }
     res = title(node)
     if res:
+        # handle chunk label for tocs
+        label = node.attrib.get('label')
+        if label:
+            label += '. '
+        else:
+            label = ''
+
         xml = res[0]
-        result['title'] = ''.join(convert_title(ctx, xml))
+        result['title'] = label + ''.join(convert_title(ctx, xml))
         if xml.tag != 'title':
             result['title_tag'] = xml.tag
         else:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]