[gtk-doc] mkdb: only output object_index.sgml if not empty
- From: Stefan Sauer <stefkost src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-doc] mkdb: only output object_index.sgml if not empty
- Date: Sun, 8 Sep 2019 19:44:31 +0000 (UTC)
commit 51e19ce72c11241c8dd81812631e5f20b3de645e
Author: Stefan Sauer <ensonic users sf net>
Date: Sun Sep 8 21:42:57 2019 +0200
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.
NEWS | 4 ++++
gtkdoc/mkdb.py | 18 +++++++++---------
tests/sanity.sh | 24 +++++++++++++-----------
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]