0.1.1 | 2023-1-22 |
Improve quotation elements. |
1. Introduction
I was inspired by Org MIME to compose HTML email in Emacs but I
don't use Org. Personally I think XML is all the way better with
XSLT and RelaxNG. How about text/enriched
? Well it is almost dead.
I'm not afraid of writing HTML directly, but I want to make the
result as modern as possible, so a lot of formatting stuff of HTML
has been moved to CSS, and in modern time HTML email makes a lot
use of inline CSS. Meanwhile, I'm using Emacs' shr
library to render my HTML emails most of the time, so I also want
the result to be recognizable in Emacs.
MJML is something similar to what I want, but:
-
It is commercial email oriented. I just want to write personalized mail.
-
The result requires lot of modern browser features not available in Emacs.
-
I don't want to install
npm
.
So a simple conclusion: I want something that can be easily converted to HTML5 with XSLT 1.0 only, since I don't have Saxon installed on my local computer. Also I need a RelaxNG Schema so I can editing the format with Emacs.
2. Sample files
This is the sample XML source file for version 0.1. The corresponding HTML output.
3. Structure of LsML
When in doubt, reference the sample input file.
3.1. Document Root
The root element is lsml
, it has XML name space
https://ldbeth.sdf.org/lsml
.
The version
attribute is mandatory and currently
the only permitted value is 0.1
. The
format
attribute can have htmlonly
or usetext
as value, and is used to control MUA.
There are two required elements: head
,
body
. Other elements which are
optional: sig
, which is used to format signature;
headers
and mime
are use to provide
information to MUA, and are for internal use only.
3.2. Header
3.2.1. Common Email headers
Subject
, From
, To
,
Cc
, Bcc
are common email headers, and
they are in capitalized form because XSLT 1.0 has no easy
capitalize string solution.
For elements that are supposed to take email address lists as values, the format is:
|(<name>person name</name><email>email address</email>)+
3.2.2. Additional headers
Additional headers can be added as children of
headers
element. Notice that field name is case
sensitive.
|(<field>content</field>)*
3.2.3. Preview
The idea is from MJML, preview
adds a paragraph of
hidden text in the body so it can only viewed from email
summary.
3.3. Body
The vertical mode elements are: p
(paragraph),
l
(list), hr
(horizontal rule), img
(inline
image), section
,
raw
(raw HTML), code
(code block), quote
(quote
message).
3.3.1. Inline elements
They are: b
,
i
, tt
,
ins
, del
,
kbd
, c
,
url
, br
.
Where c
stands for cite, the other are functioning
similar to standard HTML tags. However, they may not necessary be
translated to exactly the same tags during processing. The
raw
tag can also be used to create inline HTML.
3.3.2. Section
This is similar to section
tag from DocBook, that
it can be arbitrarily nested.
Each section must have a title
element. The title
can have optional level
attribute corresponding to
h1
to h6
titles in HTML.
3.3.3. Quotation
Use quote
email messages, there are three optional
attributes:
-
date
-
RFC822 timestamp.
from
-
Author of original message.
cite
-
URL to original message.
To make quoting HTML emails much easier, this elements also accepts elements from XHTML namespace.
There is also vcode
, for verbatim inclusion of
original message.
3.3.4. Code block
The code
element can be used to format code block.
The optional lang
attribute specifies programming
language used.