summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Sauer <ensonic@users.sf.net>2019-09-08 21:42:57 +0200
committerStefan Sauer <ensonic@users.sf.net>2019-09-08 21:42:57 +0200
commit51e19ce72c11241c8dd81812631e5f20b3de645e (patch)
treee392d476db090431fd77aced89c79fd08a248531
parentee4ff251f1de101988687692af0eb292882227b2 (diff)
downloadgtk-doc-51e19ce72c11241c8dd81812631e5f20b3de645e.tar.gz
mkdb: only output object_index.sgml if not empty
Only output the index if the library provices gobjects. We already do this for the tree_index.sgml.
-rw-r--r--NEWS4
-rw-r--r--gtkdoc/mkdb.py18
-rwxr-xr-xtests/sanity.sh24
3 files changed, 26 insertions, 20 deletions
diff --git a/NEWS b/NEWS
index 9778c7e..41b80f9 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,10 @@ GTK-Doc 1.32.1 (Aug 15 2019)
Dev version
+This version does not generate object_index.sgml if the library contains no
+gobjects.
+
+
GTK-Doc 1.32 (Aug 15 2019)
===============
diff --git a/gtkdoc/mkdb.py b/gtkdoc/mkdb.py
index 9d910cb..9404452 100644
--- a/gtkdoc/mkdb.py
+++ b/gtkdoc/mkdb.py
@@ -341,7 +341,7 @@ def Run(options):
logging.info('namespace prefix ="%s"', NAME_SPACE)
OutputObjectTree(obj_tree)
- OutputObjectList()
+ OutputObjectList(Objects)
OutputIndex("api-index-full", IndexEntriesFull)
OutputIndex("api-index-deprecated", IndexEntriesDeprecated)
@@ -354,10 +354,15 @@ def Run(options):
logging.info("All files created: %d", changed)
-def OutputObjectList():
+def OutputObjectList(obj_list):
"""This outputs the alphabetical list of objects, in a columned table."""
# FIXME: Currently this also outputs ancestor objects which may not actually
# be in this module.
+
+ # TODO(ensonic): consider not writing this unconditionally
+ if not obj_list:
+ return
+
cols = 3
# FIXME: use .xml
@@ -386,13 +391,8 @@ def OutputObjectList():
OUTPUT.write("</row>\n")
count += 1
- if count == 0:
- # emit an empty row, since empty tables are invalid
- OUTPUT.write("<row><entry> </entry></row>\n")
-
- else:
- if count % cols > 0:
- OUTPUT.write("</row>\n")
+ if count % cols > 0:
+ OUTPUT.write("</row>\n")
OUTPUT.write('''</tbody></tgroup></informaltable>\n''')
OUTPUT.close()
diff --git a/tests/sanity.sh b/tests/sanity.sh
index 8c1f2a8..68db064 100755
--- a/tests/sanity.sh
+++ b/tests/sanity.sh
@@ -56,17 +56,19 @@ if test $nok -gt 0 ; then failed=`expr $failed + 1`; fi
tested=`expr $tested + 1`
-# check validity of generated sgml files
-nok=0
-for file in $dir/$suite/docs/xml/*.sgml; do
- xmllint --noout --noent $file
- if test $? != 0 ; then
- echo 1>&2 "sgml validity check failed for $file"
- nok=`expr $nok + 1`;
- fi
-done
-if test $nok -gt 0 ; then failed=`expr $failed + 1`; fi
-tested=`expr $tested + 1`
+# check validity of generated sgml files (if any)
+if ls $dir/$suite/docs/xml/*.sgml 1> /dev/null 2>&1; then
+ nok=0
+ for file in $dir/$suite/docs/xml/*.sgml; do
+ xmllint --noout --noent $file
+ if test $? != 0 ; then
+ echo 1>&2 "sgml validity check failed for $file"
+ nok=`expr $nok + 1`;
+ fi
+ done
+ if test $nok -gt 0 ; then failed=`expr $failed + 1`; fi
+ tested=`expr $tested + 1`
+fi
# check validity of devhelp2 files
nok=0