A collegue of mine is trying to translate some documentation containing
an idiom essentially identical to something that came up in a comment from
Ross a week or so back --- But I'm not sure if it was implied that this
was expected to work in LaTeX2HTML.

A Simple example:

\documentclass{article}
\newcommand{\stuff}{Outside.}
\newenvironment{silly}{%
\bgroup\def\stuff{Inside.}}{\stuff\egroup}

\begin{document}
Before.
\begin{silly}
Middle.
\end{silly}
After.
\end{document}

should produce
  Before. Middle. Inside After.
L2h doesn't recognize \def (or \renewcommand...) in that context, so it
produces
  Before.Outside.Inside.Middle.Outside.After.

Well, remembering that nifty \HTMLset, I figured I could come up with a quick
workaround. First off, we needed one addition to html.sty, say

sub do_cmd_HTMLget {
  local($_) = @_;
  local($hash) = &get_next_optional_argument;
  local($which) = Xget_next_argument();
  join('', $hash ? ${$hash}{'$which'} : ${$which},$_); }

which assumes that get_next_argument has been generalized as discussed before.
It also handles the undocumented \HTMLset[hash]{key}{value}
by recognizing \HTMLget[hash]{key}.

But if the value passed to \HTMLset ends up containing non-trivial HTML,
particularly quotes ", it fails.
  sub do_cmd_HTMLset contains the line

        eval "\${$which} = \"$value\";";

This means that the 2nd arg to \HTMLset gets evaluated by l2h, interpolated
into the string, then evaluated AGAIN by perl.  Is this really what is
intended?
Wouldn't
        eval "\$$which = \$value;"
Or even better, simply
        ${$which} = $value;

be correct; it assigns the value of $value to whatever variable is named.

-- 
--
[EMAIL PROTECTED]
http://math.nist.gov/~BMiller/

Reply via email to