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.
This commit is contained in:
Fred Drake 2000-09-14 20:17:23 +00:00
parent af2b71466a
commit 3cdb89d5ec
1 changed files with 32 additions and 11 deletions

View File

@ -71,15 +71,23 @@ sub do_cmd_NULL{ '<tt class="constant">NULL</tt>' . @_[0]; }
sub do_cmd_e{ '&#92;' . @_[0]; } sub do_cmd_e{ '&#92;' . @_[0]; }
$DEVELOPER_ADDRESS = ''; $DEVELOPER_ADDRESS = '';
$SHORT_VERSION = '';
$PYTHON_VERSION = ''; $PYTHON_VERSION = '';
sub do_cmd_version{ $PYTHON_VERSION . @_[0]; } sub do_cmd_version{ $PYTHON_VERSION . @_[0]; }
sub do_cmd_shortversion{ $SHORT_VERSION . @_[0]; }
sub do_cmd_release{ sub do_cmd_release{
local($_) = @_; local($_) = @_;
$PYTHON_VERSION = next_argument(); $PYTHON_VERSION = next_argument();
return $_; return $_;
} }
sub do_cmd_setshortversion{
local($_) = @_;
$SHORT_VERSION = next_argument();
return $_;
}
sub do_cmd_authoraddress{ sub do_cmd_authoraddress{
local($_) = @_; local($_) = @_;
$DEVELOPER_ADDRESS = next_argument(); $DEVELOPER_ADDRESS = next_argument();
@ -109,9 +117,15 @@ sub use_italics{
return use_wrappers(@_[0], '<i>', '</i>'); return use_wrappers(@_[0], '<i>', '</i>');
} }
$IN_DESC_HANDLER = 0;
sub do_cmd_optional{ sub do_cmd_optional{
if ($IN_DESC_HANDLER) {
return use_wrappers(@_[0], "</var><big>\[</big><var>", return use_wrappers(@_[0], "</var><big>\[</big><var>",
"</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 # Logical formatting (some based on texinfo), needs to be converted to
@ -720,12 +734,19 @@ sub do_env_cvardesc{
. '</dl>'; . '</dl>';
} }
sub convert_args($){
local($IN_DESC_HANDLER) = 1;
local($_) = @_;
return translate_commands($_);
}
sub do_env_funcdesc{ sub do_env_funcdesc{
local($_) = @_; local($_) = @_;
my $function_name = next_argument(); 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>" my $idx = make_str_index_entry("<tt class='function'>$function_name()</tt>"
. get_indexsubitem()); . get_indexsubitem());
print "\n--- funcdesc arg_list:\n$arg_list\n===";
$idx =~ s/ \(.*\)//; $idx =~ s/ \(.*\)//;
$idx =~ s/\(\)<\/tt>/<\/tt>/; $idx =~ s/\(\)<\/tt>/<\/tt>/;
return "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $_ . '</dl>'; 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{ sub do_env_funcdescni{
local($_) = @_; local($_) = @_;
my $function_name = next_argument(); 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>" return "<dl><dt><b><tt class='function'>$function_name</tt></b>"
. " (<var>$arg_list</var>)\n" . " (<var>$arg_list</var>)\n"
. '<dd>' . '<dd>'
@ -745,7 +766,7 @@ sub do_env_funcdescni{
sub do_cmd_funcline{ sub do_cmd_funcline{
local($_) = @_; local($_) = @_;
my $function_name = next_argument(); 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 $prefix = "<tt class='function'>$function_name()</tt>";
my $idx = make_str_index_entry($prefix . get_indexsubitem()); my $idx = make_str_index_entry($prefix . get_indexsubitem());
$prefix =~ s/\(\)//; $prefix =~ s/\(\)//;
@ -756,7 +777,7 @@ sub do_cmd_funcline{
sub do_cmd_funclineni{ sub do_cmd_funclineni{
local($_) = @_; local($_) = @_;
my $function_name = next_argument(); 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 $prefix = "<tt class='function'>$function_name</tt>";
return "<dt><b>$prefix</b> (<var>$arg_list</var>)\n<dd>" . $_; 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{ sub handle_classlike_descriptor{
local($_, $what) = @_; local($_, $what) = @_;
$THIS_CLASS = next_argument(); $THIS_CLASS = next_argument();
my $arg_list = next_argument(); my $arg_list = convert_args(next_argument());
$idx = make_str_index_entry( $idx = make_str_index_entry(
"<tt class='$what'>$THIS_CLASS</tt> ($what in $THIS_MODULE)" ); "<tt class='$what'>$THIS_CLASS</tt> ($what in $THIS_MODULE)" );
$idx =~ s/ \(.*\)//; $idx =~ s/ \(.*\)//;
@ -856,7 +877,7 @@ sub do_env_methoddesc{
$class_name = $THIS_CLASS $class_name = $THIS_CLASS
unless $class_name; unless $class_name;
my $method = next_argument(); my $method = next_argument();
my $arg_list = next_argument(); my $arg_list = convert_args(next_argument());
my $extra = ''; my $extra = '';
if ($class_name) { if ($class_name) {
$extra = " ($class_name method)"; $extra = " ($class_name method)";
@ -874,7 +895,7 @@ sub do_cmd_methodline{
$class_name = $THIS_CLASS $class_name = $THIS_CLASS
unless $class_name; unless $class_name;
my $method = next_argument(); my $method = next_argument();
my $arg_list = next_argument(); my $arg_list = convert_args(next_argument());
my $extra = ''; my $extra = '';
if ($class_name) { if ($class_name) {
$extra = " ($class_name method)"; $extra = " ($class_name method)";
@ -891,7 +912,7 @@ sub do_cmd_methodlineni{
local($_) = @_; local($_) = @_;
next_optional_argument(); next_optional_argument();
my $method = next_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>" return "<dt><b>$method</b> (<var>$arg_list</var>)\n<dd>"
. $_; . $_;
} }
@ -900,7 +921,7 @@ sub do_env_methoddescni{
local($_) = @_; local($_) = @_;
next_optional_argument(); next_optional_argument();
my $method = next_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>" return "<dl><dt><b>$method</b> (<var>$arg_list</var>)\n<dd>"
. $_ . $_
. '</dl>'; . '</dl>';