[gtk-doc] mkhtml2: tweak toc handling
- From: Stefan Sauer <stefkost src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-doc] mkhtml2: tweak toc handling
- Date: Tue, 3 Apr 2018 06:58:49 +0000 (UTC)
commit d6005bfe329b1fa1a94d61abbe66ed2649ae2ba6
Author: Stefan Sauer <ensonic users sf net>
Date: Tue Apr 3 07:33:15 2018 +0200
mkhtml2: tweak toc handling
Move the toc before the content. Only add the heading + the divs if the toc
is not empty.
gtkdoc/mkhtml2.py | 22 ++++++++++++----------
1 files changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/gtkdoc/mkhtml2.py b/gtkdoc/mkhtml2.py
index 5b33273..ef36293 100644
--- a/gtkdoc/mkhtml2.py
+++ b/gtkdoc/mkhtml2.py
@@ -1140,17 +1140,19 @@ def convert_chunk_with_toc(ctx, div_class, title_tag):
</div>""" % (
title_tag, get_id(node), title.text, title_tag))
node.xml.remove(title)
+
+ toc = generate_toc(ctx, node)
+ if toc:
+ # TODO: not all docbook page types use this extra heading
+ result.append("""<p><b>Table of Contents</b></p>
+ <div class="toc">
+ <dl class="toc">
+ """)
+ result.extend(toc)
+ result.append("""</dl>
+ </div>
+ """)
convert_inner(ctx, node.xml, result)
- result.append("""<p>
- <b>Table of Contents</b>
-</p>
-<div class="toc">
- <dl class="toc">
-""")
- result.extend(generate_toc(ctx, node))
- result.append("""</dl>
-</div>
-""")
result.extend(generate_footer(ctx))
result.append("""</div>
</body>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]