From 51987eaf39e1a49f36d4d5256ef311d69edb6578 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 29 Nov 2014 22:19:29 +0100 Subject: [PATCH] [docmaker] Improve HTML code for table of contents.. * src/toold/docmaker/tohtml.py: Introduce a new table class `toc', together with proper CSS. --- ChangeLog | 7 ++++++ src/tools/docmaker/tohtml.py | 43 +++++++++++++++++++----------------- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index e07184026..e3e64496c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2014-11-29 Werner Lemberg + + [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 [docmaker] Provide higher-level markup and simplify HTML. diff --git a/src/tools/docmaker/tohtml.py b/src/tools/docmaker/tohtml.py index da9eb2cb5..7d32cec9c 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; } @@ -204,9 +205,12 @@ source_header = "
"
 source_footer = "
" # Chapter header/inter/footer. -chapter_header = '

' -chapter_inter = '

  • ' -chapter_footer = '
' +chapter_header = """\ +
+

\ +""" +chapter_inter = '

' +chapter_footer = '
' # 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 '' + print '
' def toc_section_enter( self, section ): - print '
' - print( '' - + section.title + '' ) - + print ( '
' ) print self.make_html_para( section.abstract ) def toc_section_exit( self, section ):