From 2fc88a62d46bbd1ae3fcb2cc4606cc955eee336f Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Tue, 5 Aug 2003 03:45:37 +0000 Subject: make the portions of the generated HTML produced by these styles better conform to XHTML rules. --- Doc/perl/l2hinit.perl | 70 ++++++++++++++++++++++----------------- Doc/perl/python.perl | 90 ++++++++++++++++++++++++++------------------------- 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


\n"; +$CHILDLINE = "\n


\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] /$title"; @@ -138,7 +139,7 @@ sub get_my_icon($) { } my $iconserver = ($ICONSERVER eq '.') ? '' : "$ICONSERVER/"; return "$text"; + . " height='32' alt='$text' width='32' />"; } sub unlinkify($) { @@ -157,6 +158,7 @@ sub use_icon($$$) { $s =~ s/\/$r/; } $s =~ s/<[aA] /||g; $toc =~ s/ NAME=\"tex2html\d+\"\s*href=/ href=/gi; - $toc =~ s|(\s*
)?||gi; + $toc =~ s|(\s*)?||gi; return $toc; } @@ -227,13 +229,13 @@ sub get_version_text() { sub top_navigation_panel() { return "\n" . make_nav_panel() - . "

\n"; + . "

\n"; } sub bot_navigation_panel() { - return "\n


\n" + return "\n


\n" . make_nav_panel() - . "
\n" + . "
\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('', "
\n\\tableofchildlinks[off]", $closures - , make_section_heading($toc_title, 'H2'), $toc_mark + join('', "
\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('', "
\n", $closures - , make_section_heading($lof_title, 'H2'), $lof_mark + join('', "
\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('', "
\n", $closures - , make_section_heading($lot_title, 'H2'), $lot_mark + join('', "
\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 "
\n" . $pre . $_; + return "
\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"; - $_ = ('

' . make_section_heading($idx_module_title, 'h2') + $_ = ('

' . 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 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, "\n\n"); } +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 ("PEP $rfcnumber" - . "$icon" . $_); + return ("PEP $rfcnumber$icon" . $_); } 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 ("RFC $rfcnumber" - . "$icon" . $_); + return ("" + . "RFC $rfcnumber$icon" . $_); } sub do_cmd_ulink{ @@ -394,7 +394,7 @@ sub do_cmd_deprecated{ my $reason = next_argument(); return ('
' . "Deprecated since release $release." - . "\n$reason

" + . "\n$reason

" . $_); } @@ -512,7 +512,7 @@ sub add_index_entry($$){ sub new_link_info(){ my $name = "l2h-" . ++$globals{'max_id'}; - my $aname = ""; + my $aname = ""; 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 ("\n" - . " $token\n" + . " " + . "$token\n" . "  ::= \n" . " " . translate_commands($defn) @@ -962,10 +963,10 @@ sub do_env_cfuncdesc{ . "\n $rcinfo." . "\n"); } - return "
$siginfo\n
" + return "
$siginfo
\n
" . $rcinfo . $_ - . '
'; + . '
'; } sub do_cmd_cmemberline{ @@ -976,7 +977,7 @@ sub do_cmd_cmemberline{ my $idx = make_str_index_entry("$name" . " ($container member)"); $idx =~ s/ \(.*\)//; - return "
$type $idx\n
" + return "
$type $idx
\n
" . $_; } sub do_env_cmemberdesc{ @@ -987,7 +988,7 @@ sub do_env_cmemberdesc{ my $idx = make_str_index_entry("$name" . " ($container member)"); $idx =~ s/ \(.*\)//; - return "
$type $idx\n
" + return "
$type $idx
\n
" . $_ . '
'; } @@ -996,7 +997,7 @@ sub do_env_csimplemacrodesc{ local($_) = @_; my $name = next_argument(); my $idx = make_str_index_entry("$name"); - return "
$idx\n
" + return "
$idx
\n
" . $_ . '
' } @@ -1009,7 +1010,8 @@ sub do_env_ctypedesc{ unless $index_name; my($name, $aname, $ahref) = new_link_info(); add_index_entry("$index_name (C type)", $ahref); - return "
$aname$type_name\n
" + return "
$aname$type_name
" + . "\n
" . $_ . '
' } @@ -1021,10 +1023,10 @@ sub do_env_cvardesc{ my $idx = make_str_index_entry("$var_name" . get_indexsubitem()); $idx =~ s/ \(.*\)//; - return "
$var_type $idx\n" + return "
$var_type $idx
\n" . '
' . $_ - . '
'; + . '
'; } sub convert_args($){ @@ -1038,7 +1040,7 @@ sub funcline_helper($$$){ return (($first ? '
' : '') . '
' . "\n " - . "\n
$idxitem($arglist)
\n
"); + . "\n $arglist)\n
"); } sub do_env_funcdesc{ @@ -1104,7 +1106,7 @@ sub do_env_opcodedesc{ if ($arg_list) { $stuff .= "    $arg_list"; } - return $stuff . "\n
" . $_ . '
'; + return $stuff . "\n
" . $_ . '
'; } sub do_env_datadesc{ @@ -1112,9 +1114,9 @@ sub do_env_datadesc{ my $dataname = next_argument(); my $idx = make_str_index_entry("$dataname" . get_indexsubitem()); $idx =~ s/ \(.*\)//; - return "
$idx\n
" + return "
$idx
\n
" . $_ - . '
'; + . '
'; } sub do_env_datadescni{ @@ -1123,7 +1125,7 @@ sub do_env_datadescni{ if (! $STRING_INDEX_TT) { $idx = "$idx"; } - return "
$idx\n
" . $_ . '
'; + return "
$idx
\n
" . $_ . '
'; } sub do_cmd_dataline{ @@ -1131,23 +1133,23 @@ sub do_cmd_dataline{ my $data_name = next_argument(); my $idx = make_str_index_entry("$data_name" . get_indexsubitem()); $idx =~ s/ \(.*\)//; - return "
$idx
" . $_; + return "
$idx
" . $_; } sub do_cmd_datalineni{ local($_) = @_; my $data_name = next_argument(); - return "
$data_name
" . $_; + return "
$data_name
" . $_; } sub do_env_excdesc{ local($_) = @_; my $excname = next_argument(); my $idx = make_str_index_entry("$excname"); - return ("
${TLSTART}exception$TLEND$idx" + return ("
${TLSTART}exception$TLEND$idx
" . "\n
" . $_ - . '
'); + . '
'); } sub do_env_fulllineitems{ return do_env_itemize(@_); } @@ -1251,7 +1253,7 @@ sub do_env_memberdesc{ my $idx = make_str_index_entry("$member$extra"); $idx =~ s/ \(.*\)//; $idx =~ s/\(\)//; - return "
$idx\n
" . $_ . '
'; + return "
$idx
\n
" . $_ . '
'; } @@ -1267,7 +1269,7 @@ sub do_cmd_memberline{ my $idx = make_str_index_entry("$member$extra"); $idx =~ s/ \(.*\)//; $idx =~ s/\(\)//; - return "
$idx
" . $_; + return "
$idx
" . $_; } @@ -1275,9 +1277,9 @@ sub do_env_memberdescni{ local($_) = @_; next_optional_argument(); my $member = next_argument(); - return "
$member\n
" + return "
$member
\n
" . $_ - . '
'; + . '
'; } @@ -1285,7 +1287,7 @@ sub do_cmd_memberlineni{ local($_) = @_; next_optional_argument(); my $member = next_argument(); - return "
$member
" . $_; + return "
$member
\n
" . $_; } @@ -1635,7 +1637,7 @@ sub make_my_titlepage(){ $the_title .= "\n

"; if ($PACKAGE_VERSION) { $the_title .= ('Release ' - . "$PACKAGE_VERSION$RELEASE_INFO
\n"); + . "$PACKAGE_VERSION$RELEASE_INFO
\n"); } $the_title .= "$t_date

" } @@ -1643,7 +1645,7 @@ sub make_my_titlepage(){ $the_title .= "\n

$t_address

"; } else { - $the_title .= "\n

"; + $the_title .= "\n

"; } if ($t_email) { $the_title .= "\n

$t_email

"; @@ -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\">\n"; + $graphic .= "\n src=\"$filename\" />\n"; return $graphic; } @@ -1669,14 +1671,14 @@ sub do_cmd_maketitle{ local($_) = @_; my $the_title = "\n"; if ($EXTERNAL_UP_LINK) { - # This generates a element in the wrong place (the + # This generates a 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 .= ("\n"); + . " />\n"); } $the_title .= '
'; if ($TITLE_PAGE_GRAPHIC) { @@ -1897,14 +1899,14 @@ sub do_cmd_seetitle{ my $icon = get_link_icon($url); return '
' . "\n
$title$icon" - . "\n
$text\n
" + . "\n >$title$icon" + . "\n
$text
\n " . $_; } return '
' . "\n
$title" - . "\n
$text\n
" + . "\n >$title" + . "\n
$text
\n " . $_; } @@ -1915,15 +1917,15 @@ sub do_cmd_seeurl{ my $icon = get_link_icon($url); return '
' . "\n
$url$icon" - . "\n
$text\n
" + . "\n class=\"url\">$url$icon" + . "\n
$text
\n " . $_; } sub do_cmd_seetext{ local($_) = @_; my $content = next_argument(); - return '

' . $content . '

' . $_; + return '

' . $content . '

' . $_; } @@ -1932,7 +1934,7 @@ sub do_cmd_seetext{ # sub do_env_definitions{ - return "
" . $_[0] . "
\n"; + return '
' . $_[0] . "
\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 "
$aname" . $term . "\n
" . $_; + return "
$aname" . $term . "
\n
" . $_; } -- cgit v0.12