From: Fred Drake Date: Wed, 28 Apr 1999 16:33:04 +0000 (+0000) Subject: Handle \p and \op in parameter lists for the environment and macro X-Git-Tag: v1.6a1~1434 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d02573d13bbb4538619d6af013d2296807f2a4f0;p=thirdparty%2FPython%2Fcpython.git Handle \p and \op in parameter lists for the environment and macro description environments. --- diff --git a/Doc/perl/ltxmarkup.perl b/Doc/perl/ltxmarkup.perl index 9136e61f696b..92667e449601 100644 --- a/Doc/perl/ltxmarkup.perl +++ b/Doc/perl/ltxmarkup.perl @@ -15,22 +15,37 @@ sub ltx_next_argument{ sub do_cmd_macro{ local($_) = @_; my $macro = ltx_next_argument(); - return "\$macro" . $_; + return "\$macro" . $_; } sub do_cmd_env{ local($_) = @_; my $env = ltx_next_argument(); - return "\$env" . $_; + return "\$env" . $_; +} + +sub ltx_process_params{ + # Handle processing of \p and \op for parameter specifications for + # envdesc and macrodesc. It's done this way to avoid defining do_cmd_p() + # and do_cmd_op() functions, which would be interpreted outside the context + # in which these commands are legal, and cause LaTeX2HTML to think they're + # defined. This way, other uses of \p and \op are properly flagged as + # unknown macros. + my $s = @_[0]; + $s =~ s%\\op<<(\d+)>>(.+)<<\1>>%[$2]%; + while ($s =~ /\\p<<(\d+)>>(.+)<<\1>>/) { + $s =~ s%\\p<<(\d+)>>(.+)<<\1>>%{$2}%; + } + return $s; } sub do_env_macrodesc{ local($_) = @_; my $macro = ltx_next_argument(); - my $params = ltx_next_argument(); - return "\n
" - . "\n
\$macro" - . "\n $params" + my $params = ltx_process_params(ltx_next_argument()); + return "\n
" + . "\n
\$macro" + . "\n $params" . "\n
" . $_ . "
"; @@ -39,10 +54,10 @@ sub do_env_macrodesc{ sub do_env_envdesc{ local($_) = @_; my $env = ltx_next_argument(); - my $params = ltx_next_argument(); - return "\n
" - . "\n
\$env" - . "\n $params" + my $params = ltx_process_params(ltx_next_argument()); + return "\n
" + . "\n
\$env" + . "\n $params" . "\n
" . $_ . "
";