# z2html.sed - Z2HTML: simple Fuzz/LaTeX to HTML translator for Z notation
#
# Use GIFs (not symbol font) for Z symbols, HTML tables for Z boxes
# Use *-m.gif, looks best with medium text size
# Set each Z paragraph inside
...
for stylesheet
# Set in-line Z text (LaTeX $...$) inside ... ditto
#
# 11-Jul-1999 J. Jacky First attempts, used symbol font for most Z characters
# 9-Oct-1999 J. Jacky Replace all font face=symbol... with GIF's
# 23-Nov-1999 J. Jacky Begin stylesheet version
# 7-Jan-2000 J. Jacky Replace
around tables with
# 13-Jan-2000 J. Jacky Rename zgif directory to zimg (maybe use .png later)
# 15-Jan-2000 J. Jacky Add closing in tabular, zed paragraphs
# Don't put   before etc. in informal paragrphs
# Header
1i\
\
\
\
\
Z notation<\/title>\
<\/head>\
\
\
# Footer
$a\
\
<\/body>\
<\/html>
# Get rid of Fuzz comment lines, otherwise Z behind them will appear in HTML
/^%%/d
# Get rid of % LaTeX comments but not \% legitimate LaTeX percent
/^%.*$/d
s/ %.*$//g
s/ %.*$//g
s/\\%/%/g
# Must convert these before writing out *any* HTML tags!
# But can't use any & before handling LaTeX tabular and argue
s/\\>/\\latex-tab/g
s/\\html-amp-lt;/g
s/>/\\html-amp-gt;/g
# LaTex tabbing - must convert before inserting any other tags
#
# tabbing, tabular, argue environments are class="mixed"
# because they can contain both Z and informal text
/\\begin{tabbing}/,/\\end{tabbing}/ {
s/\\begin{tabbing}/
\2<\/td><\/tr>/g
}
# Now we've translated all the LaTeX & so...
s/\\html-amp-/\&/g
# In-line Z text
s/\$\([^$]*\)\$/\1<\/var>/g
# Single line math paragraph
s/\\\[\(.*\)\\\]/
\
\
\1<\/td><\/tr>\
<\/table>\
<\/div>\
/g
# Single line zed paragraph
s/\\begin{zed}\(.*\)\\end{zed}/
&<\/td><\/tr>/
s/\\also//
}
# Schema box
#
# Box is three columns
# First column is space after left edge
# Second column is schema name at the top of the box
# Third column is box top border after schema name
# Schema name sits by itelf on a row above the box top borders
# Text inside box (both decl. and pred.) is colspan=2 in columns two and three
# Box borders are
, shows up when print under MS Windows
# Box borders also , shows up in Linux .ps out and print
# Box top border is columns one and three, column 2 left blank
# Line between decl. and pred. in cols 1, 2 is bgcolor=black and src="black.gif"
# " " " col 3 is no bgcolor but
# Box bottom border is colspan=3 in all three columns
/\\begin{schema}{.*}/,/\\end{schema}/ {
s/\\begin{schema}{\(.*\)}/