|Enamel is a replacement for XML. Anything that can be expressed in XML, is also
possible to express in Enamel, probably with much less overhead.
The syntax for elements is very simple:
< and > is called open and close (to avoid confusion with XML-terminology).
There is no syntax for attributes, simply because this is not needed. An
XML: <a href="details">Read more</a>
Enamel: <a <href details > Read more >
I think everybody who has designed a XML-format, have been faced with the
question if something should be coded as an attribute or element content. This
question is actually impossible to answer, since it depends on the context the
data will be used in. The decision will therefore quite random and often
attribute is selected to just to reduce overhead. Enamel solves this problem by
reducing overhead in element syntax.
Open (<) followed by a white space is threated as comments up to the matching
close (>). In other words, comments are elements with zero-length name.
< This is a comment. >
White space are mostly ignored, just as in XML.
Entity references are coded as double open and close. The reference can either
be an logical path to an external entity (IE. document) or # follow by Unicode
codepoint coded in hexadecimal.
The eurosign: <<#20A0>>
"Include" some file: <<book:chapter-1.nml>>
A logical path has some similarities with an URI. The first is a logical host
followed by a colon. Then follows an optional path separated by semicolons. This
is followed by the name and an optional extention preceded by a dot. Last is an
optional version preceded by a comma. IE:
Every Enamel document (IE entity) must begin with a preamble. This preamble
contains the name of entity, a entity reference to its form definition (DTD) and
<<<eNaMeL chapter-1.nml <<book:docbook.nmld>> ISO-10646/UTF-8>>>
Any sequence of control characters after >>> is considered as the line
separator. Any characters before <<< is ignored. This makes Enamel a much more
robust than XML. If the filename of a document is lost/corrupted during a
transfer (IE. mail attachment, this is not a problem.
Just as any language Enamel also need a escape mechanism. To avoid clashes with
existing formats ^ was chosen. Example:
<strong In Enamel ^< and ^> is used to mark up elements. >
Please note that entity references are parsed in a stateless parser. This means
that following code will result in an error:
<strong In Enamel elements are closed with ^>>
The problem is solved by adding a white space after ^>. Since white space are
ignored anyway this is not problem.