From 345555dddc5d1be2392af846f839825291369e40 Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Tue, 30 Dec 2003 16:19:28 +0000 Subject: [PATCH] - make "--" in code text not get converted to "-" - fix minor typo in comment --- Doc/perl/python.perl | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/Doc/perl/python.perl b/Doc/perl/python.perl index 3c3f7be09c..f79972150f 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/--/-\-/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], '', ''); } sub do_cmd_code{ - return use_wrappers($_[0], '', ''); } + return use_code_wrappers($_[0], '', ''); } sub do_cmd_module{ return use_wrappers($_[0], '', ''); } sub do_cmd_keyword{ @@ -205,9 +219,9 @@ sub do_cmd_cdata{ sub do_cmd_ctype{ return use_wrappers($_[0], '', ''); } sub do_cmd_regexp{ - return use_wrappers($_[0], '', ''); } + return use_code_wrappers($_[0], '', ''); } sub do_cmd_character{ - return use_wrappers($_[0], '"', '"'); } + return use_code_wrappers($_[0], '"', '"'); } sub do_cmd_program{ return use_wrappers($_[0], '', ''); } 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], '"', '"'); } + return use_code_wrappers($_[0], '"', '"'); } sub do_cmd_kbd{ return use_wrappers($_[0], '', ''); } 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 = (); -- 2.50.1