On June 20, 1998 at 13:39, =?ISO-8859-1?Q?Fran=E7ois_Pinard?= wrote:
Emacs has a mode for practically any text file format on the planet
[...] SGML [...] it should not be too difficult to create one for MHonArc
resource files. Maybe things like syntax highlighting of resource tags
and resource variables. Maybe some form of validation.
In fact, using PSGML mode in Emacs would be perfect. One gets automatic
highlighting, intelligent indentation, folding, validation, and many
other goodies. The only missing piece would be a DTD describing the
resource file. Does such a DTD exist?
No, because it is impossible to create an SGML DTD that properly
represents MHonArc resource files. Since the following can exist
as resource content:
Resource element content would have to be treated as character
data since the above is an illegal start tag. However, non of
the character data constructs (CDATA, RCDATA, PCDATA) will work.
CDATA and RCDATA do not allow "</" sequences w/o terminating
element content, and RCDATA and PCDATA cause entity references to
be expanded; which will not all "<" to be present.
Now, lets say we can get buy with munged start tags and try to
have the DTD defined so it allowed all the HTML elements as the
content of resource elements (where applicable). This will not
work. For example:
There is no way to represent the "</ul>" in isolation unless LISTEND
is defined as #PCDATA only. But this leads to the problem mentioned
Note, the lone <UL> is a problem also. This could be dealt with
by making all HTML elements into empty tags, but this does not solve
the end tag dilemma.
If SGML did not have the limitation present for CDATA elements,
a DTD could easily be created.
Marked sections are an alternative, but, IMO, require constructs that
have no real meaning within the application of MHonArc, and would be
an extra burden for users. I.e. Resource that contain contain HTML
data would hvae to be defined as follows:
<![ CDATA [
<p>Some HTML stuff here</p>
Who would want to wrap a CDATA marked section around every page layout
resource? Plus when XML becomes more common, marked section text would
probably used as part of the template text which should not be
interpreted by the resource file parser.
If you are a Vim user, the HTML mode could be used for MHonArc
resource files. Since no SGML validation is done, its higlighting
is solely based on lexical contructs. Some tweaks to the mode
could be done to provide special highlighting for MHonArc resource
elements and resource variables.
Earl Hood | University of California: Irvine
ehood(_at_)medusa(_dot_)acs(_dot_)uci(_dot_)edu | Electronic
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME