Robert Donahue writes:
 > sub do_cmd_foobar{
 >      local (???) = @_;   <------ 1) what does l2h send *to* do_cmd_foobar ???

  The text from immediately following the command token until (I
think) the end of the document.  (Maybe only the to end of the
innermost enclosing environment?  You have to strip out the arguments, 
format them, and return that *plus whatever is left*!  Less than
ideal, but avoids really having to teach latex2html about structure;
the net effect is that dealing with these things is painful.
  For environments, @_[0] is the text witin the \begin{...}
... \end{...}, and the sub is called "do_env_...".  And the regular
expressions are different; drop the "_pr" part.  This has to do with
the phased processing.  Frankly, I don't know what the phases are.
The order of processing is very different from LaTeX, and makes state
management range from difficult to just dealling with poor results.
  Creating new \section-like markup is painful, and "implied" sections 
(as produced using the {theindex} environments created my makeindex or 
some other indexing tools) is very difficult.

 > sub do_cmd_ion {
 >      local($x, $y) = @_;
 >      return join("",$x," <small>",&ArabictoRoman($y),"</small>");
 > }

Try something like this:

        sub do_cmd_ion {
            local($_) = @_;     # put args into the default input

            # strip the args out ...
            s/$next_pair_pr_rx$any_next_pair_pr_rx3//;

            # ... and store in local vars
            my($x,$y) = ($2,$4);

            # format and append what's left
            " <small>$x" . ArabictoRoman($y) . "</small>" . $_;
        }

 > sub do_cmd_etal {
 >      return "et al.";
 > }

        sub do_cmd_etal {
            "et al." . @_[0];
        }

 > However, sometimes I have things that I need to either cache or trap.
 > I have one command \reference that needs to grab all of the text
 > until the next \reference, but the text isn't in {}'s.   What to
 > do then?

  Ouch!  I presume this is something like a list environment, but with 
a new name for \item.  Perhaps looking at do_cmd_item() would help?  I 
suggest how i'd start if I had to work from scratch, but scratching
around in the existing implementation tends to work better, or at
least sooner.
  Good luck!
  If anyone wants to put together a guide, you're welcome to use this
with an ack, but you might prefer using comments from someone with
more clue!  The code I've written for use with LaTeX2HTML, along with
the document sources and classes, will become available next week.
There are just over 1200 lines of l2h support (in perl), so there
might be a few good examples of how things can be done.  The markup
we're using is heavily structured (most of it is reference material
for programmer's libraries), so whether or not the techniques I've
used will apply to other works is something someone else will have to
determine.  Send me a note if you're interested in hearing about it
when it's released.


  -Fred

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

Reply via email to