NetMath HTML Extensions

Eval Tag
<!ELEMENT EVAL - O EMPTY    -- Text To be Evaluated by Program -->
   program     CDATA    #REQUIRED  -- program to run on server  --
   doinsert    CDATA     #IMPLIED  -- boolean value 0 or 1
   name        CDATA     #IMPLIED  -- matching result field has same name
   preload     CDATA     #IMPLIED  -- url to fetch and send to program once
   preeval     CDATA     #IMPLIED  -- code to eval once in program
For example to include code to integrate.
<eval program=maxima>integrate(1/x^2,x)</eval>
We need to provide a place to put the result (unless doinsert=0
was supplied as an attribute).
Result Tag
<!ELEMENT RESULT - O EMPTY    -- Place to put RESULT of an EVAL -->
   modified (modified)    #IMPLIED  -- is the result valid or modified
   name  CDATA    #IMPLIED  -- result comes from previous eval with same name
For example
<eval program=maxima>integrate(1/x^2,x)</eval>
produces <result modified>Result</result>

would give

integrate(1/x^2,x) produces Result

When one clicked on the text of the eval, ie on integrate..
then the result would appear in the next result box.

<eval program=maxima>f(x)</eval>
would cause the program to be fetched as a URL, and then preappended to the first form sent to maxima. This will only happen once for any given life cycle of maxima. The same thing may be done but from data provided in the url itself.

<eval program=maxima preeval=x:27;>f(x)</eval>
would maxima set x to 27 calling f(x). Note that the preeval or preload code is simply preappended to the command, so if a ';' or newline is required at the end of the form, one must be supplied.

An eval without a doinsert=0, needs a place to put a result. The result field must come before the next eval field, unless the eval is named in which case the result field will be the next result field on the page with the same name. In this latter case, there may be evals intervening.

This makes it possible for the result of one eval, to occur as part of the argument of another eval:

<eval name=int program=maxima>integrate(1/x^2,x)<eval>
feeds into
<eval  program=maxima>diff(<result name=int>res</result>,x)</eval>
produces <result>1/x^2</result>

would appear as

feeds into diff(res,x)
produces 1/x^2

Note that in fact for maxima one would have to use display2d:false in order to have the result be in the linear format, understood as input, and not in the fancy 2d pretty printed version, with exponents above.

Extensions to Body

In order to influence the colors of the background of results and
of eval text, and to indicate if they are modified or not,
extra body attributes are provided.

<!ELEMENT BODY - O EMPTY    -- change defaults for BODY of page -->
   bgresult    % color # IMPLIED  --  for background of result
   result      % color # IMPLIED  --  for result foreground
   bgresult    % color # IMPLIED  --  for background of result
   result      % color # IMPLIED  --  for result foreground 
   resultmodified	% color # IMPLIED  --  for modified result foreground
   bgresultmodified % color # IMPLIED  --  for modified result background
   aeval   % color IMPLIED  --  for active eval
   bgeval   % color IMPLIED  --  for eval background
   evalrelief	(sunken | flat | raised) -- relief of eval
   resultrelief	(sunken | flat | raised) -- relief of result of eval
   resultmodifiedrelief (sunken | flat | raised) -- relief of result of eval
   baseprogram % URL such as nmtp:// indicating where to run programs.
A sample call would be
<body eval=blue bgresultmodified=red aeval=red>