summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2003-12-30 16:19:28 (GMT)
committerFred Drake <fdrake@acm.org>2003-12-30 16:19:28 (GMT)
commit345555dddc5d1be2392af846f839825291369e40 (patch)
tree5fb843b3c6304acf7b657e35b47c374ad971ce33
parent4922cae1e14e025213aa708db383c4e46630b3ab (diff)
downloadcpython-345555dddc5d1be2392af846f839825291369e40.zip
cpython-345555dddc5d1be2392af846f839825291369e40.tar.gz
cpython-345555dddc5d1be2392af846f839825291369e40.tar.bz2
- make "--" in code text not get converted to "-"
- fix minor typo in comment
-rw-r--r--Doc/perl/python.perl28
1 files changed, 21 insertions, 7 deletions
diff --git a/Doc/perl/python.perl b/Doc/perl/python.perl
index 3c3f7be..f799721 100644
--- a/Doc/perl/python.perl
+++ b/Doc/perl/python.perl
@@ -155,12 +155,26 @@ sub do_cmd_hackscore{
return '_' . $_;
}
+# Helper used in many places that arbitrary code-like text appears:
+
+sub codetext($){
+ my $text = "$_[0]";
+ $text =~ s/--/-\&#45;/go;
+ return $text;
+}
+
sub use_wrappers($$$){
local($_,$before,$after) = @_;
my $stuff = next_argument();
return $before . $stuff . $after . $_;
}
+sub use_code_wrappers($$$){
+ local($_,$before,$after) = @_;
+ my $stuff = codetext(next_argument());
+ return $before . $stuff . $after . $_;
+}
+
$IN_DESC_HANDLER = 0;
sub do_cmd_optional{
if ($IN_DESC_HANDLER) {
@@ -181,7 +195,7 @@ sub do_cmd_pytype{ return $_[0]; }
sub do_cmd_makevar{
return use_wrappers($_[0], '<span class="makevar">', '</span>'); }
sub do_cmd_code{
- return use_wrappers($_[0], '<code>', '</code>'); }
+ return use_code_wrappers($_[0], '<code>', '</code>'); }
sub do_cmd_module{
return use_wrappers($_[0], '<tt class="module">', '</tt>'); }
sub do_cmd_keyword{
@@ -205,9 +219,9 @@ sub do_cmd_cdata{
sub do_cmd_ctype{
return use_wrappers($_[0], '<tt class="ctype">', '</tt>'); }
sub do_cmd_regexp{
- return use_wrappers($_[0], '<tt class="regexp">', '</tt>'); }
+ return use_code_wrappers($_[0], '<tt class="regexp">', '</tt>'); }
sub do_cmd_character{
- return use_wrappers($_[0], '"<tt class="character">', '</tt>"'); }
+ return use_code_wrappers($_[0], '"<tt class="character">', '</tt>"'); }
sub do_cmd_program{
return use_wrappers($_[0], '<b class="program">', '</b>'); }
sub do_cmd_programopt{
@@ -232,7 +246,7 @@ sub do_cmd_file{
sub do_cmd_filenq{
return do_cmd_file($_[0]); }
sub do_cmd_samp{
- return use_wrappers($_[0], '"<tt class="samp">', '</tt>"'); }
+ return use_code_wrappers($_[0], '"<tt class="samp">', '</tt>"'); }
sub do_cmd_kbd{
return use_wrappers($_[0], '<kbd>', '</kbd>'); }
sub do_cmd_strong{
@@ -617,7 +631,7 @@ sub idx_cmd_indexiv($){
define_indexing_macro('ttindex');
sub idx_cmd_ttindex($){
- my $str = next_argument();
+ my $str = codetext(next_argument());
my $entry = $str . get_indexsubitem();
add_index_entry($entry, $_[0]);
}
@@ -2049,10 +2063,10 @@ sub do_env_alltt{
undef $open_tags_R; undef @save_open_tags;
};
$open_tags_R = [ @keep_open_tags ];
- $_;
+ return codetext($_);
}
-# List of all filenames produced ny do_cmd_verbatiminput()
+# List of all filenames produced my do_cmd_verbatiminput()
%VerbatimFiles = ();
@VerbatimOutputs = ();