Module:UtilsMarkup/Format/Documentation

From Zelda Wiki, the Zelda encyclopedia
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

#InputOutputResultStatus
1
bold("Fooloo Limpah")
"<b>Fooloo Limpah</b>"
Fooloo Limpah
Green check.svg

class

class(class, text)

Returns

  • Text wrapped in a span tag with the given class string.

Examples

#InputOutputResultStatus
2
class("term error", "Fooloo Limpah")
'<span class="term error">Fooloo Limpah</span>'
Fooloo Limpah
Green check.svg

code

code(text)

Parameters

  • text
    The text to render monospaced.

Returns

  • The formatted text.

Examples

#InputOutputResultStatus
3
code("code stuff")
"<code>code stuff</code>"
code stuff
Green check.svg

heading

heading(level, text)

Parameters

Returns

  • string of text for the heading

Examples

#InputOutputStatus
4
heading(2, "Section")
"\n==Section==\n"
Green check.svg
5
heading(3, "Sub-section")
"\n===Sub-section===\n"
Green check.svg

italic

italic(text)

Parameters

  • text
    The text to italicize.

Returns

  • The italicized text.

Examples

#InputOutputResultStatus
6
italic("Fooloo Limpah")
"<i>Fooloo Limpah</i>"
Fooloo Limpah
Green check.svg

inline

inline(text, [options])

Parameters

Returns

  • The formatted text.

Examples

#InputOutputResultStatus
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
Green check.svg
8
inline(
  "{{Foo}}",
  {
    bold = true,
    nowiki = true,
    code = true,
  }
)
"<b><code>&#38;#123;&#38;#123;Foo&#38;#125;&#38;#125;</code></b>"
{{Foo}}
Green check.svg

lua

lua(text, [options])

Parameters

Returns

  • A block of pre-formatted, syntax-highlighted Lua code

Examples

#InputResult
9
lua("function(foo) \n\t\treturn foo\n\tend")
function(foo) 
		return foo
	end

pre

pre(text, [options])

Parameters

Returns

  • A block of pre-formatted text.

Examples

#InputResult
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

#InputOutputStatus
11
separateMarkup("Some Text <sup>Some Markup</sup>")
"Some Text"
Green check.svg
" <sup>Some Markup</sup>"
Green check.svg
12
separateMarkup("Some Text")
"Some Text"
Green check.svg
""
Green check.svg

tooltip

tooltip(baseText, tooltipText, type)

Parameters

Returns

  • Text with a tooltip.

Examples

#InputOutputResultStatus
13
tooltip("hover over me", "hello world!", nil)
'<span title="hello world!" class="tooltip">hover over me</span>'
hover over me
Green check.svg