6.5 Decoding Text
(require scribble/decode) | package: scribble-lib |
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: ’
`: converted to 'lsquo, which is a fancy quote: ‘
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
@bold{``apple''} |
the ``apple'' argument is decoded to use fancy quotes, and then it is bolded.
procedure
(pre-content? v) → boolean?
v : any/c
Pre-content is decoded into content by functions like decode-content and decode-paragraph.
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.
Portions of lst are within a part are decoded using decode-flow.
procedure
(decode-part lst tags title depth) → part?
lst : (listof pre-part?) tags : (listof string?) title : (or/c #f list?) depth : exact-nonnegative-integer?
procedure
(decode-flow lst) → (listof block?)
lst : (listof pre-flow?)
Portions of lst are within a compound paragraph are decoded using decode-compound-paragraph.
procedure
(decode-compound-paragraph lst) → block?
lst : (listof pre-flow?)
Portions of lst that are separated by blocks are decoded using decode-content.
procedure
(decode-paragraph lst) → paragraph?
lst : (listof pre-content?)
procedure
(decode-content lst) → list?
lst : (listof pre-content?)
procedure
(decode-elements lst) → list?
lst : (listof pre-content?)
procedure
(decode-string s) → (listof content?)
s : string?
procedure
(whitespace? v) → boolean?
v : any/c
struct
(struct title-decl (tag-prefix tags version style content) #:extra-constructor-name make-title-decl) tag-prefix : (or/c #f string?) tags : (listof string?) version : (or/c string? #f) style : style? content : content?
struct
(struct part-start (depth tag-prefix tags style title) #:extra-constructor-name make-part-start) depth : integer? tag-prefix : (or/c #f string?) tags : (listof string?) style : style? title : content?
struct
(struct part-index-decl (plain-seq entry-seq) #:extra-constructor-name make-part-index-decl) plain-seq : (listof string?) entry-seq : list?
struct
(struct part-collect-decl (element) #:extra-constructor-name make-part-collect-decl) element : (or/c element? part-relative-element?)
struct
(struct part-tag-decl (tag) #:extra-constructor-name make-part-tag-decl) tag : tag?
struct
(struct splice (run) #:extra-constructor-name make-splice) run : list?
procedure
(spliceof ctc) → flat-contract?
ctc : flat-contract?
procedure
(clean-up-index-string str) → string?
str : string?