From 458120dd40db6b4df55a4e96b650e16798ef06a0 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Tue, 3 May 2011 11:25:13 +0000 Subject: add hg and python --- sys/src/cmd/python/Doc/perl/ltxmarkup.perl | 67 ++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 sys/src/cmd/python/Doc/perl/ltxmarkup.perl (limited to 'sys/src/cmd/python/Doc/perl/ltxmarkup.perl') diff --git a/sys/src/cmd/python/Doc/perl/ltxmarkup.perl b/sys/src/cmd/python/Doc/perl/ltxmarkup.perl new file mode 100644 index 000000000..1a0f7e193 --- /dev/null +++ b/sys/src/cmd/python/Doc/perl/ltxmarkup.perl @@ -0,0 +1,67 @@ +# LaTeX2HTML support for the ltxmarkup package. Doesn't do indexing. + +package main; + + +sub ltx_next_argument{ + my $param; + $param = missing_braces() + unless ((s/$next_pair_pr_rx/$param=$2;''/eo) + ||(s/$next_pair_rx/$param=$2;''/eo)); + return $param; +} + + +sub do_cmd_macro{ + local($_) = @_; + my $macro = ltx_next_argument(); + return "\$macro" . $_; +} + +sub do_cmd_env{ + local($_) = @_; + my $env = ltx_next_argument(); + 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_process_params(ltx_next_argument()); + return "\n
" + . "\n
\$macro" + . "\n $params
" + . "\n
" + . $_ + . '
'; +} + +sub do_env_envdesc{ + local($_) = @_; + my $env = ltx_next_argument(); + my $params = ltx_process_params(ltx_next_argument()); + return "\n
" + . "\n
\begin{$env}" + . "\n $params" + . "\n
\end{$env}
" + . "\n
" + . $_ + . '
'; +} + +1; # Must end with this, because Perl is bogus. -- cgit v1.2.3