[docmaker] Improve HTML code for table of contents.. * src/toold/docmaker/tohtml.py: Introduce a new table class `toc', together with proper CSS.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
diff --git a/ChangeLog b/ChangeLog
index e071840..e3e6449 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2014-11-29 Werner Lemberg <wl@gnu.org>
+ [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 <wl@gnu.org>
+
[docmaker] Provide higher-level markup and simplify HTML.
* src/tools/docmaker/tohtml.py: Instead of using extraneous `<div>'
diff --git a/src/tools/docmaker/tohtml.py b/src/tools/docmaker/tohtml.py
index da9eb2c..7d32cec 100644
--- a/src/tools/docmaker/tohtml.py
+++ b/src/tools/docmaker/tohtml.py
@@ -45,8 +45,6 @@ html_header_2 = """\
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 @@ html_header_2 = """\
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 @@ html_header_2 = """\
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 @@ html_header_2 = """\
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 @@ html_header_2 = """\
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 @@ html_header_2 = """\
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_header = "<pre>"
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 @@ class HtmlFormatter( Formatter ):
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 ):