From 3972457de72fa6d95d94df14a3bb402798aa092c Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Tue, 25 Nov 2003 16:21:00 +0000 Subject: [PATCH] make the generated HTML more XHTML friendly --- Doc/tools/buildindex.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Doc/tools/buildindex.py b/Doc/tools/buildindex.py index 08fdb7b33a8..a07ed2faac7 100755 --- a/Doc/tools/buildindex.py +++ b/Doc/tools/buildindex.py @@ -7,6 +7,8 @@ import re import string import sys +from xml.sax.saxutils import quoteattr + bang_join = "!".join null_join = "".join @@ -215,7 +217,7 @@ def split_columns(nodes, columns=1): DL_LEVEL_INDENT = " " def format_column(nodes): - strings = ["
"] + strings = ["
"] append = strings.append level = 0 previous = [] @@ -227,7 +229,7 @@ def format_column(nodes): break count = i + 1 if count > level: - append("
" * (count - level) + "\n") + append("
" * (count - level) + "\n") level = count elif level > count: append("\n") @@ -242,7 +244,7 @@ def format_column(nodes): extra = " (continued)" else: extra = "" - append("\n
%s%s\n
\n%s
" + append("\n
%s%s\n
\n%s
" % (term, extra, level * DL_LEVEL_INDENT)) append("\n%s
%s%s" % (level * DL_LEVEL_INDENT, node.links[0], node.text[-1])) @@ -271,7 +273,6 @@ def format_nodes(nodes, columns=1): append("\n") else: append(format_column(nodes)) - append("\n

\n") return null_join(strings) @@ -282,8 +283,8 @@ def format_letter(letter): lettername = "_ (underscore)" else: lettername = letter.capitalize() - return "\n


\n

%s

\n\n" \ - % (letter, lettername) + return "\n
\n

%s

\n\n" \ + % (quoteattr("letter-" + letter), lettername) def format_html_letters(nodes, columns, group_symbol_nodes): @@ -294,7 +295,7 @@ def format_html_letters(nodes, columns, group_symbol_nodes): for letter, nodes in letter_groups: s = "%s" % (letter, letter) items.append(s) - s = ["
\n%s
\n" % " |\n".join(items)] + s = ["
\n%s
\n" % " |\n".join(items)] for letter, nodes in letter_groups: s.append(format_letter(letter)) s.append(format_nodes(nodes, columns))