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, 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>, 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.
A pre-part sequence is decoded into a part by functions like
decode and decode-part.
Decodes a document, producing a part. In
lst, instances of
splice are inlined into the list. 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.
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. A sequence of two or more newlines separated only by
whitespace counts is parsed as a paragraph separator. In
lst,
instances of
splice are inlined into the list. Instances of
paragraph and other flow-element datatypes are used as-is in
the enclosing flow.
Decodes a compound paragraph. If the compound paragraph contains a
single block, the block is returned without a
compound-paragraph wrapper.
Decodes a paragraph.
Decodes a single string to produce
content.
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.