axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] Re: literate programming pamphlet files for MathAction


From: Bob McElrath
Subject: [Axiom-developer] Re: literate programming pamphlet files for MathAction
Date: Wed, 29 Sep 2004 12:10:18 -0700
User-agent: Mutt/1.5.6+20040523i

Page, Bill address@hidden wrote:
> Martin (and others);
> 
> I have started to document the work I am doing to implement
> full Axiom pamphlet file support on MathAction. I hope to
> have an test version of this extension available before the
> weekend.
> 
> There are few more notes and some examples here:
> 
>   http://test.axiom-developer.org/wiki/ConversionToHTML
> 
> My approach is to use Norman Ramsey's Latex to HTML (l2h)
> noweave filter. This filter together with noweave, is able
> to produce HTML files directly from noweb (pamphlet) files.
> l2h is written in Icon - so over the last couple of days
> I had to learn yet another language. Icon is quite a tidy
> fast and apparently well suited language for this sort of
> complex conversion. I have modified and extended l2h  so that
> inline and display math environments as well as the axiom,
> aldor and reduce pseudo-environments are passed straight
> through the conversion. Now that I understand Icon and
> thanks to Norman's literate programming style, I have also
> added some missing things needed my first set of test files.

Let me suggest that you do this as a ZWiki "pagetype".  (see pagetypes/
in the ZWiki source)  The relevant code for latexwiki is in the
__init__.py file.

Each pagetype should define an input type and an output type.  (and the
output type should almost always be html)

> The output of the modified l2h can then be given directly
> to LatexWiki (or MathAction) as an HTML+LaTeX file. When
> it is fully integrated into MathAction, the pamphlet file
> itself will be stored and converted transparently using
> noweave with the modified l2h filter when clicking Save.
> 
> Please let me know if you have any questions or suggestions.
> It will help motivate me to complete this work... :)

Let me tell you what I have been doing, since it is very similar...

ZWiki needs a huge rewrite of its page-rendering code.  Right now it is
a big pile of regexes and because of this, one can find cases where it
will mangle pages.  This is especially relevant for latex.  I have
started this, and right now have a standalone code which does it
"properly".  This is a subclass of StructuredText and uses that
machinery to render pages.

Why this is relevant to you:

When this is done I will start adding new page types.  For me the first
will be "true" latex.  But since this is all done within the
StructuredText system, new pagetypes (such as "spad") can *inherit* the
needed latex functionality from latexwiki.  Thus we can combine our work
into new page types in ways that cannot mangle the document.

The StructuredText classes are very simple.  Basically for each text
"object" (like $math$) you have to write one function to recognize it
and one function to render it.  In addition there is a list of which
"recognizers" have more importance than others, so you know what to do
with things like [foo $bar$] vs. $foo [bar]$ or -- which takes
precedence, the link [] or the latex?  This is very difficult to do
properly with successive regexes that operate on the whole document.
That it works at all right now is a rather large hack involving
successive conversions to html, and ignoring html...

This is not as good as a formally defined document grammar, but is
probably the best we can get with what we are doing.

Join me on #zwiki at irc.freenode.net if you'd like to discuss this
further.  I think we should discuss the "big scheme" before we head in
different directions and end up with a pile of incompatible software.

I have placed my preliminary StructuredText classes here::

    http://bob.mcelrath.org/WikiStructuredText

along with a standalone example program showing how to use it.  I hope
this should make it obvious how to extend.

This will result in a more extensible, understandable, and robust
codebase.  Not to mention faster.

P.S. do I understand that MathAction is your website, and not a piece of
software?

--
Cheers,
Bob McElrath [Univ. of California at Davis, Department of Physics]
    
    It is unpatriotic to question the Kleptocracy.

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]