[gi-docgen/ebassi/sub-headings: 1/2] generate: Include the description's TOC in type templates




commit 023702fbd29b649eacffb8437efb83de083d5c4b
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Sun Jan 30 22:30:11 2022 +0000

    generate: Include the description's TOC in type templates
    
    This way we can generate an index of the sub-headings inside the
    description of a type.

 gidocgen/gdgenerate.py | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/gidocgen/gdgenerate.py b/gidocgen/gdgenerate.py
index 91d9535..2c06f51 100644
--- a/gidocgen/gdgenerate.py
+++ b/gidocgen/gdgenerate.py
@@ -1223,6 +1223,7 @@ class TemplateInterface:
         if interface.doc is not None:
             self.summary = utils.preprocess_docs(interface.doc.content, namespace, summary=True, md=md)
             self.description = utils.preprocess_docs(interface.doc.content, namespace, md=md)
+            self.description_toc = md.toc_tokens is not None and md.toc_tokens.copy() or None
             filename = interface.doc.filename
             line = interface.doc.line
             if filename.startswith('../'):
@@ -1373,6 +1374,7 @@ class TemplateClass:
         if cls.doc is not None:
             self.summary = utils.preprocess_docs(cls.doc.content, namespace, summary=True, md=md)
             self.description = utils.preprocess_docs(cls.doc.content, namespace, md=md)
+            self.description_toc = md.toc_tokens is not None and md.toc_tokens.copy() or None
             filename = cls.doc.filename
             line = cls.doc.line
             if filename.startswith('../'):
@@ -1580,6 +1582,7 @@ class TemplateRecord:
         if record.doc is not None:
             self.summary = utils.preprocess_docs(record.doc.content, namespace, summary=True, md=md)
             self.description = utils.preprocess_docs(record.doc.content, namespace, md=md)
+            self.description_toc = md.toc_tokens is not None and md.toc_tokens.copy() or None
             filename = record.doc.filename
             line = record.doc.line
             if filename.startswith('../'):
@@ -1658,6 +1661,7 @@ class TemplateUnion:
         if union.doc is not None:
             self.summary = utils.preprocess_docs(union.doc.content, namespace, summary=True, md=md)
             self.description = utils.preprocess_docs(union.doc.content, namespace, md=md)
+            self.description_toc = md.toc_tokens is not None and md.toc_tokens.copy() or None
             filename = union.doc.filename
             line = union.doc.line
             if filename.startswith('../'):


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