Wikitext parsing and processing utilities.
- Source:
Methods
(static) brsToNewlines(code, replacement) → {string}
- Source:
Replace <br>
s with \n
, except in list elements and <pre>
's created by a space starting a
line.
Parameters:
Name | Type | Description |
---|---|---|
code |
string | |
replacement |
string |
Returns:
- Type
- string
(static) encodeWikilink(link) → {string}
- Source:
Encode text to put it in a [[wikilink]]
. This is meant for section links as the characters that
this function encodes are forbidden in page titles anyway, so page titles containing them are not
valid titles.
Parameters:
Name | Type | Description |
---|---|---|
link |
string |
Returns:
- Type
- string
(static) endWithTwoNewlines(code) → {string}
- Source:
Modify a string or leave it unchanged so that is has two newlines at the end of it. (Meant for section wikitext.)
Parameters:
Name | Type | Description |
---|---|---|
code |
string |
Returns:
- Type
- string
(static) escapePipesOutsideLinks(code, maskedTextsopt) → {string}
- Source:
Mask links that have |
, replace |
with {{!}}
, unmask links. If maskedTexts
is not
provided, sensitive code will be masked as well.
Also masks bare {
and }
that weren't identified as part of other markup (e.g. try quoting the
sentence "Или держал в голове то, что практика использования {{doc/begin}} ... делали
- "