(data html)

HTML Output


(import (data html))

Encoding of S-expressions as HTML5.

S-Expression HTML Grammar

Elements are represented as lists starting with a tag symbol, optionally followed by an association list of attributes and by element contents:

html    → (SYMBOL content ...)
        | (SYMBOL ((SYMBOL . value) ...) content ...)

The value of an attribute may be a boolean or a list of text contents:

value   → BOOLEAN
        | (text ...)

An attribute with value #f is not serialized as HTML5; an attribute with value #t 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:

content → text
        | html



procedure: (js-encode string)

Replace dangerous characters in the string by backslash escape sequences. The result is safe to include in a JavaScript string between single or double quotes.

procedure: (html-tag-rule tag)

procedure: (html-tag-rule tag rule)

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

procedure: (write-html html)

procedure: (write-html html port)

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