File "markup"
This file provides predicates to generate markup. This is done
through filtered streams that automatically escape plain text. We
provide markup streams that are either piggy backed on ordinary
streams, or piggy backed on a DOM elements or are not piggy backed
at all. The escaping can be bypassed by the predicates tag/[1,2]
and tag_format/[2,3].
Markup streams on a DOM elements do not attempt at pretty
printing by inserting newlines and spaces depending on the given
tag. They go trough a state machine to track the current DOM
element and leave the interpretation completely to the browser.
Markup streams that are not piggy backed attempt a translation to
ASCII escape sequences.
The following markup predicates are provided:
- tag_length(A, N):
- The predicate succeeds in N with the length of the text inside
the XML markup A. Given whitespace is counted but no extra
whitespace is added for pretty printing.
- tag(M):
- tag(W, A):
- The predicate emits the XML markup A. The binary predicate
allows specifying an ANSI terminal, a DOM destination or a
markup writer W.
- tag_format(T, L):
- tag_format(W, T, L):
- The predicate emits the XML markup that results from
formatting the arguments L with the template T. The binary
predicate allows specifying an ANSI terminal, a DOM destination
or a markup writer W.
- dom_output_new(S, W):
- The predicate succeeds in W with a new markup writer to the
stream S.
- xml_escape(T, E):
- The predicate succeeds when E unifies with the text escape of
T.
- percent_encode(T, E):
- The predicate succeeds when E unifies with the percent encode
of T.