chez-libs

Artifact Content
Login

Artifact bed3dbdd91e01055bc25e08d4700618ad238292a:

Wiki page [(data html)] by murphy 2016-06-02 13:02:50.
D 2016-06-02T13:02:50.910
L (data\shtml)
P 67b5d2465a01503699ec4746abf132e7bd3274e3
U murphy
W 1710
<h1>HTML Output</h1>

<h2>Synopsis</h2>

<code>(import (data html))</code>

Encoding of S-expressions as [https://www.w3.org/TR/html5/|HTML5].

<h2>S-Expression HTML Grammar</h2>

Elements are represented as lists starting with a tag symbol, optionally followed by an association list of attributes and by element contents:
<code><pre>
html    → (SYMBOL content ...)
        | (SYMBOL ((SYMBOL . value) ...) content ...)
</pre></code>

The value of an attribute may be a boolean or a list of text contents:
<code><pre>
value   → BOOLEAN
        | (text ...)
</pre></code>

An attribute with value <tt>#f</tt> is not serialized as HTML5; an attribute with value <tt>#t</tt> is serialized without a value assignment in HTML5.

The contents of elements and attributes may consist of plain text and entity references represented as symbols or positive integers. Normal elements may also contain other elements:
<code><pre>
content → text
        | html

text    → STRING
        | NUMBER
        | SYMBOL
</pre></code>

<h2>Operations</h2>

<h3>procedure: <code>(html-tag-rule <i>tag</i>)</code></h3>
<h3>procedure: <code>(html-tag-rule <i>tag</i> <i>rule</i>)</code></h3>

Get or set serialization rules for the given tag. The rule may be <tt>void</tt>, <tt>raw</tt> or <tt>normal</tt>. <tt>void</tt> elements cannot have contents, <tt>raw</tt> elements cannot have other elements as contents and <tt>normal</tt> elements are the default.

<h3>procedure: <code>(write-html <i>html</i>)</code></h3>
<h3>procedure: <code>(write-html <i>html</i> <i>port</i>)</code></h3>

Write an S-expression as HTML5 to the given port or to the <tt>(current-output-port)</tt>.

Z 771a67f2975148104f140ebbde3a485d