typographicalOutputFilterobjectoutput.t[1887]

Typographical effects output filter. This filter looks for certain sequences in the text and converts them to typographical equivalents. Authors could simply write the HTML for the typographical markups in the first place, but it's easier to write the typewriter-like sequences and let this filter convert to HTML.

We perform the following conversions:

'---' -> &zwnbsp;—
'--' -> &zwnbsp;–
sentence-ending punctuation -> same +  

Since this routine is called so frequently, we hard-code the replacement strings, rather than using properties, for slightly faster performance. Since this routine is so simple, games that want to customize the replacement style should simply replace this entire routine with a new routine that applies the customizations.

Note that we define this filter in the English-specific part of the library, because it seems almost certain that each language will want to customize it for local conventions.

typographicalOutputFilter :   OutputFilter

Superclass Tree   (in declaration order)

typographicalOutputFilter
        OutputFilter
                object

Summary of Properties  

abbreviations  abbrevPat  eosPattern  sentenceSpacer 

Summary of Methods  

filterText 

Properties  

abbreviationsoutput.t[1975]

Common abbreviations. These are excluded from being treated as sentence endings when they appear with a trailing period.

Note that abbrevPat must be rebuilt manually if you change this on the fly - abbrevPat is static, so it picks up the initial value of this property at start-up, and doesn't re-evaluate it while the game is running.

abbrevPatoutput.t[1963]
pattern for abbreviations that were mistaken for sentence endings

eosPatternoutput.t[1950]
The end-of-sentence pattern. This looks a bit complicated, but all we're looking for is a period, exclamation point, or question mark, optionally followed by any number of closing group marks (right parentheses or square brackets, closing HTML tags, or double or single quotes in either straight or curly styles), all followed by an ordinary space.

If a lower-case letter follows the space, though, we won't consider it a sentence ending. This applies most commonly after quoted passages ending with what would normally be sentence-ending punctuation: "'Who are you?' he asked." In these cases, the enclosing sentence isn't ending, so we don't want the extra space. We can tell the enclosing sentence isn't ending because a non-capital letter follows.

Note that we specifically look only for ordinary spaces. Any sentence-ending punctuation that's followed by a quoted space or any typographical space overrides this substitution.

sentenceSpaceroutput.t[1928]
The character to use between a full stop and the start of the next sentence. By default we use an n-space.

Methods  

filterText (ostr, val)OVERRIDDENoutput.t[1888]

no description available

Adv3Lite Library Reference Manual
Generated on 03/07/2024 from adv3Lite version 2.1