7.5 Decoding Text
At the flow level, decoding recognizes a blank line as a
paragraph separator. Blocks and paragraphs without blank lines
in between are collected into a compound paragraph.
At the content level, decoding
makes just a few special text conversions:
---: converted to 'mdash
--: converted to 'ndash
``: converted to 'ldquo, which is fancy open quotes: “
'': converted to 'rdquo, which is fancy closing quotes: ”
': converted to 'rsquo, which is a fancy apostrophe: ’
Some functions decode a sequence of pre-flow or
pre-content arguments using decode-flow or
decode-content, respectively. For example, the bold
function accepts any number of pre-content arguments, so
that in
the ``apple'' argument is decoded to use fancy quotes, and
then it is bolded.
Returns
#t if
v is a
pre-content value: a
string or other non-list
content, a list of
pre-content values, or a
splice
containing a list of
pre-content values; otherwise returns
#f.
Pre-content is decoded into content by functions like
decode-content and decode-paragraph.
Returns
#t if
v is a
pre-flow value: a
string or other non-list
content, a
block,
#<void>, a list of
pre-flow values, or a
splice containing a list of
pre-flow values; otherwise returns
#f.
Pre-flow is decoded into a flow (i.e., a list of blocks)
by functions like decode-flow.
Returns
#t if
v is a
pre-part value: a
string or other non-list
content, a
block, a
part, a
title-decl, a
part-start, a
part-index-decl, a
part-collect-decl, a
part-tag-decl,
#<void>, a list of
pre-part values, or a
splice containing
a list of
pre-part values; otherwise returns
#f.
A pre-part sequence is decoded into a part by functions like
decode and decode-part.
Decodes a document, producing a part. In
lst, lists and instances of
splice are inlined into the list, and
#<void>s are dropped. An instance of
title-decl supplies the title for the part, plus tag, style
and version information. Instances of
part-index-decl (that
precede any sub-part) add index entries that point to the
section. Instances of
part-collect-decl add elements to the
part that are used only during the
collect pass. Instances
of
part-tag-decl add hyperlink tags to the section
title. Instances of
part-start at level 0 trigger sub-part
parsing. Instances of
section trigger are used as-is as
subsections, and instances of
paragraph and other
flow-element datatypes are used as-is in the enclosing flow.
Portions of lst are within a part are decoded using
decode-flow.
Like
decode, but given a list of tag string for the part, a
title (if
#f, then a
title-decl instance is used if
found), and a depth for
part-starts to trigger sub-part
parsing.
Decodes a flow. In
lst, lists and instances of
splice are inlined into the list. A sequence of two or more
newlines separated only by whitespace is parsed as a
compound-paragraph separator.
Portions of lst are within a compound paragraph are decoded using
decode-compound-paragraph.
Decodes a compound paragraph. In
lst, lists and instances of
splice are inlined into the list. Instances of
paragraph and other
block datatypes are used as-is in
the result. If the compound paragraph contains a single block, the
block is returned without a
compound-paragraph wrapper.
Portions of lst that are separated by blocks are
decoded using decode-content.
Decodes a paragraph using
decode-content to decode
lst as the paragraph’s content.
Decodes
content. Lists and splices in
lst are
flattened into the list. Plain strings are
decoded; non-string, non-list
content is included in
the result as-is.
Returns #t if s contains only whitespace, #f
otherwise.
Trims leading and trailing whitespace, and converts non-empty
sequences of whitespace to a single space character.