From 3cdb89d5ec0f923375a7fcf8622da72d2910e98a Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Thu, 14 Sep 2000 20:17:23 +0000 Subject: 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 ... is not generated. This closes SourceForge bug #113800. --- Doc/perl/python.perl | 43 ++++++++++++++++++++++++++++++++----------- 1 file 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{ 'NULL' . @_[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], '', ''); } +$IN_DESC_HANDLER = 0; sub do_cmd_optional{ - return use_wrappers(@_[0], "\[", - "\]"); + if ($IN_DESC_HANDLER) { + return use_wrappers(@_[0], "\[", + "\]"); + } + else { + return use_wrappers(@_[0], "\[", "\]"); + } } # Logical formatting (some based on texinfo), needs to be converted to @@ -720,12 +734,19 @@ sub do_env_cvardesc{ . ''; } +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("$function_name()" . get_indexsubitem()); + print "\n--- funcdesc arg_list:\n$arg_list\n==="; $idx =~ s/ \(.*\)//; $idx =~ s/\(\)<\/tt>/<\/tt>/; return "
$idx ($arg_list)\n
" . $_ . '
'; @@ -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 "
$function_name" . " ($arg_list)\n" . '
' @@ -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 = "$function_name()"; 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 = "$function_name"; return "
$prefix ($arg_list)\n
" . $_; @@ -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( "$THIS_CLASS ($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 "
$method ($arg_list)\n
" . $_; } @@ -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 "
$method ($arg_list)\n
" . $_ . '
'; -- cgit v0.12