ref: 51987eaf39e1a49f36d4d5256ef311d69edb6578
parent: aa834ce580585c739e9b5db0db520e1c26ca537f
author: Werner Lemberg <[email protected]>
date: Sat Nov 29 17:19:29 EST 2014
[docmaker] Improve HTML code for table of contents.. * src/toold/docmaker/tohtml.py: Introduce a new table class `toc', together with proper CSS.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2014-11-29 Werner Lemberg <[email protected]>
+ [docmaker] Improve HTML code for table of contents..
+
+ * src/toold/docmaker/tohtml.py: Introduce a new table class `toc',
+ together with proper CSS.
+
+2014-11-29 Werner Lemberg <[email protected]>
+
[docmaker] Provide higher-level markup and simplify HTML.
* src/tools/docmaker/tohtml.py: Instead of using extraneous `<div>'
--- a/src/tools/docmaker/tohtml.py
+++ b/src/tools/docmaker/tohtml.py
@@ -45,8 +45,6 @@
width: 87%;
margin: auto; }
- div.indent2 { width: 75%;
- margin: auto; }
div.section { width: 75%;
margin: auto; }
div.section hr { margin: 4ex 0 1ex 0; }
@@ -62,6 +60,8 @@
padding: 2ex 0 2ex 1%; }
div.section table.fields { width: 90%;
margin: 1.5ex 0 1.5ex 10%; }
+ div.section table.toc { width: 95%;
+ margin: 1.5ex 0 1.5ex 5%; }
div.timestamp { text-align: center;
font-size: 69%;
margin: 1.5ex 0 1.5ex 0; }
@@ -70,8 +70,6 @@
h3 { font-size: medium;
margin: 4ex 0 1.5ex 0; }
- li { text-align: justify; }
-
p { text-align: justify; }
pre.colored { color: blue; }
@@ -81,7 +79,6 @@
white-space: pre;
color: darkblue; }
- table.center { margin: auto; }
table.fields td.val { font-weight: bold;
text-align: right;
width: 30%;
@@ -89,6 +86,7 @@
padding: 0 1em 0 0; }
table.fields td.desc { vertical-align: baseline;
padding: 0 0 0 1em; }
+ table.fields td.desc p { margin: 1.5ex 0 1.5ex 0; }
table.index { margin: 6ex auto 6ex auto;
border: 0;
border-collapse: separate;
@@ -108,19 +106,22 @@
table.index-toc-link td.right { padding: 0 0.5em 0 0.5em;
font-size: 83%;
text-align: right; }
- table.synopsis { margin: auto;
+ table.synopsis { margin: 6ex auto 6ex auto;
border: 0;
border-collapse: separate;
border-spacing: 2em 0.6ex; }
table.synopsis tr { padding: 0; }
table.synopsis td { padding: 0; }
+ table.toc td.link { width: 30%;
+ text-align: right;
+ vertical-align: baseline;
+ padding: 0 1em 0 0; }
+ table.toc td.desc { vertical-align: baseline;
+ padding: 0 0 0 1em;
+ text-align: left; }
+ table.toc td.desc p { margin: 1.5ex 0 1.5ex 0;
+ text-align: left; }
- td { padding: 0 0.5em 0 0.5em; }
- td.desc p { margin: 1.5ex 0 1.5ex 0; }
- td.left { padding: 0 0.5em 0 0.5em;
- text-align: left; }
-
- ul.empty { list-style-type: none; }
</style>
</head>
<body>
@@ -204,9 +205,12 @@
source_footer = "</pre>"
# Chapter header/inter/footer.
-chapter_header = '<br><div class="indent2"><h2>'
-chapter_inter = '</h2><ul class="empty"><li>'
-chapter_footer = '</li></ul></div>'
+chapter_header = """\
+<div class="section">
+<h2>\
+"""
+chapter_inter = '</h2>'
+chapter_footer = '</div>'
# Index footer.
index_footer_start = """\
@@ -503,13 +507,12 @@
def toc_chapter_enter( self, chapter ):
print chapter_header + string.join( chapter.title ) + chapter_inter
- print '<table cellpadding="5">'
+ print '<table class="toc">'
def toc_section_enter( self, section ):
- print '<tr valign="top"><td class="left">'
- print( '<a href="' + self.make_section_url( section ) + '">'
- + section.title + '</a></td><td>' )
-
+ print ( '<tr><td class="link">'
+ + '<a href="' + self.make_section_url( section ) + '">'
+ + section.title + '</a></td><td class="desc">' )
print self.make_html_para( section.abstract )
def toc_section_exit( self, section ):