From afc7ce118e0c1e8c6c423f31c3a5ee780ba8685b Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Mon, 22 Jan 2001 17:33:24 +0000 Subject: Fix \seepep handling -- correct URL to the online PEP repository on SF is now generated. (SF bug #129692.) Patch from Anthon van der Neut : Work around the removal of content-less paired tags used for name anchors in some places. (SF bug #116008.) Move some class attributes from an artificial SPAN element to otherwise "useful" elements that are being generated anyway. Added the class "versionnote", used for \deprecated, \versionadded, \versionchanged. --- Doc/perl/python.perl | 66 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 27 deletions(-) diff --git a/Doc/perl/python.perl b/Doc/perl/python.perl index ae06d76..289bb05 100644 --- a/Doc/perl/python.perl +++ b/Doc/perl/python.perl @@ -243,8 +243,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 . $_; } @@ -254,11 +254,11 @@ sub do_cmd_envvar{ my($name,$aname,$ahref) = new_link_info(); # The here is really to keep buildindex.py from making # the variable name case-insensitive. - add_index_entry("environment variables!$envvar@\$$envvar", + add_index_entry("environment variables!$envvar@$envvar", $ahref); - add_index_entry("$envvar@\$$envvar", $ahref); + add_index_entry("$envvar (environment variable)", $ahref); $aname =~ s/" . $_; + return "$aname$envvar" . $_; } sub do_cmd_url{ @@ -278,16 +278,22 @@ sub do_cmd_manpage{ return "$page($section)" . $_; } -sub get_pep_url{ - my $rfcnum = sprintf("%04d", @_[0]); - return "http://python.sourceforge.net/peps/pep-$rfcnum.html"; +$PEP_FORMAT = "http://python.sourceforge.net/peps/pep-XXXX.html"; +$RFC_FORMAT = "http://www.ietf.org/rfc/rfcXXXX.txt"; + +sub get_rfc_url($$){ + my($rfcnum, $format) = @_; + $rfcnum = sprintf("%04d", $rfcnum); + $format = "$format"; + $format =~ s/XXXX/$rfcnum/; + return $format; } sub do_cmd_pep{ local($_) = @_; my $rfcnumber = next_argument(); my $id = "rfcref-" . ++$global{'max_id'}; - my $href = get_pep_url($rfcnumber); + my $href = get_rfc_url($rfcnumber, $PEP_FORMAT); my $icon = get_link_icon($href); # Save the reference my $nstr = gen_index_id("Python Enhancement Proposals!PEP $rfcnumber", ''); @@ -296,16 +302,11 @@ sub do_cmd_pep{ . "$icon" . $_); } -sub get_rfc_url{ - my $rfcnum = sprintf("%04d", @_[0]); - return "http://www.ietf.org/rfc/rfc$rfcnum.txt"; -} - sub do_cmd_rfc{ local($_) = @_; my $rfcnumber = next_argument(); my $id = "rfcref-" . ++$global{'max_id'}; - my $href = get_rfc_url($rfcnumber); + my $href = get_rfc_url($rfcnumber, $RFC_FORMAT); my $icon = get_link_icon($href); # Save the reference my $nstr = gen_index_id("RFC!RFC $rfcnumber", ''); @@ -337,14 +338,18 @@ sub do_cmd_deprecated{ local($_) = @_; my $release = next_argument(); my $reason = next_argument(); - return "Deprecated since release $release.\n$reason

" . $_; + return ('

' + . "Deprecated since release $release." + . "\n$reason

" + . $_); } sub do_cmd_versionadded{ # one parameter: \versionadded{version} local($_) = @_; my $release = next_argument(); - return "\nNew in version $release.\n" . $_; + return ("\nNew in version $release.\n" + . $_); } sub do_cmd_versionchanged{ @@ -352,11 +357,11 @@ sub do_cmd_versionchanged{ local($_) = @_; my $explanation = next_optional_argument(); my $release = next_argument(); - my $text = "\nChanged in version $release.\n"; - if ($release) { - $text = "\nChanged in version $release:\n$explanation.\n"; + my $text = "Changed in version $release."; + if ($explanation) { + $text = "Changed in version $release:\n$explanation."; } - return $text . $_; + return "\n$text\n" . $_; } # @@ -499,6 +504,9 @@ sub process_index_macros{ &$cmd($ahref); } } + if (/^[ \t\r\n]/) { + $_ = substr($_, 1); + } return "$aname$anchor_invisible_mark" . $_; } @@ -589,7 +597,7 @@ sub make_mod_index_entry{ my $nstr = $1; $Modules{$nstr} .= $ahref; } - return "$aname$anchor_invisible_mark"; + return "$aname$anchor_invisible_mark2"; } @@ -647,7 +655,8 @@ sub idx_cmd_refstmodindex{ return ref_module_index_helper('standard', @_); } sub do_cmd_nodename{ return do_cmd_label(@_); } sub init_myformat{ - $anchor_invisible_mark = ''; + $anchor_invisible_mark = ' '; + $anchor_invisible_mark2 = ''; $anchor_mark = ''; $icons{'anchor_mark'} = ''; } @@ -1030,6 +1039,9 @@ sub fix_font{ elsif ($font eq 'programopt') { $font = 'b'; } + elsif ($font eq 'exception') { + $font = 'tt class="exception"'; + } return $font; } @@ -1484,11 +1496,11 @@ sub do_cmd_seemodule{ } sub handle_rfclike_reference{ - local($_, $what) = @_; + local($_, $what, $format) = @_; my $rfcnum = next_argument(); my $title = next_argument(); my $text = next_argument(); - my $url = get_rfc_url($rfcnum); + my $url = get_rfc_url($rfcnum, $format); my $icon = get_link_icon($url); return '

' . "\n