Formatting of text requires to use additional informative functions on specific contexts only relevant for text. User defined functions should convert the text according to the context.
Each context is associated with a function:
$in_code =
$converter->in_code ()
¶Return true if in code context. See Init File Expansion Contexts: Normal, Preformatted, Code, String, Math.
$in_math =
$converter->in_math ()
¶Return true if in math context. See Init File Expansion Contexts: Normal, Preformatted, Code, String, Math.
$in_raw =
$converter->in_raw ()
¶Return true if in raw format, in @inlineraw
or in @html
.
In such a context, text should be kept as is and special HTML characters should
not be protected.
$in_verbatim =
$converter->in_verbatim ()
¶Return true if in verbatim context, corresponding to @verb
and @verbatim
.
In general, HTML characters should be protected in this context.
$in_upper_case =
$converter->in_upper_case ()
¶Return true if in upper-case context, corresponding to @sc
.
$in_non_breakable_space =
$converter->in_non_breakable_space ()
¶Return true if in context where line breaks are forbidden, corresponding
to @w
.
$in_space_protected =
$converter->in_space_protected ()
¶Return true if in context where space and newline characters are kept,
corresponding to @verb
.