[gtk-doc] mkdb: don't output acronym tags for unknown stability levels



commit 1ae0914ecf52ab02f974c95d9f5c7049c8bb442d
Author: Stefan Sauer <ensonic users sf net>
Date:   Mon Jan 8 23:42:36 2018 +0100

    mkdb: don't output acronym tags for unknown stability levels
    
    This avoid acronym warning from the html generator.

 gtkdoc/mkdb.py                  |   21 ++++++++++++---------
 tests/bugs/docs/tester-docs.xml |    1 -
 tests/sanity.sh                 |    3 +++
 3 files changed, 15 insertions(+), 10 deletions(-)
---
diff --git a/gtkdoc/mkdb.py b/gtkdoc/mkdb.py
index 9c3b7c5..c8cf095 100644
--- a/gtkdoc/mkdb.py
+++ b/gtkdoc/mkdb.py
@@ -1147,8 +1147,10 @@ def OutputSymbolTraits(symbol):
 
     if symbol in StabilityLevel:
         stability = StabilityLevel[symbol]
-        AnnotationsUsed[stability] = True
-        desc += "<para role=\"stability\">Stability Level: <acronym>%s</acronym></para>" % stability
+        if stability in AnnotationDefinition:
+            AnnotationsUsed[stability] = True
+            stability = "<acronym>%s</acronym>" % stability
+        desc += "<para role=\"stability\">Stability Level: %s</para>" % stability
     return desc
 
 
@@ -2034,7 +2036,7 @@ def ParseStabilityLevel(stability, file, line, message):
         str: the parsed stability level string.
     """
     stability = stability.strip()
-    sl = stability.lower()
+    sl = stability.strip().lower()
     if sl == 'stable':
         stability = "Stable"
     elif sl == 'unstable':
@@ -2116,14 +2118,15 @@ def OutputDBFile(file, title, section_id, includes, functions_synop, other_synop
         stability = ParseStabilityLevel(stability, file, line_number, "Section stability level")
         logging.info("Found stability: %s", stability)
 
+    if not stability:
+        stability = DEFAULT_STABILITY or ''
+
     if stability:
-        AnnotationsUsed[stability] = 1
-        stability = "<refsect1 id=\"%s.stability-level\">\n<title>Stability 
Level</title>\n<acronym>%s</acronym>, unless otherwise indicated\n</refsect1>\n" % (
+        if stability in AnnotationDefinition:
+            AnnotationsUsed[stability] = True
+            stability = "<acronym>%s</acronym>" % stability
+        stability = "<refsect1 id=\"%s.stability-level\">\n<title>Stability Level</title>\n%s, unless 
otherwise indicated\n</refsect1>\n" % (
             section_id, stability)
-    elif DEFAULT_STABILITY:
-        AnnotationsUsed[DEFAULT_STABILITY] = 1
-        stability = "<refsect1 id=\"%s.stability-level\">\n<title>Stability 
Level</title>\n<acronym>%s</acronym>, unless otherwise indicated\n</refsect1>\n" % (
-            section_id, DEFAULT_STABILITY)
 
     image = SymbolDocs.get(file + ":Image")
     if not image or re.search(r'^\s*$', image):
diff --git a/tests/bugs/docs/tester-docs.xml b/tests/bugs/docs/tester-docs.xml
index 7efead4..20ae84f 100644
--- a/tests/bugs/docs/tester-docs.xml
+++ b/tests/bugs/docs/tester-docs.xml
@@ -33,5 +33,4 @@
     <title>Index of new API in 0.1</title>
     <xi:include href="xml/api-index-0.1.xml"><xi:fallback /></xi:include>
   </index>
-  <xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
 </book>
diff --git a/tests/sanity.sh b/tests/sanity.sh
index 24e519d..fe78576 100755
--- a/tests/sanity.sh
+++ b/tests/sanity.sh
@@ -94,6 +94,9 @@ for file in $dir/*/docs/gtkdoc-*.log; do
   if test $file = "$dir/fail/docs/gtkdoc-mkdb.log"; then
     expected_lines="16"
   fi
+  if test $file = "$dir/bugs/docs/gtkdoc-mkdb.log"; then
+    expected_lines="2"
+  fi
   if test $file = "$dir/gobject/docs/gtkdoc-fixxref.log"; then
     expected_lines="2"
   fi


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