summaryrefslogtreecommitdiffstats
path: root/Doc/perl/ltxmarkup.perl
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>1999-04-28 16:33:04 (GMT)
committerFred Drake <fdrake@acm.org>1999-04-28 16:33:04 (GMT)
commitd02573d13bbb4538619d6af013d2296807f2a4f0 (patch)
tree7b8a1c0c3cc8e42951ccb908820bd4fed44c135d /Doc/perl/ltxmarkup.perl
parent4050e00e41a1fed198354faf1d570c8752737293 (diff)
downloadcpython-d02573d13bbb4538619d6af013d2296807f2a4f0.zip
cpython-d02573d13bbb4538619d6af013d2296807f2a4f0.tar.gz
cpython-d02573d13bbb4538619d6af013d2296807f2a4f0.tar.bz2
Handle \p and \op in parameter lists for the environment and macro
description environments.
Diffstat (limited to 'Doc/perl/ltxmarkup.perl')
-rw-r--r--Doc/perl/ltxmarkup.perl35
1 files changed, 25 insertions, 10 deletions
diff --git a/Doc/perl/ltxmarkup.perl b/Doc/perl/ltxmarkup.perl
index 9136e61..92667e4 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 "<tt class='macro'>&#92;$macro</tt>" . $_;
+ return "<tt class=macro>&#92;$macro</tt>" . $_;
}
sub do_cmd_env{
local($_) = @_;
my $env = ltx_next_argument();
- return "<tt class='environment'>&#92;$env</tt>" . $_;
+ return "<tt class=environment>&#92;$env</tt>" . $_;
+}
+
+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>>%<tt>[</tt><var>$2</var><tt>]</tt>%;
+ while ($s =~ /\\p<<(\d+)>>(.+)<<\1>>/) {
+ $s =~ s%\\p<<(\d+)>>(.+)<<\1>>%<tt>{</tt><var>$2</var><tt>}</tt>%;
+ }
+ return $s;
}
sub do_env_macrodesc{
local($_) = @_;
my $macro = ltx_next_argument();
- my $params = ltx_next_argument();
- return "\n<dl class='macrodesc'>"
- . "\n<dt><b><tt class='macro'>&#92;$macro</tt></b>"
- . "\n $params"
+ my $params = ltx_process_params(ltx_next_argument());
+ return "\n<dl class=macrodesc>"
+ . "\n<dt><b><tt class=macro>&#92;$macro</tt></b>"
+ . "\n $params"
. "\n<dd>"
. $_
. "</dl>";
@@ -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<dl class='envdesc'>"
- . "\n<dt><b><tt class='environment'>&#92;$env</tt></b>"
- . "\n $params"
+ my $params = ltx_process_params(ltx_next_argument());
+ return "\n<dl class=envdesc>"
+ . "\n<dt><b><tt class=environment>&#92;$env</tt></b>"
+ . "\n $params"
. "\n<dd>"
. $_
. "</dl>";