maple2html - Maple to Html translator


USAGE: maple2html maplefile ["The Title"]


maple2html translator. The file containing the emacs maple output is given as an argument. It creates the file maplefile.html with the html-ized translation of maplefile. It also creates the file maplefile.mpl with all the maple commands in maplefile. The second argument is optinal and if given it becomes the title of the html file. If the title argument is not given but the maplefile starts with the word TITLE: like,

TITLE: Examples of Directional Derivatives then "Examples of Directional Derivatives" is used as as the title of the generated html document. Here is in more detail what the program does:


html tags:

A block of text (one starting with "#") can contain arbitrary (valid) html in it but in addition to this, m2h provides a simple customizable mechanism for including formatting information. The block is htmlized (according to the flags mechanism) before being copied to the .html file. This works in the following way: A line that starts with "!ab" where "a" is a letter and "b" is a letter or a number is processed according to the "ab" entry in the hash %flag that can be defined in the .maple2html file. Most of the typical html tags are predefined but they can be overwritten in the .maple2html file. For example the "h1" flag is predefined as: $flag{h1} = '<h1>.</h1>'; This indicates that a line starting with "!h1" e.g. !h1 I am a Big one Title will be replaced with: <h1> I am a Big one Title </h1> in the html file generated by m2h. In general if $flag{ab} = 'whatever1.whatever2'; then a line of the form: !ab any text here until the end of the line the line is copied to the .html file as: whatever1 any text here until the end of the line whatever2 In this way complex html tags can be included by the flag mechanism. A list of the predefined flags is in the system wide maple2html file read at run time. For example to include an image the "im" flag is defined as:

$flag{im} = '<br><center><img src=``.'' alt=``picture a picture here''></center><br>';

Thus, all you need to get a link to an image in the file "bar.gif" located in the current directory is to have a line of the form: !im bar.gif


A line that starts with either "> gif" or "> jpeg" is assumed to be a "gif" or a "jpeg" maple command. These commands has the following syntax: > gif( AnyMaplePlotCommand, `foo.gif` ); > jpeg( AnyMaplePlotCommand, `foo.jpeg` ); The first argument could be ANY maple command that generates a plot or plot3d structure. Here is an example: > jpeg(plot3d(x^2+y,x=-1..1,y=-1..1,axes=frame), `apic.jpeg`); The gif and jpeg commands (see code below) save the image generated by the maple plot command in 'gif' or 'jpeg' format into the file given as second argument (apic.jpeg in the example). The translator isolates the maple plot command saves it into the .html and .mpl files and transforms the file given as second argument into maplefilen.gif (where n is 1,2,...) with white background and links this image in the .html file.

ADD TO your ~/.mapleinit

You need to add the following to your ~/.mapleinit: x11 := proc() plotsetup(x11); plots[display](args[1]); end: gif := proc() plotsetup(gif,plotoutput = args[2]); plots[display](args[1]); end: jpeg := proc() plotsetup(jpeg,plotoutput = args[2]); plots[display](args[1]); end:


The last character of the maplefile must be ">". If the progam does not return chances are you forgot the last maple prompt in the file.


This program works best with the companion Maple2Html emacs mode. A copy of this mode can be found at: <http://omega.albany.edu:8008/Maple2html.el> Local math.albany.edu info: If you have and account with access to the /math disk all you need to do to use maple2html from your account is to type in a shell, /math/ppl/cr569/bin/m2h4me


At start time the program reads the file .maple2html containing user choices for http server, root directory etc. In fact any valid perl statement can be included in this file. The current directory is searched first for a file named .maple2html, if it does not exist then the home directory is searched if it is not there either then a system wide default is used.


Many examples of maplefiles, and stuff generated by this program can be found at: <http://omega.albany.edu:8008/mat214> Look under Lectures with URLs with filenames of the form filename-m2h.


If you have an account in the math.albany.edu cluster with access to the /math directories you only need to run the /math/ppl/cr569/m2h4me script to get your account set for using all the maple2html goodies.


Carlos Rodriguez <carlos@math.albany.edu>

Last update: Wed Oct 16 15:53:21 EDT 1996