Ross Moore writes:
 > Yes, you can do this -- at least in principle.
 > I'm not sure how well it actually works.
 > A similar thing is needed occasionally with \color-macros.
 > 
 > It works this way.
 > 
 > 
 > Whenever a call is made to  do_cmd_<whatever>
 > there are 2 arguments passed:
 >  1.  the current string being processed
 >  2.  a list of open tags:  @open_tags
 > 
 > For most macros, onthe string is required, to be able to extract
 > the arguments to the LaTeX command.
 > This is done by:  local($_) = @_;
 > which stats the code block in most cases.
 > 
 > However you could easily start the block with:
 >   local ($_, @open_tags) = @_;

Ross,
  After digging around with this a bit, and consulting our local Perl
guru, I've come up with:

        sub do_cmd_var{
            local($_, $open_tags) = @_;
            print "do_cmd_var(); \@open_tags = ("
                  . join(',', @open_tags)
                  . ")\n";
            return ...;
        }

always prints an empty list for @open_tags.  Greg's comment (he's our
Perl guy) was that a lot of the code that dealt with @open_tags in
latex2html was using the Perl 4 approach, making it more complicated.
His explanation of what we had to do to figure this out was that the
second parameter to  do_cmd_var()  is a symbol table reference, and
should be unpacked using  $open_tags  but accessed using the
appropriate  @open_tags  syntax.
  Why the list is empty I don't know; should my code be doing anything 
to update  @open_tags ?  I'm not at all sure that that even makes
sense.  Does latex2html pull out HTML tags from the stream in the main 
loop to update the list?  If I write:

        sub next_argument{
            # extract and return text of next { } group
            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_code{
            local($_) = @_;
            my $param = next_argument();
            return "<code>$param</code>$_";
        }

how would I modify  do_cmd_code()  to properly update  @open_tags  so
that  do_cmd_var()  could detect the already-opened <code> element?
  Thanks for the prompt reply!


  -Fred

--
Fred L. Drake, Jr.
[EMAIL PROTECTED]
Corporation for National Research Initiatives
1895 Preston White Drive    Reston, VA  20191

Reply via email to