\documenttype{html}
\newcommand{\elisp}{\em{Elisp}}
\newcommand{\gellmu}{\acronym{GELLMU}}
\newcommand{\html}{\acronym{HTML}}
\newcommand{\label}[1]{\a[name="#1" id="#1"]{}}
\newcommand{\display}[1]{\p[align="center"]{#1}}
\newcommand{\q}[1]{“#1”}
\newcommand{\href}[2]{\a[href="#1"]{#2}}
\newcommand{\hc}[2][3]{\h#1[align="center"]{#2}}
\newcommand{\thc}[1]{\th[align="center"]{#1}}
\newcommand{\tdc}[1]{\td[align="center"]{#1}}
\link[rel="stylesheet" type="text/css" href="/~hammond/style/mxh.css"];
\title{GELLMU HTML}
\begin{body}
\label{top}
\hc{1}{Using the \gellmu Syntactic Translator\br to Write \html}
\hc{2}{William F. Hammond}
\display{Copyright © 2000 - 2006 William F. Hammond}
\h3{Basic}
\p
One can create \html directly using LaTeX-like markup.
\p
In so doing one is \b{not} writing LaTeX. Instead one is consciously
writing \html.
\p
The basic ideas may be understood by examining an example such as
this document and comparing its appearance as rendered \html with
the \href{ghtml.glm}{\gellmu source} and possibly also with
the \html source.
\p
The \gellmu syntactic translator, a program written in Emacs
Lisp (casually known as \elisp) is used to make \html from \gellmu
source. It is not correct at all to view this program as a collection
of editing macros. It is a program entirely parallel to a program
written in a language such as \em{C} that may be run in batch mode on
any platform where GNU Emacs is available. Such platforms include
\q{Linux} and \q{Windows}. Alternatively, it may also be run interactively
from an Emacs buffer.
\p
It is desirable, of course, to run any \html through a validator
for error checking.
\h3{\html Elements} \p
There are three basic ways one may use
LaTeX-like markup to make an \html element with content.
\begin{ol}
\li The first basic way is that used with the \q{b}, \q{em},
and \q{h3} elements in this document. For example, the markup
"\kbd{\\b\{not\}}" appears previously in the
\href{ghtml.glm}{source} for this article.
\li The second basic way is that used with the \q{body}
element of this document, the \q{ol} element for this ordered list, and
the \q{table} element in the next part of this document. This usage
has the form "\kbd{\\begin\{body\} . . . \\end\{body\}}".
\li The third basic way, which is a variant of the second basic way,
is that used here for the element \q{ul} to make this list:
\ul \li{bird}
\li{cat}
\li{dog .}\ul:
This markup has the form "\kbd{\\ul ... \\ul:}" with "\kbd{\\ul}" signifying
the \html opentag "\kbd{
}" and "\kbd{\\ul:}" signifying the \html closetag
"\kbd{
}" almost directly.
\end{ol}
\p
Another optional way, available for some \html elements (depending
on the formal definition of the \html language) is that used for the
paragraphs (the \q{p} elements) of this document. This method relies on
the language definition for the automatic determination of the end of
the element's content. In \html, for example, a paragraph is
automatically terminated by the appearance of any number of elements
including a (new) paragraph, a list, a table, and a header.
\h3{Elements Defined as Empty}
\p
Some \html elements are defined as empty elements in the formal
definition of \html. The element \q{hr} for a \em{horizontal rule}
is an example. In the \gellmu markup interface for \html, one writes
"\kbd{\\hr;}".
\p
The usage above is not correct for SGML elements that are not
defined as empty, but, when consistent with the formal language
definition, happen to be empty in a particular instance. Depending on
whether \kbd{OMITTAG} is available in the SGML language (but never in
XML) and further whether its use is appropriate for the particular
container, one might be able to use the brief markup "\kbd{\\foo}" but
always may use "\kbd{\\foo\{\}}" or "\kbd{\\foo\\foo:}". In \html,
for example, an empty paragraph may be indicated with "\kbd{\\p}" if it
is followed without content by something that forces a paragraph to
end, but an empty title must be written as "\kbd{\\title\{\}}" or as
"\kbd{\\title\\title:}".
\p
\em{A Minor Point:} By default the markup "\kbd{\\foo;}" is
translated to "\kbd{}" since this is both correct and required
for a element that is defined empty in any XML language and is correct
and \q{preferred} in the default \gellmu language for LaTeX
emulation. It is not correct for use with classical SGML languages
such as \html (as opposed to \acronym{XHTML}); the \elisp variable
\kbd{gellmu-sgml-emptytag-close} is a string variable that has the
default value "\kbd{/>}", but may easily be reset to "\kbd{>}", and
must be reset to "\kbd{>}" for use with classical \html. This may be
done either interactively within Emacs using
\pre{
M-: (setq gellmu-sgml-emptytag-close ">")
}
\p
or otherwise placed in a batch file that is used to launch the
\gellmu syntactic translator.
\h3{Certain Characters}
\begin{table}[align="center"]
\tr\th{Name} \thc{Appearance } \thc{ Markup}
\tr\td{Backslash} \tdc{\kbd{\\}} \tdc{\kbd{\\\\}}
\tr\td{Left brace} \tdc{\kbd{\{}} \tdc{\kbd{\\\{}}
\tr\td{Right brace} \tdc{\kbd{\}}} \tdc{\kbd{\\\}}}
\tr\td{Percent} \tdc{\kbd{\%}} \tdc{\kbd{\\\%}}
\tr\td{Ampersand} \tdc{\kbd{\&}} \tdc{\kbd{\\&}} \td{(\kbd{&} is often OK)}
\tr\td{Less than} \tdc{\kbd{<}} \tdc{\kbd{<}}
\tr\td{Greater than} \tdc{\kbd{>}} \tdc{\kbd{>}}
\tr\td{Left bracket} \tdc{\kbd{[}} \tdc{\kbd{[}}
\tr\td{Right bracket}\tdc{\kbd{]}} \tdc{\kbd{]}}
\end{table}
\p
Note that in LaTeX itself the markup "\kbd{\\\\}" signifies a forced
linebreak. In \html, however, the empty tag "\kbd{
}" is used to
make a linebreak. With this method of making \html one uses
"\kbd{\\br;}" to signify the \html tag "\kbd{
}" and one doubles
the LaTeX-like command sequence introducer, i.e., the character
"\kbd{\\}", to \q{escape} the command sequence introducer.
\p
Usage of markup for the characters \em{backslash}, the
LaTeX-like command sequence introducer, and \em{ampersand},
the \html entity introducer, is illustrated by using the markup
"\kbd{\\\\foo}" to create for \html a reference to the TeX command
"\kbd{\\foo}" and the markup "\kbd{R\\\&R}" to create the abbreviated
phrase \q{R\&R} when the special character is not immediately followed
by a word boundary.
\h3{Attributes}
\p
Any \html element may have a list of one or more attributes. For
example, the \q{h1} element at the beginning of this document has the
attribute \q{align}, which is given the value \q{center}.
\p
An attribute list is introduced by the character "\kbd{[}" immediately
following the element name and terminated by the character "\kbd{]}".
There may be any number of attributes in an attribute list in
accordance with the specification for the particular element in the
formal definition of \html.
\h3{\html Anchors}
\p
Anyone familiar with \html knows that the element \q{a} signifies
an \html anchor. Here is an anchor to the \href{#top}{top of this
document}. And here is an (external) anchor to the
\display{\href{http://www.albany.edu/~hammond/gellmu/}{\gellmu
web site}.}
\h3{SGML Languages other than \html}
\p
SGML languages other than \html may be treated the same way once the
author is familiar with the tag names and the rules for their
deployment.
\p
One may use standard SGML entity notation directly. For example,
"\kbd{\>}" is an alternative way to write the character \q{>} in
\html.
\h3{XML Languages} \p
XML languages are special instances of SGML
languages.
\p
There are several important restrictions with XML.
\begin{ol}
\li All element names are case-sensitive.
\li Only the three \em{basic} methods of writing a element, other than
an element that is defined as empty in the language definition, may be
used. That is, the precise opening and closing points for every
container is required.
\li Every defined-empty element must be written in the form
"\kbd{\\foo;}".
\li Every attribute value must be quoted.
\end{ol}
\h3{LaTeX Emulation}
\p
LaTeX emulation in an SGML (or XML) language is a very different
thing than the use of LaTeX-like syntax to write in SGML.
\p
The original idea in the \gellmu project of using LaTeX-like syntax
for writing in an SGML language envisioned its use primarily with an
SGML language that includes reasonably full markup for research-level
mathematical and scientific articles, rich enough, as \html is not, to
admit useful and fully reliable automatic creation of LaTeX
source and source for other standard formats including \html (necessarily
with crude representation of mathematics in \html).
In that context it makes
sense to ask for additional services from the syntactic translator
in the way of LaTeX emulation, still, however, with the goal of
obtaining a valid document in the SGML language.
\p
By default the \gellmu syntactic translator runs in LaTeX emulation
mode. This incorporates a number of LaTeX-like features that do
not apply in the case of its basic mode.
\p
It is easy either interactively within Emacs or in a batch file to
effect the emacs command \pre{
M-: (setq gellmu-straight-sgml t)
}
for using LaTeX-like syntax to write in regular SGML (or XML)
vocabularies such as \em{\html}, \em{TEI}, or \em{DocBook}. Other
variable settings permit the use of blank lines for
new paragraphs under certain circumstances.
\p
Because SGML attributes are not part of LaTeX, in LaTeX emulation
(with \kbd{gellmu-regular-sgml} set to \kbd{nil}) the \gellmu syntactic
translator reserves the characters "\kbd{[}" and "\kbd{]}" for
LaTeX-like command options and an attribute list is introduced as an
option immediately after the command name inside which the first
character is the character "\kbd{:}".
\p
\href{http://www.albany.edu/~hammond/gellmu/}{UP} |
\href{http://math.albany.edu/~hammond/}{Author}
\p
Last change: 10-Jan-2006
\end{body}