diff options
author | Fred Drake <fdrake@acm.org> | 2000-09-14 20:17:23 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2000-09-14 20:17:23 (GMT) |
commit | 3cdb89d5ec0f923375a7fcf8622da72d2910e98a (patch) | |
tree | d35e4a133998edebab66ff6c709c2692d80cf3cc | |
parent | af2b71466a0054fd5d587aa3787d655239e91c20 (diff) | |
download | cpython-3cdb89d5ec0f923375a7fcf8622da72d2910e98a.zip cpython-3cdb89d5ec0f923375a7fcf8622da72d2910e98a.tar.gz cpython-3cdb89d5ec0f923375a7fcf8622da72d2910e98a.tar.bz2 |
do_cmd_shortversion(),
do_cmd_setshortversion(): Implementation for new markup.
convert_args(): New helper function.
do_cmd_optional(): Modified to understand when it is called from within
a convert_args() invocation.
do_env_funcdesc(),
do_env_funcdescni(),
do_cmd_funcline(),
do_cmd_funclineni(),
handle_classlike_descriptor(),
do_env_methoddesc(),
do_end_methoddescni(),
do_cmd_methodline(),
do_cmd_methodlineni(): Modified to use helper convert_args().
The convert_args() helper and related changes fix the generation of HTML
for the \optional markup, so that bogus </var>...<var> is not generated.
This closes SourceForge bug #113800.
-rw-r--r-- | Doc/perl/python.perl | 43 |
1 files changed, 32 insertions, 11 deletions
diff --git a/Doc/perl/python.perl b/Doc/perl/python.perl index 58a4a88..e6555d7 100644 --- a/Doc/perl/python.perl +++ b/Doc/perl/python.perl @@ -71,15 +71,23 @@ sub do_cmd_NULL{ '<tt class="constant">NULL</tt>' . @_[0]; } sub do_cmd_e{ '\' . @_[0]; } $DEVELOPER_ADDRESS = ''; +$SHORT_VERSION = ''; $PYTHON_VERSION = ''; sub do_cmd_version{ $PYTHON_VERSION . @_[0]; } +sub do_cmd_shortversion{ $SHORT_VERSION . @_[0]; } sub do_cmd_release{ local($_) = @_; $PYTHON_VERSION = next_argument(); return $_; } +sub do_cmd_setshortversion{ + local($_) = @_; + $SHORT_VERSION = next_argument(); + return $_; +} + sub do_cmd_authoraddress{ local($_) = @_; $DEVELOPER_ADDRESS = next_argument(); @@ -109,9 +117,15 @@ sub use_italics{ return use_wrappers(@_[0], '<i>', '</i>'); } +$IN_DESC_HANDLER = 0; sub do_cmd_optional{ - return use_wrappers(@_[0], "</var><big>\[</big><var>", - "</var><big>\]</big><var>"); + if ($IN_DESC_HANDLER) { + return use_wrappers(@_[0], "</var><big>\[</big><var>", + "</var><big>\]</big><var>"); + } + else { + return use_wrappers(@_[0], "<big>\[</big>", "<big>\]</big>"); + } } # Logical formatting (some based on texinfo), needs to be converted to @@ -720,12 +734,19 @@ sub do_env_cvardesc{ . '</dl>'; } +sub convert_args($){ + local($IN_DESC_HANDLER) = 1; + local($_) = @_; + return translate_commands($_); +} + sub do_env_funcdesc{ local($_) = @_; my $function_name = next_argument(); - my $arg_list = next_argument(); + my $arg_list = convert_args(next_argument()); my $idx = make_str_index_entry("<tt class='function'>$function_name()</tt>" . get_indexsubitem()); + print "\n--- funcdesc arg_list:\n$arg_list\n==="; $idx =~ s/ \(.*\)//; $idx =~ s/\(\)<\/tt>/<\/tt>/; return "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $_ . '</dl>'; @@ -734,7 +755,7 @@ sub do_env_funcdesc{ sub do_env_funcdescni{ local($_) = @_; my $function_name = next_argument(); - my $arg_list = next_argument(); + my $arg_list = convert_args(next_argument()); return "<dl><dt><b><tt class='function'>$function_name</tt></b>" . " (<var>$arg_list</var>)\n" . '<dd>' @@ -745,7 +766,7 @@ sub do_env_funcdescni{ sub do_cmd_funcline{ local($_) = @_; my $function_name = next_argument(); - my $arg_list = next_argument(); + my $arg_list = convert_args(next_argument()); my $prefix = "<tt class='function'>$function_name()</tt>"; my $idx = make_str_index_entry($prefix . get_indexsubitem()); $prefix =~ s/\(\)//; @@ -756,7 +777,7 @@ sub do_cmd_funcline{ sub do_cmd_funclineni{ local($_) = @_; my $function_name = next_argument(); - my $arg_list = next_argument(); + my $arg_list = convert_args(next_argument()); my $prefix = "<tt class='function'>$function_name</tt>"; return "<dt><b>$prefix</b> (<var>$arg_list</var>)\n<dd>" . $_; @@ -834,7 +855,7 @@ sub do_env_fulllineitems{ return do_env_itemize(@_); } sub handle_classlike_descriptor{ local($_, $what) = @_; $THIS_CLASS = next_argument(); - my $arg_list = next_argument(); + my $arg_list = convert_args(next_argument()); $idx = make_str_index_entry( "<tt class='$what'>$THIS_CLASS</tt> ($what in $THIS_MODULE)" ); $idx =~ s/ \(.*\)//; @@ -856,7 +877,7 @@ sub do_env_methoddesc{ $class_name = $THIS_CLASS unless $class_name; my $method = next_argument(); - my $arg_list = next_argument(); + my $arg_list = convert_args(next_argument()); my $extra = ''; if ($class_name) { $extra = " ($class_name method)"; @@ -874,7 +895,7 @@ sub do_cmd_methodline{ $class_name = $THIS_CLASS unless $class_name; my $method = next_argument(); - my $arg_list = next_argument(); + my $arg_list = convert_args(next_argument()); my $extra = ''; if ($class_name) { $extra = " ($class_name method)"; @@ -891,7 +912,7 @@ sub do_cmd_methodlineni{ local($_) = @_; next_optional_argument(); my $method = next_argument(); - my $arg_list = next_argument(); + my $arg_list = convert_args(next_argument()); return "<dt><b>$method</b> (<var>$arg_list</var>)\n<dd>" . $_; } @@ -900,7 +921,7 @@ sub do_env_methoddescni{ local($_) = @_; next_optional_argument(); my $method = next_argument(); - my $arg_list = next_argument(); + my $arg_list = convert_args(next_argument()); return "<dl><dt><b>$method</b> (<var>$arg_list</var>)\n<dd>" . $_ . '</dl>'; |