From f1927a6d802c33abd971ac1eec8ac764e435af44 Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Wed, 20 Jun 2001 21:29:30 +0000 Subject: Added support for new \setreleaseinfo macro. Normalize all generated HTML so that attribute names come out as name="value" instead of name='value'. Changed the target of RFC links to point to the hypertext RFCs at www.faqs.org instead of the plain text RFCs at www.ietf.org. --- Doc/perl/python.perl | 141 +++++++++++++++++++++++++++------------------------ 1 file changed, 76 insertions(+), 65 deletions(-) diff --git a/Doc/perl/python.perl b/Doc/perl/python.perl index e5cfa677..4431ec7 100644 --- a/Doc/perl/python.perl +++ b/Doc/perl/python.perl @@ -41,15 +41,15 @@ sub get_link_icon($){ if ($OFF_SITE_LINK_ICON && ($url =~ /^[-a-zA-Z0-9.]+:/)) { # absolute URL; assume it points off-site my $icon = make_icon_filename($OFF_SITE_LINK_ICON); - return (" [off-site link]"); } return ''; @@ -104,6 +104,7 @@ sub do_cmd_e{ '\' . @_[0]; } $DEVELOPER_ADDRESS = ''; $SHORT_VERSION = ''; +$RELEASE_INFO = ''; $PACKAGE_VERSION = ''; sub do_cmd_version{ $PACKAGE_VERSION . @_[0]; } @@ -114,6 +115,12 @@ sub do_cmd_release{ return $_; } +sub do_cmd_setreleaseinfo{ + local($_) = @_; + $RELEASE_INFO = next_argument(); + return $_; +} + sub do_cmd_setshortversion{ local($_) = @_; $SHORT_VERSION = next_argument(); @@ -236,7 +243,7 @@ sub do_cmd_refmodule{ my $module = next_argument(); $key = $module unless $key; - return "$module" + return "$module" . $_; } @@ -244,8 +251,8 @@ sub do_cmd_newsgroup{ local($_) = @_; my $newsgroup = next_argument(); my $icon = get_link_icon("news:$newsgroup"); - my $stuff = "" - . "$newsgroup$icon"; + my $stuff = ("" + . "$newsgroup$icon"); return $stuff . $_; } @@ -276,18 +283,16 @@ sub do_cmd_manpage{ local($_) = @_; my $page = next_argument(); my $section = next_argument(); - return "$page($section)" . $_; + return "$page($section)" . $_; } -$PEP_FORMAT = "http://python.sourceforge.net/peps/pep-XXXX.html"; -$RFC_FORMAT = "http://www.ietf.org/rfc/rfcXXXX.txt"; +$PEP_FORMAT = "http://python.sourceforge.net/peps/pep-%04d.html"; +#$RFC_FORMAT = "http://www.ietf.org/rfc/rfc%04d.txt"; +$RFC_FORMAT = "http://www.faqs.org/rfcs/rfc%d.html"; sub get_rfc_url($$){ my($rfcnum, $format) = @_; - $rfcnum = sprintf("%04d", $rfcnum); - $format = "$format"; - $format =~ s/XXXX/$rfcnum/; - return $format; + return sprintf($format, $rfcnum); } sub do_cmd_pep{ @@ -323,13 +328,13 @@ sub do_cmd_citetitle{ my $icon = get_link_icon($url); my $repl = ''; if ($url) { - $repl = ("$title$icon"); } else { - $repl = "$title"; + $repl = "$title"; } return $repl . $_; } @@ -355,7 +360,7 @@ sub versionnote{ if ($explanation) { $text = "$type in version $release:\n$explanation."; } - return "\n$text\n" . $_; + return "\n$text\n" . $_; } sub do_cmd_versionadded{ @@ -372,11 +377,11 @@ sub do_cmd_versionchanged{ sub do_cmd_platform{ local($_) = @_; my $platform = next_argument(); - $ModulePlatforms{"$THIS_MODULE"} = $platform; + $ModulePlatforms{"$THIS_MODULE"} = $platform; $platform = "Macintosh" if $platform eq 'Mac'; - return "\n

Availability: $platform.

\n" . $_; + return "\n

Availability: $platform.

\n" . $_; } $IGNORE_PLATFORM_ANNOTATION = ''; @@ -445,7 +450,7 @@ sub write_idxfile{ sub gen_link{ my($node,$target) = @_; print INTLABELS "\$internal_labels{\"$target\"} = \"$URL/$node\";\n"; - return ""; + return ""; } sub add_index_entry{ @@ -458,7 +463,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); } @@ -578,7 +583,7 @@ sub idx_cmd_obindex{ my_typed_index_helper('object', @_[0]); } define_indexing_macro('bifuncindex'); sub idx_cmd_bifuncindex{ my $str = next_argument(); - add_index_entry("$str() (built-in function)", + add_index_entry("$str() (built-in function)", @_[0]); } @@ -620,7 +625,7 @@ sub define_module{ $INDEX_SUBITEM = "(in module $name)"; print "[$name]"; return make_mod_index_entry( - "$name (${word}module)", 'DEF'); + "$name (${word}module)", 'DEF'); } sub my_module_index_helper{ @@ -638,7 +643,7 @@ sub ref_module_index_helper{ my($word, $ahref) = @_; my $str = next_argument(); $word = "$word " if $word; - $str = "$str (${word}module)"; + $str = "$str (${word}module)"; # can't use add_index_entry() since the 2nd arg to gen_index_id() is used; # just inline it all here $str = gen_index_id($str, 'REF'); @@ -712,7 +717,7 @@ sub do_env_cfuncdesc{ my $function_name = next_argument(); my $arg_list = next_argument(); my $idx = make_str_index_entry( - "$function_name()" . get_indexsubitem()); + "$function_name()" . get_indexsubitem()); $idx =~ s/ \(.*\)//; $idx =~ s/\(\)//; # ???? - why both of these? my $result_rc = get_refcount($function_name, ''); @@ -741,7 +746,7 @@ sub do_env_cfuncdesc{ sub do_env_csimplemacrodesc{ local($_) = @_; my $name = next_argument(); - my $idx = make_str_index_entry("$name"); + my $idx = make_str_index_entry("$name"); return "
$idx\n
" . $_ . '
' @@ -754,8 +759,8 @@ sub do_env_ctypedesc{ $index_name = $type_name unless $index_name; my($name,$aname,$ahref) = new_link_info(); - add_index_entry("$index_name (C type)", $ahref); - return "
$aname$type_name\n
" + add_index_entry("$index_name (C type)", $ahref); + return "
$aname$type_name\n
" . $_ . '
' } @@ -764,7 +769,7 @@ sub do_env_cvardesc{ local($_) = @_; my $var_type = next_argument(); my $var_name = next_argument(); - my $idx = make_str_index_entry("$var_name" + my $idx = make_str_index_entry("$var_name" . get_indexsubitem()); $idx =~ s/ \(.*\)//; return "
$var_type $idx\n" @@ -783,7 +788,8 @@ sub do_env_funcdesc{ local($_) = @_; my $function_name = next_argument(); my $arg_list = convert_args(next_argument()); - my $idx = make_str_index_entry("$function_name()" + my $idx = make_str_index_entry("$function_name()" + . '' . get_indexsubitem()); $idx =~ s/ \(.*\)//; $idx =~ s/\(\)<\/tt>/<\/tt>/; @@ -794,7 +800,7 @@ sub do_env_funcdescni{ local($_) = @_; my $function_name = next_argument(); my $arg_list = convert_args(next_argument()); - return "
$function_name" + return "
$function_name" . "($arg_list)\n" . '
' . $_ @@ -805,7 +811,7 @@ sub do_cmd_funcline{ local($_) = @_; my $function_name = next_argument(); my $arg_list = convert_args(next_argument()); - my $prefix = "$function_name()"; + my $prefix = "$function_name()"; my $idx = make_str_index_entry($prefix . get_indexsubitem()); $prefix =~ s/\(\)//; @@ -816,7 +822,7 @@ sub do_cmd_funclineni{ local($_) = @_; my $function_name = next_argument(); my $arg_list = convert_args(next_argument()); - my $prefix = "$function_name"; + my $prefix = "$function_name"; return "
$prefix($arg_list)\n
" . $_; } @@ -833,12 +839,12 @@ sub do_env_opcodedesc{ my $arg_list = next_argument(); my $idx; if ($INDEX_OPCODES) { - $idx = make_str_index_entry("$opcode_name" - . " (byte code instruction)"); + $idx = make_str_index_entry("$opcode_name" + . ' (byte code instruction)'); $idx =~ s/ \(byte code instruction\)//; } else { - $idx = "$opcode_name"; + $idx = "$opcode_name"; } my $stuff = "
$idx"; if ($arg_list) { @@ -883,7 +889,7 @@ sub do_cmd_datalineni{ sub do_env_excdesc{ local($_) = @_; my $excname = next_argument(); - my $idx = make_str_index_entry("$excname"); + my $idx = make_str_index_entry("$excname"); return "
exception $idx\n
" . $_ . '
' } @@ -895,7 +901,7 @@ sub handle_classlike_descriptor{ $THIS_CLASS = next_argument(); my $arg_list = convert_args(next_argument()); $idx = make_str_index_entry( - "$THIS_CLASS ($what in $THIS_MODULE)" ); + "$THIS_CLASS ($what in $THIS_MODULE)" ); $idx =~ s/ \(.*\)//; return ("
$what $idx($arg_list)\n
" . $_ @@ -910,7 +916,7 @@ sub do_env_classdescstar{ local($_) = @_; $THIS_CLASS = next_argument(); $idx = make_str_index_entry( - "$THIS_CLASS (class in $THIS_MODULE)" ); + "$THIS_CLASS (class in $THIS_MODULE)"); $idx =~ s/ \(.*\)//; return ("
class $idx\n
" . $_ @@ -933,7 +939,8 @@ sub do_env_methoddesc{ if ($class_name) { $extra = " ($class_name method)"; } - my $idx = make_str_index_entry("$method()$extra"); + my $idx = make_str_index_entry( + "$method()$extra"); $idx =~ s/ \(.*\)//; $idx =~ s/\(\)//; return "
$idx($arg_list)\n
" . $_ . '
'; @@ -951,7 +958,8 @@ sub do_cmd_methodline{ if ($class_name) { $extra = " ($class_name method)"; } - my $idx = make_str_index_entry("$method()$extra"); + my $idx = make_str_index_entry( + "$method()$extra"); $idx =~ s/ \(.*\)//; $idx =~ s/\(\)//; return "
$idx($arg_list)\n
" @@ -988,7 +996,7 @@ sub do_env_memberdesc{ my $extra = ''; $extra = " ($class attribute)" if ($class ne ''); - my $idx = make_str_index_entry("$member$extra"); + my $idx = make_str_index_entry("$member$extra"); $idx =~ s/ \(.*\)//; $idx =~ s/\(\)//; return "
$idx\n
" . $_ . '
'; @@ -1004,7 +1012,7 @@ sub do_cmd_memberline{ my $extra = ''; $extra = " ($class attribute)" if ($class ne ''); - my $idx = make_str_index_entry("$member$extra"); + my $idx = make_str_index_entry("$member$extra"); $idx =~ s/ \(.*\)//; $idx =~ s/\(\)//; return "
$idx
" . $_; @@ -1014,7 +1022,7 @@ sub do_env_memberdescni{ local($_) = @_; next_optional_argument(); my $member = next_argument(); - return "
$member\n
" + return "
$member\n
" . $_ . '
'; } @@ -1024,7 +1032,7 @@ sub do_cmd_memberlineni{ local($_) = @_; next_optional_argument(); my $member = next_argument(); - return "
$member
" . $_; + return "
$member
" . $_; } @col_aligns = ('', '', '', ''); @@ -1119,7 +1127,7 @@ sub do_env_tableii{ . "\n $th2$h2\ " . "\n " . "\n " - . "\n " + . "\n " . $_ . "\n " . "\n"; @@ -1168,7 +1176,7 @@ sub do_env_tableiii{ . "\n $th3$h3\ " . "\n " . "\n " - . "\n " + . "\n " . $_ . "\n " . "\n"; @@ -1222,7 +1230,7 @@ sub do_env_tableiv{ . "\n $th4$h4\ " . "\n " . "\n " - . "\n " + . "\n " . $_ . "\n " . "\n"; @@ -1285,11 +1293,13 @@ sub make_my_titlepage() { if ($t_authorURL) { my $href = translate_commands($t_authorURL); $href = make_named_href('author', $href, - "$t_author"); + "$t_author" + . ''); $the_title .= "\n

$href

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

$t_author

"); + $the_title .= ("\n

$t_author" + . '

'); } } else { @@ -1307,7 +1317,8 @@ sub make_my_titlepage() { if ($t_date) { $the_title .= "\n

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

" } @@ -1484,10 +1495,10 @@ sub process_python_state{ # sub do_env_seealso{ - return "
\n " - . "

See Also:

\n" - . @_[0] - . '
'; + return ("
\n " + . "

See Also:

\n" + . @_[0] + . '
'); } sub do_cmd_seemodule{ @@ -1503,11 +1514,11 @@ sub do_cmd_seemodule{ if ($text =~ /\.$/) { $period = ''; } - return '
' - . "\n
Module " - . "$module:" - . "\n
$text$period\n
" - . $_; + return ('
' + . "\n
Module " + . "$module:" + . "\n
$text$period\n
" + . $_); } sub strip_html_markup($){ @@ -1586,7 +1597,7 @@ sub do_cmd_seetext{ # sub do_env_definitions{ - return "
" . @_[0] . "
\n"; + return "
" . @_[0] . "
\n"; } sub do_cmd_term{ -- cgit v0.12