Module:UtilsMarkup/Format/Documentation
< Module:UtilsMarkup | Format
Jump to navigation
Jump to search
This is the documentation page for Module:UtilsMarkup/Format
This module exports the following functions.
bold
bold(text)
Parameters
text
- The text to bold.
Returns
- The bolded text.
Examples
# | Input | Output | Result | Status |
---|---|---|---|---|
1 | bold("Fooloo Limpah")
| "<b>Fooloo Limpah</b>"
| Fooloo Limpah |
class
class(class, text)
Returns
- Text wrapped in a span tag with the given class string.
Examples
# | Input | Output | Result | Status |
---|---|---|---|---|
2 | class("term error", "Fooloo Limpah")
| '<span class="term error">Fooloo Limpah</span>'
| Fooloo Limpah |
code
code(text)
Parameters
text
- The text to render monospaced.
Returns
- The formatted text.
Examples
# | Input | Output | Result | Status |
---|---|---|---|---|
3 | code("code stuff")
| "<code>code stuff</code>"
| code stuff |
heading
heading(level, text)
Parameters
Returns
string
of text for the heading
Examples
# | Input | Output | Status |
---|---|---|---|
4 | heading(2, "Section")
| "\n==Section==\n"
| |
5 | heading(3, "Sub-section")
| "\n===Sub-section===\n"
|
italic
italic(text)
Parameters
text
- The text to italicize.
Returns
- The italicized text.
Examples
# | Input | Output | Result | Status |
---|---|---|---|---|
6 | italic("Fooloo Limpah")
| "<i>Fooloo Limpah</i>"
| Fooloo Limpah |
inline
inline(text, [options])
Parameters
Returns
- The formatted text.
Examples
# | Input | Output | Result | Status |
---|---|---|---|---|
7 | inline(
"Fooloo Limpah",
{
bold = true,
italic = true,
class = "error",
tooltip = "Don't steal them!",
}
)
| "<span class=\"error\"><span title=\"Don't steal them!\" class=\"tooltip\"><b><i>Fooloo Limpah</i></b></span></span>"
| Fooloo Limpah | |
8 | inline(
"{{Foo}}",
{
bold = true,
nowiki = true,
code = true,
}
)
| "<b><code>&#123;&#123;Foo&#125;&#125;</code></b>"
| {{Foo}} |
lua
lua(text, [options])
Parameters
text
- A string of text to format as Lua code.
[options]
[wrapLines=true]
- If set to
false
, prevents lines from wrapping by setting white-space topre
.
Returns
- A block of pre-formatted, syntax-highlighted Lua code
Examples
# | Input | Result |
---|---|---|
9 | lua("function(foo) \n\t\treturn foo\n\tend")
| function(foo)
return foo
end
|
pre
pre(text, [options])
Parameters
text
- Text to render as preformatted.
[options]
[wrapLines=true]
- If set to
false
, prevents lines from wrapping by setting white-space topre
.
Returns
- A block of pre-formatted text.
Examples
# | Input | Result |
---|---|---|
10 | pre("{{List\n\t |foo\n\t |bar\n\t |baz\n\t}}")
| {{List |foo |bar |baz }} |
separateMarkup
separateMarkup(text)
Separates plain text from any wikitext markup that follows it. Used by list templates such as Template:Term List, Template:Gallery List, Template:Wares, etc.
Returns
text
with trailing markup stripped off- Any trailing markup from
text
, or an empty string if there is none.
Examples
# | Input | Output | Status |
---|---|---|---|
11 | separateMarkup("Some Text <sup>Some Markup</sup>")
| "Some Text"
| |
" <sup>Some Markup</sup>"
| |||
12 | separateMarkup("Some Text")
| "Some Text"
| |
""
|
tooltip
tooltip(baseText, tooltipText, type)
Parameters
baseText
- The text to receive a tooltip.
tooltipText
- The text to display on hover.
Returns
- Text with a tooltip.
Examples
# | Input | Output | Result | Status |
---|---|---|---|---|
13 | tooltip("hover over me", "hello world!", nil)
| '<span title="hello world!" class="tooltip">hover over me</span>'
| hover over me |