summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2003-08-05 03:45:37 (GMT)
committerFred Drake <fdrake@acm.org>2003-08-05 03:45:37 (GMT)
commit2fc88a62d46bbd1ae3fcb2cc4606cc955eee336f (patch)
treee4347e86b21dc115dae714fa589deebf52787cb5
parent4ee2ff36d0581ba6958d38a7a4ee5a1f0df9ca65 (diff)
downloadcpython-2fc88a62d46bbd1ae3fcb2cc4606cc955eee336f.zip
cpython-2fc88a62d46bbd1ae3fcb2cc4606cc955eee336f.tar.gz
cpython-2fc88a62d46bbd1ae3fcb2cc4606cc955eee336f.tar.bz2
make the portions of the generated HTML produced by these styles better
conform to XHTML rules.
-rw-r--r--Doc/perl/l2hinit.perl70
-rw-r--r--Doc/perl/python.perl90
2 files changed, 87 insertions, 73 deletions
diff --git a/Doc/perl/l2hinit.perl b/Doc/perl/l2hinit.perl
index 2164ace..cbf1e41 100644
--- a/Doc/perl/l2hinit.perl
+++ b/Doc/perl/l2hinit.perl
@@ -26,7 +26,7 @@ $BOTTOM_NAVIGATION = 1;
$AUTO_NAVIGATION = 0;
$BODYTEXT = '';
-$CHILDLINE = "\n<p><hr>\n";
+$CHILDLINE = "\n<p></p><hr />\n";
$VERBOSITY = 0;
# default # of columns for the indexes
@@ -104,6 +104,7 @@ sub make_nav_sectref($$$) {
if ($title) {
if ($title =~ /\<[aA] /) {
$title =~ s/\<[aA] /<a class="sectref" rel="$linktype" /;
+ $title =~ s/ HREF=/ href=/;
}
else {
$title = "<span class=\"sectref\">$title</span>";
@@ -138,7 +139,7 @@ sub get_my_icon($) {
}
my $iconserver = ($ICONSERVER eq '.') ? '' : "$ICONSERVER/";
return "<img src='$iconserver$name.$IMAGE_TYPE'\n border='0'"
- . " height='32' alt='$text' width='32'>";
+ . " height='32' alt='$text' width='32' />";
}
sub unlinkify($) {
@@ -157,6 +158,7 @@ sub use_icon($$$) {
$s =~ s/\<tex2html_[a-z_]+_visible_mark\>/$r/;
}
$s =~ s/<[aA] /<a rel="$rel" title="$title" \n /;
+ $s =~ s/ HREF=/ href=/;
return $s;
}
else {
@@ -202,7 +204,7 @@ sub add_child_links {
my $toc = add_real_child_links(@_);
$toc =~ s|\s*</[aA]>|</a>|g;
$toc =~ s/ NAME=\"tex2html\d+\"\s*href=/ href=/gi;
- $toc =~ s|</UL>(\s*<BR>)?|</ul>|gi;
+ $toc =~ s|</UL>(\s*<BR( /)?>)?|</ul>|gi;
return $toc;
}
@@ -227,13 +229,13 @@ sub get_version_text() {
sub top_navigation_panel() {
return "\n"
. make_nav_panel()
- . "<br><hr>\n";
+ . "<br /><hr />\n";
}
sub bot_navigation_panel() {
- return "\n<p><hr>\n"
+ return "\n<p></p><hr />\n"
. make_nav_panel()
- . "<hr>\n"
+ . "<hr />\n"
. get_version_text()
. "\n";
}
@@ -409,8 +411,8 @@ sub do_cmd_tableofcontents {
my($closures, $reopens) = preserve_open_tags();
anchor_label('contents', $CURRENT_FILE, $_); # this is added
$MY_CONTENTS_PAGE = "$CURRENT_FILE";
- join('', "<BR>\n\\tableofchildlinks[off]", $closures
- , make_section_heading($toc_title, 'H2'), $toc_mark
+ join('', "<br />\n\\tableofchildlinks[off]", $closures
+ , make_section_heading($toc_title, 'h2'), $toc_mark
, $reopens, $_);
}
# In addition to the standard stuff, add label to allow named node files.
@@ -420,8 +422,8 @@ sub do_cmd_listoffigures {
$loffile = $CURRENT_FILE;
my($closures, $reopens) = preserve_open_tags();
anchor_label('lof', $CURRENT_FILE, $_); # this is added
- join('', "<BR>\n", $closures
- , make_section_heading($lof_title, 'H2'), $lof_mark
+ join('', "<br />\n", $closures
+ , make_section_heading($lof_title, 'h2'), $lof_mark
, $reopens, $_);
}
# In addition to the standard stuff, add label to allow named node files.
@@ -431,8 +433,8 @@ sub do_cmd_listoftables {
$lotfile = $CURRENT_FILE;
my($closures, $reopens) = preserve_open_tags();
anchor_label('lot', $CURRENT_FILE, $_); # this is added
- join('', "<BR>\n", $closures
- , make_section_heading($lot_title, 'H2'), $lot_mark
+ join('', "<br />\n", $closures
+ , make_section_heading($lot_title, 'h2'), $lot_mark
, $reopens, $_);
}
# In addition to the standard stuff, add label to allow named node files.
@@ -473,7 +475,7 @@ sub do_cmd_textohtmlindex {
my $heading = make_section_heading($idx_title, 'h2') . $idx_mark;
my($pre, $post) = minimize_open_tags($heading);
anchor_label('genindex',$CURRENT_FILE,$_); # this is added
- return "<br>\n" . $pre . $_;
+ return "<br />\n" . $pre . $_;
}
$MODULE_INDEX_FILE = '';
@@ -484,7 +486,7 @@ sub do_cmd_textohtmlmoduleindex {
$TITLE = $idx_module_title;
anchor_label('modindex', $CURRENT_FILE, $_);
$MODULE_INDEX_FILE = "$CURRENT_FILE";
- $_ = ('<p>' . make_section_heading($idx_module_title, 'h2')
+ $_ = ('<p></p>' . make_section_heading($idx_module_title, 'h2')
. $idx_module_mark . $_);
return $_;
}
@@ -624,7 +626,7 @@ sub make_head_and_body($$) {
$title = &purify($title,1);
eval("\$title = ". $default_title ) unless ($title);
- # allow user-modification of the <TITLE> tag; thanks Dan Young
+ # allow user-modification of the <title> tag; thanks Dan Young
if (defined &custom_TITLE_hook) {
$title = &custom_TITLE_hook($title, $toc_sec_title);
}
@@ -640,30 +642,31 @@ sub make_head_and_body($$) {
$MY_PARTIAL_HEADER = join('',
($DOCTYPE ? $DTDcomment : ''),
"<html>\n<head>",
- ($BASE ? "\n<base href=\"$BASE\">" : ''),
- "\n<link rel=\"STYLESHEET\" href=\"$STYLESHEET\" type='text/css'>",
+ ($BASE ? "\n<base href=\"$BASE\" />" : ''),
+ "\n<link rel=\"STYLESHEET\" href=\"$STYLESHEET\" type='text/css'",
+ " />",
($FAVORITES_ICON
- ? ("\n<link rel=\"SHORTCUT ICON\" href=\"" . "$FAVORITES_ICON\">")
+ ? ("\n<link rel=\"SHORTCUT ICON\" href=\"$FAVORITES_ICON\" />")
: ''),
($EXTERNAL_UP_LINK
? ("\n<link rel='start' href='" . $EXTERNAL_UP_LINK
. ($EXTERNAL_UP_TITLE ?
- "' title='$EXTERNAL_UP_TITLE'>" : "'>"))
+ "' title='$EXTERNAL_UP_TITLE' />" : "' />"))
: ''),
"\n<link rel=\"first\" href=\"$FILE.html\"",
($t_title ? " title='$t_title'" : ''),
- '>',
+ ' />',
($HAVE_TABLE_OF_CONTENTS
? ("\n<link rel='contents' href='$MY_CONTENTS_PAGE'"
- . ' title="Contents">')
+ . ' title="Contents" />')
: ''),
($HAVE_GENERAL_INDEX
- ? "\n<link rel='index' href='genindex.html' title='Index'>"
+ ? "\n<link rel='index' href='genindex.html' title='Index' />"
: ''),
# disable for now -- Mozilla doesn't do well with multiple indexes
# ($HAVE_MODULE_INDEX
- # ? '<link rel="index" href="modindex.html" title="Module Index">'
- # . "\n"
+ # ? '<link rel="index" href="modindex.html" title="Module Index"'
+ # . " />\n"
# : ''),
($INFO
# XXX We can do this with the Python tools since the About...
@@ -671,18 +674,18 @@ sub make_head_and_body($$) {
# generated node###.html page names. Won't work with the
# rest of the Python doc tools.
? ("\n<link rel='last' href='about.html'"
- . " title='About this document...'>"
+ . " title='About this document...' />"
. "\n<link rel='help' href='about.html'"
- . " title='About this document...'>")
+ . " title='About this document...' />")
: ''),
$more_links_mark,
"\n",
($CHARSET && $HTML_VERSION ge "2.1"
? ('<meta http-equiv="Content-Type" content="text/html; '
- . "charset=$CHARSET\">\n")
+ . "charset=$CHARSET\" />\n")
: ''),
($AESOP_META_TYPE
- ? "<meta name='aesop' content='$AESOP_META_TYPE'>\n" : ''));
+ ? "<meta name='aesop' content='$AESOP_META_TYPE' />\n" : ''));
}
if (!$charset && $CHARSET) {
$charset = $CHARSET;
@@ -692,11 +695,20 @@ sub make_head_and_body($$) {
# <meta name='description' ...> element in the document head.
my $metatitle = "$title";
$metatitle =~ s/^\d+(\.\d+)*\s*//;
+ $metatitle = meta_information($metatitle);
+ $metatitle =~ s/ NAME=/ name=/g;
+ $metatitle =~ s/ CONTENT=/ content=/g;
join('',
$MY_PARTIAL_HEADER,
- &meta_information($metatitle),
+ $metatitle,
"<title>", $title, "</title>\n</head>\n<body$body>");
}
+sub replace_morelinks {
+ $more_links =~ s/ REL=/ rel=/g;
+ $more_links =~ s/ HREF=/ href=/g;
+ $_ =~ s/$more_links_mark/$more_links/e;
+}
+
1; # This must be the last line
diff --git a/Doc/perl/python.perl b/Doc/perl/python.perl
index 7d50e49..1f380cb 100644
--- a/Doc/perl/python.perl
+++ b/Doc/perl/python.perl
@@ -51,7 +51,7 @@ sub get_link_icon($){
? " width=\"$OFF_SITE_LINK_ICON_WIDTH\""
: '')
. " alt=\"[off-site link]\"\n"
- . " >");
+ . " />");
}
return '';
}
@@ -345,8 +345,8 @@ sub do_cmd_pep{
# Save the reference
my $nstr = gen_index_id("Python Enhancement Proposals!PEP $rfcnumber", '');
$index{$nstr} .= make_half_href("$CURRENT_FILE#$id");
- return ("<a class=\"rfc\" name=\"$id\"\nhref=\"$href\">PEP $rfcnumber"
- . "$icon</a>" . $_);
+ return ("<a class=\"rfc\" name=\"$id\" id='$id'\n"
+ . "href=\"$href\">PEP $rfcnumber$icon</a>" . $_);
}
sub do_cmd_rfc{
@@ -358,8 +358,8 @@ sub do_cmd_rfc{
# Save the reference
my $nstr = gen_index_id("RFC!RFC $rfcnumber", '');
$index{$nstr} .= make_half_href("$CURRENT_FILE#$id");
- return ("<a class=\"rfc\" name=\"$id\"\nhref=\"$href\">RFC $rfcnumber"
- . "$icon</a>" . $_);
+ return ("<a class=\"rfc\" name=\"$id\" id='$id'\nhref=\"$href\">"
+ . "RFC $rfcnumber$icon</a>" . $_);
}
sub do_cmd_ulink{
@@ -394,7 +394,7 @@ sub do_cmd_deprecated{
my $reason = next_argument();
return ('<div class="versionnote">'
. "<b>Deprecated since release $release.</b>"
- . "\n$reason</div><p>"
+ . "\n$reason</div><p></p>"
. $_);
}
@@ -512,7 +512,7 @@ sub add_index_entry($$){
sub new_link_info(){
my $name = "l2h-" . ++$globals{'max_id'};
- my $aname = "<a name=\"$name\">";
+ my $aname = "<a name=\"$name\" id='$name'>";
my $ahref = gen_link($CURRENT_FILE, $name);
return ($name, $aname, $ahref);
}
@@ -810,7 +810,8 @@ sub do_cmd_production{
}
$TokenToTargetMapping{"$CURRENT_GRAMMAR:$token"} = $target;
return ("<tr valign=\"baseline\">\n"
- . " <td><code><a name=\"tok-$token\">$token</a></code></td>\n"
+ . " <td><code><a name=\"tok-$token\" id='tok-$token'>"
+ . "$token</a></code></td>\n"
. " <td>&nbsp;::=&nbsp;</td>\n"
. " <td><code>"
. translate_commands($defn)
@@ -962,10 +963,10 @@ sub do_env_cfuncdesc{
. "\n <span class=\"value\">$rcinfo.</span>"
. "\n</div>");
}
- return "<dl><dt>$siginfo\n<dd>"
+ return "<dl><dt>$siginfo</dt>\n<dd>"
. $rcinfo
. $_
- . '</dl>';
+ . '</dd></dl>';
}
sub do_cmd_cmemberline{
@@ -976,7 +977,7 @@ sub do_cmd_cmemberline{
my $idx = make_str_index_entry("<tt class=\"cmember\">$name</tt>"
. " ($container member)");
$idx =~ s/ \(.*\)//;
- return "<dt>$type <b>$idx</b>\n<dd>"
+ return "<dt>$type <b>$idx</b></dt>\n<dd>"
. $_;
}
sub do_env_cmemberdesc{
@@ -987,7 +988,7 @@ sub do_env_cmemberdesc{
my $idx = make_str_index_entry("<tt class=\"cmember\">$name</tt>"
. " ($container member)");
$idx =~ s/ \(.*\)//;
- return "<dl><dt>$type <b>$idx</b>\n<dd>"
+ return "<dl><dt>$type <b>$idx</b></dt>\n<dd>"
. $_
. '</dl>';
}
@@ -996,7 +997,7 @@ sub do_env_csimplemacrodesc{
local($_) = @_;
my $name = next_argument();
my $idx = make_str_index_entry("<tt class=\"macro\">$name</tt>");
- return "<dl><dt><b>$idx</b>\n<dd>"
+ return "<dl><dt><b>$idx</b></dt>\n<dd>"
. $_
. '</dl>'
}
@@ -1009,7 +1010,8 @@ sub do_env_ctypedesc{
unless $index_name;
my($name, $aname, $ahref) = new_link_info();
add_index_entry("<tt class=\"ctype\">$index_name</tt> (C type)", $ahref);
- return "<dl><dt><b><tt class=\"ctype\">$aname$type_name</a></tt></b>\n<dd>"
+ return "<dl><dt><b><tt class=\"ctype\">$aname$type_name</a></tt></b></dt>"
+ . "\n<dd>"
. $_
. '</dl>'
}
@@ -1021,10 +1023,10 @@ sub do_env_cvardesc{
my $idx = make_str_index_entry("<tt class=\"cdata\">$var_name</tt>"
. get_indexsubitem());
$idx =~ s/ \(.*\)//;
- return "<dl><dt>$var_type <b>$idx</b>\n"
+ return "<dl><dt>$var_type <b>$idx</b></dt>\n"
. '<dd>'
. $_
- . '</dl>';
+ . '</dd></dl>';
}
sub convert_args($){
@@ -1038,7 +1040,7 @@ sub funcline_helper($$$){
return (($first ? '<dl>' : '')
. '<dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">'
. "\n <td><nobr><b>$idxitem</b>(</nobr></td>"
- . "\n <td><var>$arglist</var>)</td></tr></table>\n<dd>");
+ . "\n <td><var>$arglist</var>)</td></tr></table></dt>\n<dd>");
}
sub do_env_funcdesc{
@@ -1104,7 +1106,7 @@ sub do_env_opcodedesc{
if ($arg_list) {
$stuff .= "&nbsp;&nbsp;&nbsp;&nbsp;<var>$arg_list</var>";
}
- return $stuff . "\n<dd>" . $_ . '</dl>';
+ return $stuff . "</dt>\n<dd>" . $_ . '</dt></dl>';
}
sub do_env_datadesc{
@@ -1112,9 +1114,9 @@ sub do_env_datadesc{
my $dataname = next_argument();
my $idx = make_str_index_entry("<tt>$dataname</tt>" . get_indexsubitem());
$idx =~ s/ \(.*\)//;
- return "<dl><dt><b>$idx</b>\n<dd>"
+ return "<dl><dt><b>$idx</b></dt>\n<dd>"
. $_
- . '</dl>';
+ . '</dd></dl>';
}
sub do_env_datadescni{
@@ -1123,7 +1125,7 @@ sub do_env_datadescni{
if (! $STRING_INDEX_TT) {
$idx = "<tt>$idx</tt>";
}
- return "<dl><dt><b>$idx</b>\n<dd>" . $_ . '</dl>';
+ return "<dl><dt><b>$idx</b></dt>\n<dd>" . $_ . '</dd></dl>';
}
sub do_cmd_dataline{
@@ -1131,23 +1133,23 @@ sub do_cmd_dataline{
my $data_name = next_argument();
my $idx = make_str_index_entry("<tt>$data_name</tt>" . get_indexsubitem());
$idx =~ s/ \(.*\)//;
- return "<dt><b>$idx</b><dd>" . $_;
+ return "<dt><b>$idx</b></dt><dd>" . $_;
}
sub do_cmd_datalineni{
local($_) = @_;
my $data_name = next_argument();
- return "<dt><b><tt>$data_name</tt></b><dd>" . $_;
+ return "<dt><b><tt>$data_name</tt></b></dt><dd>" . $_;
}
sub do_env_excdesc{
local($_) = @_;
my $excname = next_argument();
my $idx = make_str_index_entry("<tt class=\"exception\">$excname</tt>");
- return ("<dl><dt><b>${TLSTART}exception$TLEND$idx</b>"
+ return ("<dl><dt><b>${TLSTART}exception$TLEND$idx</b></dt>"
. "\n<dd>"
. $_
- . '</dl>');
+ . '</dd></dl>');
}
sub do_env_fulllineitems{ return do_env_itemize(@_); }
@@ -1251,7 +1253,7 @@ sub do_env_memberdesc{
my $idx = make_str_index_entry("<tt class=\"member\">$member</tt>$extra");
$idx =~ s/ \(.*\)//;
$idx =~ s/\(\)//;
- return "<dl><dt><b>$idx</b>\n<dd>" . $_ . '</dl>';
+ return "<dl><dt><b>$idx</b></dt>\n<dd>" . $_ . '</dl>';
}
@@ -1267,7 +1269,7 @@ sub do_cmd_memberline{
my $idx = make_str_index_entry("<tt class=\"member\">$member</tt>$extra");
$idx =~ s/ \(.*\)//;
$idx =~ s/\(\)//;
- return "<dt><b>$idx</b><dd>" . $_;
+ return "<dt><b>$idx</b></dt><dd>" . $_;
}
@@ -1275,9 +1277,9 @@ sub do_env_memberdescni{
local($_) = @_;
next_optional_argument();
my $member = next_argument();
- return "<dl><dt><b><tt class=\"member\">$member</tt></b>\n<dd>"
+ return "<dl><dt><b><tt class=\"member\">$member</tt></b></dt>\n<dd>"
. $_
- . '</dl>';
+ . '</dd></dl>';
}
@@ -1285,7 +1287,7 @@ sub do_cmd_memberlineni{
local($_) = @_;
next_optional_argument();
my $member = next_argument();
- return "<dt><b><tt class=\"member\">$member</tt></b><dd>" . $_;
+ return "<dt><b><tt class=\"member\">$member</tt></b></dt>\n<dd>" . $_;
}
@@ -1635,7 +1637,7 @@ sub make_my_titlepage(){
$the_title .= "\n<p>";
if ($PACKAGE_VERSION) {
$the_title .= ('<strong>Release '
- . "$PACKAGE_VERSION$RELEASE_INFO</strong><br>\n");
+ . "$PACKAGE_VERSION$RELEASE_INFO</strong><br />\n");
}
$the_title .= "<strong>$t_date</strong></p>"
}
@@ -1643,7 +1645,7 @@ sub make_my_titlepage(){
$the_title .= "\n<p>$t_address</p>";
}
else {
- $the_title .= "\n<p>";
+ $the_title .= "\n<p></p>";
}
if ($t_email) {
$the_title .= "\n<p>$t_email</p>";
@@ -1661,7 +1663,7 @@ sub make_my_titlegraphic(){
if ($TITLE_PAGE_GRAPHIC_WIDTH);
$graphic .= " height=\"$TITLE_PAGE_GRAPHIC_HEIGHT\""
if ($TITLE_PAGE_GRAPHIC_HEIGHT);
- $graphic .= "\n src=\"$filename\"></td>\n";
+ $graphic .= "\n src=\"$filename\" /></td>\n";
return $graphic;
}
@@ -1669,14 +1671,14 @@ sub do_cmd_maketitle{
local($_) = @_;
my $the_title = "\n";
if ($EXTERNAL_UP_LINK) {
- # This generates a <LINK> element in the wrong place (the
+ # This generates a <link> element in the wrong place (the
# body), but I don't see any other way to get this generated
# at all. Browsers like Mozilla, that support navigation
# links, can make use of this.
$the_title .= ("<link rel='up' href='$EXTERNAL_UP_LINK'"
. ($EXTERNAL_UP_TITLE
? " title='$EXTERNAL_UP_TITLE'" : '')
- . ">\n");
+ . " />\n");
}
$the_title .= '<div class="titlepage">';
if ($TITLE_PAGE_GRAPHIC) {
@@ -1897,14 +1899,14 @@ sub do_cmd_seetitle{
my $icon = get_link_icon($url);
return '<dl compact class="seetitle">'
. "\n <dt><em class=\"citetitle\"><a href=\"$url\""
- . "\n >$title$icon</a></em>"
- . "\n <dd>$text\n </dl>"
+ . "\n >$title$icon</a></em></dt>"
+ . "\n <dd>$text</dd>\n </dl>"
. $_;
}
return '<dl compact class="seetitle">'
. "\n <dt><em class=\"citetitle\""
- . "\n >$title</em>"
- . "\n <dd>$text\n </dl>"
+ . "\n >$title</em></dt>"
+ . "\n <dd>$text</dd>\n </dl>"
. $_;
}
@@ -1915,15 +1917,15 @@ sub do_cmd_seeurl{
my $icon = get_link_icon($url);
return '<dl compact class="seeurl">'
. "\n <dt><a href=\"$url\""
- . "\n class=\"url\">$url$icon</a>"
- . "\n <dd>$text\n </dl>"
+ . "\n class=\"url\">$url$icon</a></dt>"
+ . "\n <dd>$text</dd>\n </dl>"
. $_;
}
sub do_cmd_seetext{
local($_) = @_;
my $content = next_argument();
- return '<div class="seetext"><p>' . $content . '</div>' . $_;
+ return '<div class="seetext"><p>' . $content . '</p></div>' . $_;
}
@@ -1932,7 +1934,7 @@ sub do_cmd_seetext{
#
sub do_env_definitions{
- return "<dl class=\"definitions\">" . $_[0] . "</dl>\n";
+ return '<dl class="definitions">' . $_[0] . "</dl>\n";
}
sub do_cmd_term{
@@ -1940,7 +1942,7 @@ sub do_cmd_term{
my $term = next_argument();
my($name, $aname, $ahref) = new_link_info();
# could easily add an index entry here...
- return "<dt><b>$aname" . $term . "</a></b>\n<dd>" . $_;
+ return "<dt><b>$aname" . $term . "</a></b></dt>\n<dd>" . $_;
}