Manual pages

From: Gavin Nicol <gtn_at_nospam.org>
Date: Wed May 11 1994 - 06:31:20 PDT

>Is there a good guide to SGML/HTML, etc on the net anywhere? It
>sounds like maybe I've misunderstood quite how it fits in?

No, there are no SGML tutorials that I know of. HTML is very poor SGML
because it emphasises format over structure, so it is a poor learning
point. If you are really interested, look at "Practical SGML" or
"SGML, an authors guide".

Basically, SGML is a meta-language, like YACC, but it allows you to
write document structure grammars. For example:

<!ENTITY document - - (section*) >
<!ENTITY section - - (title,para*) >
<!ENTITY title - O (#PCDATA) >
<!ENTITY para - O (#PCDATA) >

says that a document contains 0 or more sections, which consist of a
title and zero or more paragraphs. titles and paragraphs do not require
end tags. An example document:

<DOCUMENT>
<SECTION>
<TITLE> The Standard IO Library
<PARA> The standard IO library ....
<PARA> Also, the ....
</SECTION>
</DOCUMENT>

so, if we decided to use SGML for man pages, I, or someone else could
write up a really small DTD, which would define the structure of a man
page. The formatter would only need to be able to recognise the start
and end tags, and perform whatever formatting it desires based on
those. For normalised SGML, a simple stack-based formatter suffices
because all SGML documents should form a tree when parsed.

The beauty is that such documents are entirely formatter independent,
and can be converted into almost anything. Converting TROFF to SGMl on
the other hand is much harder because TROFF hides a lot of the
structure, unless you can rely upon certain constructs (macros) marking
sections etc.

Oh, BTW, elements in SGML can also have attributes, so you can also
attach some semantics to elements, like:

<SECTION FONT="helvetica">

Though in general, this is not a good thing to do. However, you could
use this to produce something like:

<!ELEMENT emph - - (#EMPTY) >
<!ATTLIST emph TYPE (bold|italic|underlined|slanted|roman) >

I'm not keen on this either....
Received on Wed May 11 05:44:55 1994

This archive was generated by hypermail 2.1.8 : Wed Sep 21 2005 - 21:04:28 PDT