blob: 290e79b4536476eaab67a1a429ed04776f84ac71 [file] [log] [blame]
Fred Drake03dffcc1999-03-18 16:42:28 +00001# LaTeX2HTML support for the ltxmarkup package. Doesn't do indexing.
2
3package main;
4
5
6sub ltx_next_argument{
7 my $param;
8 $param = missing_braces()
9 unless ((s/$next_pair_pr_rx/$param=$2;''/eo)
10 ||(s/$next_pair_rx/$param=$2;''/eo));
11 return $param;
12}
13
14
15sub do_cmd_macro{
16 local($_) = @_;
17 my $macro = ltx_next_argument();
Fred Drakee15956b2000-04-03 04:51:13 +000018 return "<tt class='macro'>&#92;$macro</tt>" . $_;
Fred Drake03dffcc1999-03-18 16:42:28 +000019}
20
21sub do_cmd_env{
22 local($_) = @_;
23 my $env = ltx_next_argument();
Fred Drakee15956b2000-04-03 04:51:13 +000024 return "<tt class='environment'>&#92;$env</tt>" . $_;
Fred Draked02573d1999-04-28 16:33:04 +000025}
26
27sub ltx_process_params{
28 # Handle processing of \p and \op for parameter specifications for
29 # envdesc and macrodesc. It's done this way to avoid defining do_cmd_p()
30 # and do_cmd_op() functions, which would be interpreted outside the context
31 # in which these commands are legal, and cause LaTeX2HTML to think they're
32 # defined. This way, other uses of \p and \op are properly flagged as
33 # unknown macros.
34 my $s = @_[0];
35 $s =~ s%\\op<<(\d+)>>(.+)<<\1>>%<tt>[</tt><var>$2</var><tt>]</tt>%;
36 while ($s =~ /\\p<<(\d+)>>(.+)<<\1>>/) {
37 $s =~ s%\\p<<(\d+)>>(.+)<<\1>>%<tt>{</tt><var>$2</var><tt>}</tt>%;
38 }
39 return $s;
Fred Drake03dffcc1999-03-18 16:42:28 +000040}
41
42sub do_env_macrodesc{
43 local($_) = @_;
44 my $macro = ltx_next_argument();
Fred Draked02573d1999-04-28 16:33:04 +000045 my $params = ltx_process_params(ltx_next_argument());
Fred Drakee15956b2000-04-03 04:51:13 +000046 return "\n<dl class='macrodesc'>"
47 . "\n<dt><b><tt class='macro'>&#92;$macro</tt></b>"
Fred Drakeac3dc831999-04-28 16:42:29 +000048 . "\n $params"
Fred Drake03dffcc1999-03-18 16:42:28 +000049 . "\n<dd>"
50 . $_
51 . "</dl>";
52}
53
54sub do_env_envdesc{
55 local($_) = @_;
56 my $env = ltx_next_argument();
Fred Draked02573d1999-04-28 16:33:04 +000057 my $params = ltx_process_params(ltx_next_argument());
Fred Drakee15956b2000-04-03 04:51:13 +000058 return "\n<dl class='envdesc'>"
59 . "\n<dt><tt>&#92;begin{<b class='environment'>$env</b>}</tt>"
Fred Drakeac3dc831999-04-28 16:42:29 +000060 . "\n $params"
Fred Drakee15956b2000-04-03 04:51:13 +000061 . "\n<br /><tt>&#92;end{<b class='environment'>$env</b>}</tt>"
Fred Drake03dffcc1999-03-18 16:42:28 +000062 . "\n<dd>"
63 . $_
64 . "</dl>";
65}
66
671; # Must end with this, because Perl is bogus.