This module contains testcases for its parent module, Docbunto.
See also
-- @see [[Module talk:Docbunto/testcases]]
-- <nowiki>
local unindent = require('Dev:Unindent')
return {
main = {
options = {
mode = 'invocation',
preprocess = true,
template = true
},
tests = {
-- content check
{
'DEV/NULL',
'Lua source code not found in Module:DEV/NULL',
{ err = true }
},
-- markup check
{
'Codedoc/testdata',
'documentation markup for Docbunto not found in Module:Codedoc/testdata',
{ err = true }
},
-- basic functionality
{
'Docbunto/testcases/Basic|code = 1|verbose = 1',
unindent [=[
<h3>Package function</h3>
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Basic#L-17|<code id="ldoc">ldoc(options)</code>]]</span> ([[Lua reference manual#function|function]])
:Item summary. The item description follows. Information provided by the item comment can be formatted with both '''MediaWiki''' and <b>Markdown</b> syntax. The comments can generally span multiple lines.
:By leaving empty comment lines, a new paragraph can be made in the documentation. This can be used to give longer explanations whitespace.
:<b>Parameters</b>:
::<code id="ldoc~options">options</code> Configuration options. ([[Lua reference manual#table|table]])
:::<code id="ldoc~options.file">options.file</code> Target file. ([[Lua reference manual#string|string]])
:::<code id="ldoc~options.filter">options.filter</code> Output filter. ([[Lua reference manual#string|string]]; optional)
:::<code id="ldoc~options.dump">options.dump</code> Text output to console. ([[Lua reference manual#boolean|boolean]]; optional)
:<b>Returns</b>: Compiled documentation. ([[Lua reference manual#string|string]])
<templatestyles src="Module:Docbunto/styles.css"></templatestyles>
]=]
},
-- self-documentation and `options.simple`
{
'Docbunto|simple = 1',
unindent [=[
__NOEDITSECTION__<b>Docbunto</b> is an automatic documentation generator for Scribunto modules. The module is based on LuaDoc and LDoc. It produces documentation in the form of MediaWiki markup, using <code><nowiki>@tag</nowiki></code>-prefixed comments embedded in the source code of a Scribunto module. The taglet parser & doclet renderer Docbunto uses are also publicly exposed to other modules.
Docbunto code items are introduced by a block comment (<code><nowiki>--[[]]--</nowiki></code>), an inline comment with three hyphens (<code><nowiki>---</nowiki></code>), or an inline <code><nowiki>@tag</nowiki></code> comment. The module can use static code analysis to infer variable names, item privacy (<code><nowiki>local</nowiki></code> keyword), tables (<code><nowiki>{}</nowiki></code> constructor) and functions (<code><nowiki>function</nowiki></code> keyword). MediaWiki and Markdown formatting is supported.
Items are usually rendered in the order they are defined, if they are public items, or emulated classes extending the Lua primitives. There are many customisation options available to change Docbunto behaviour.
<h2>Documentation</h2>
<h3>Package items</h3>
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1071|<code id="docbunto._main">docbunto._main(f)</code>]]</span> ([[Lua reference manual#function|function]])
:Template entrypoint for [[Template:Docbunto]].
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1105|<code id="docbunto.main">docbunto.main(frame)</code>]]</span> ([[Lua reference manual#function|function]])
:Entrypoint for the module.
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1111|<code id="docbunto.build">docbunto.build(<span style="opacity:0.65">modname</span><span style="opacity:0.65">, options</span>)</code>]]</span> ([[Lua reference manual#function|function]])
:Scribunto documentation generator entrypoint.
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1126|<code id="docbunto.taglet">docbunto.taglet(<span style="opacity:0.65">modname</span><span style="opacity:0.65">, options</span>)</code>]]</span> ([[Lua reference manual#function|function]])
:Docbunto taglet parser for Scribunto modules.
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1637|<code id="docbunto.doclet">docbunto.doclet(data<span style="opacity:0.65">, options</span>)</code>]]</span> ([[Lua reference manual#function|function]])
:Doclet renderer for Docbunto taglet data.
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-2136|<code id="docbunto.tags">docbunto.tags</code>]]</span> ([[Lua reference manual#table|table]])
:Token dictionary for Docbunto tags. Maps Docbunto tag names to tag tokens.
:* Multi-line tags use the <code><nowiki>'M'</nowiki></code> token.
:* Multi-line preformatted tags use the <code><nowiki>'ML'</nowiki></code> token.
:* Identifier tags use the <code><nowiki>'ID'</nowiki></code> token.
:* Single-line tags use the <code><nowiki>'S'</nowiki></code> token.
:* Flags use the <code><nowiki>'N'</nowiki></code> token.
:* Type tags use the <code><nowiki>'T'</nowiki></code> token.
<h3>Other items</h3>
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-62|<code id="options">options</code>]]</span> ([[Lua reference manual#table|table]])
:Configuration options.
<templatestyles src="Module:Docbunto/styles.css"></templatestyles>
]=]
},
-- default title
{
'code = 1|simple = 1',
unindent [=[
<h3>Package items</h3>
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1071|<code id="docbunto._main">docbunto._main(f)</code>]]</span> ([[Lua reference manual#function|function]])
:Template entrypoint for [[Template:Docbunto]].
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1105|<code id="docbunto.main">docbunto.main(frame)</code>]]</span> ([[Lua reference manual#function|function]])
:Entrypoint for the module.
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1111|<code id="docbunto.build">docbunto.build(<span style="opacity:0.65">modname</span><span style="opacity:0.65">, options</span>)</code>]]</span> ([[Lua reference manual#function|function]])
:Scribunto documentation generator entrypoint.
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1126|<code id="docbunto.taglet">docbunto.taglet(<span style="opacity:0.65">modname</span><span style="opacity:0.65">, options</span>)</code>]]</span> ([[Lua reference manual#function|function]])
:Docbunto taglet parser for Scribunto modules.
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1637|<code id="docbunto.doclet">docbunto.doclet(data<span style="opacity:0.65">, options</span>)</code>]]</span> ([[Lua reference manual#function|function]])
:Doclet renderer for Docbunto taglet data.
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-2136|<code id="docbunto.tags">docbunto.tags</code>]]</span> ([[Lua reference manual#table|table]])
:Token dictionary for Docbunto tags. Maps Docbunto tag names to tag tokens.
:* Multi-line tags use the <code><nowiki>'M'</nowiki></code> token.
:* Multi-line preformatted tags use the <code><nowiki>'ML'</nowiki></code> token.
:* Identifier tags use the <code><nowiki>'ID'</nowiki></code> token.
:* Single-line tags use the <code><nowiki>'S'</nowiki></code> token.
:* Flags use the <code><nowiki>'N'</nowiki></code> token.
:* Type tags use the <code><nowiki>'T'</nowiki></code> token.
<h3>Other items</h3>
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-62|<code id="options">options</code>]]</span> ([[Lua reference manual#table|table]])
:Configuration options.
<templatestyles src="Module:Docbunto/styles.css"></templatestyles>
]=]
},
-- `options.card` and `options.footer`
{
'Docbunto|box = 0|card = 1|footer = 1',
unindent [=[
__NOEDITSECTION__<b>Docbunto</b> is an automatic documentation generator for Scribunto modules. The module is based on LuaDoc and LDoc. It produces documentation in the form of MediaWiki markup, using <code><nowiki>@tag</nowiki></code>-prefixed comments embedded in the source code of a Scribunto module. The taglet parser & doclet renderer Docbunto uses are also publicly exposed to other modules.
Docbunto code items are introduced by a block comment (<code><nowiki>--[[]]--</nowiki></code>), an inline comment with three hyphens (<code><nowiki>---</nowiki></code>), or an inline <code><nowiki>@tag</nowiki></code> comment. The module can use static code analysis to infer variable names, item privacy (<code><nowiki>local</nowiki></code> keyword), tables (<code><nowiki>{}</nowiki></code> constructor) and functions (<code><nowiki>function</nowiki></code> keyword). MediaWiki and Markdown formatting is supported.
Items are usually rendered in the order they are defined, if they are public items, or emulated classes extending the Lua primitives. There are many customisation options available to change Docbunto behaviour.
<h2>Documentation</h2>
<h3>Package items</h3>
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1071|<code id="docbunto._main">docbunto._main(f)</code>]]</span> ([[Lua reference manual#function|function]])
:Template entrypoint for [[Template:Docbunto]].
:<b>Parameter</b>: <code id="docbunto._main~f">f</code> Scribunto frame object. ([[Lua reference manual/Scribunto libraries#Frame object|Frame]])
:<b>Returns</b>: Module documentation output. ([[Lua reference manual#string|string]])
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1105|<code id="docbunto.main">docbunto.main(frame)</code>]]</span> ([[Lua reference manual#function|function]])
:Entrypoint for the module.
:<b>Parameter</b>: <code id="docbunto.main~frame">frame</code> Module frame. ([[Lua reference manual#table|table]])
:<b>Returns</b>: Module documentation output. ([[Lua reference manual#string|string]])
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1111|<code id="docbunto.build">docbunto.build(<span style="opacity:0.65">modname</span><span style="opacity:0.65">, options</span>)</code>]]</span> ([[Lua reference manual#function|function]])
:Scribunto documentation generator entrypoint.
:<b>Parameters</b>:
::<code id="docbunto.build~modname">modname</code> Module page name (without namespace). Default: second-level subpage. ([[Lua reference manual#string|string]]; optional)
::<code id="docbunto.build~options">options</code> Configuration options. ([[#options|options]]; optional)
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1126|<code id="docbunto.taglet">docbunto.taglet(<span style="opacity:0.65">modname</span><span style="opacity:0.65">, options</span>)</code>]]</span> ([[Lua reference manual#function|function]])
:Docbunto taglet parser for Scribunto modules.
:<b>Parameters</b>:
::<code id="docbunto.taglet~modname">modname</code> Module page name (without namespace). ([[Lua reference manual#string|string]]; optional)
::<code id="docbunto.taglet~options">options</code> Configuration options. ([[#options|options]]; optional)
:<b>Errors</b>:
::'Lua source code not found in $1' ([[Module:Docbunto#L-1144|line 1144]])
::'documentation markup for Docbunto not found in $1' ([[Module:Docbunto#L-1154|line 1154]])
:<b>Returns</b>: Module documentation data. ([[Lua reference manual#table|table]])
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1637|<code id="docbunto.doclet">docbunto.doclet(data<span style="opacity:0.65">, options</span>)</code>]]</span> ([[Lua reference manual#function|function]])
:Doclet renderer for Docbunto taglet data.
:<b>Parameters</b>:
::<code id="docbunto.doclet~data">data</code> Taglet documentation data. ([[Lua reference manual#table|table]])
::<code id="docbunto.doclet~options">options</code> Configuration options. ([[#options|options]]; optional)
:<b>Returns</b>: Wikitext documentation output. ([[Lua reference manual#string|string]])
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-2136|<code id="docbunto.tags">docbunto.tags</code>]]</span> ([[Lua reference manual#table|table]])
:Token dictionary for Docbunto tags. Maps Docbunto tag names to tag tokens.
:* Multi-line tags use the <code><nowiki>'M'</nowiki></code> token.
:* Multi-line preformatted tags use the <code><nowiki>'ML'</nowiki></code> token.
:* Identifier tags use the <code><nowiki>'ID'</nowiki></code> token.
:* Single-line tags use the <code><nowiki>'S'</nowiki></code> token.
:* Flags use the <code><nowiki>'N'</nowiki></code> token.
:* Type tags use the <code><nowiki>'T'</nowiki></code> token.
<h3>Other items</h3>
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-62|<code id="options">options</code>]]</span> ([[Lua reference manual#table|table]])
:Configuration options.
:<b>Fields</b>:
:::<code id="options~options.all">options.all</code> Include local items in documentation. ([[Lua reference manual#boolean|boolean]]; optional)
:::<code id="options~options.autodoc">options.autodoc</code> Whether the module is being called to automatically provide missing documentation. ([[Lua reference manual#boolean|boolean]]; optional)
:::<code id="options~options.boilerplate">options.boilerplate</code> Removal of boilerplate (license block comments). ([[Lua reference manual#boolean|boolean]]; optional)
:::<code id="options~options.caption">options.caption</code> Infobox image caption. ([[Lua reference manual#string|string]]; optional)
:::<code id="options~options.code">options.code</code> Only document Docbunto code items - exclude article infobox and lede from rendered documentation. Permits article to be edited in VisualEditor. ([[Lua reference manual#boolean|boolean]]; optional)
:::<code id="options~options.colon">options.colon</code> Format tags with a <code><nowiki>:</nowiki></code> suffix and without the <code><nowiki>@</nowiki></code> prefix. This bypasses the "doctag soup" some authors complain of. ([[Lua reference manual#boolean|boolean]]; optional)
:::<code id="options~options.image">options.image</code> Infobox image. ([[Lua reference manual#string|string]]; optional)
:::<code id="options~options.box">options.box</code> Include infobox in output. ([[Lua reference manual#boolean|boolean]]; optional)
:::<code id="options~options.footer">options.footer</code> Append a horizontal line & "generated by Docbunto" to the bottom of the output. ([[Lua reference manual#boolean|boolean]]; optional)
:::<code id="options~options.noluaref">options.noluaref</code> Don't link to the [[Lua reference manual]] for types. ([[Lua reference manual#boolean|boolean]]; optional)
:::<code id="options~options.card">options.card</code> Include endmatter card in the output at the end of the documentation. ([[Lua reference manual#boolean|boolean]]; optional)
:::<code id="options~options.plain">options.plain</code> Disable Markdown formatting in documentation. ([[Lua reference manual#boolean|boolean]]; optional)
:::<code id="options~options.preface">options.preface</code> Preface text to insert between lede & item documentation, used to provide usage and code examples. ([[Lua reference manual#string|string]]; optional)
:::<code id="options~options.simple">options.simple</code> Limit documentation to descriptions only. Removes documentation of subitem tags such as <code><nowiki>@param</nowiki></code> and <code><nowiki>@field</nowiki></code> ([[#Item subtags|see list]]). ([[Lua reference manual#boolean|boolean]]; optional)
:::<code id="options~options.sort">options.sort</code> Sort documentation items in alphabetical order. ([[Lua reference manual#boolean|boolean]]; optional)
:::<code id="options~options.strip">options.strip</code> Remove table index in documentation. ([[Lua reference manual#boolean|boolean]]; optional)
:::<code id="options~options.subst">options.subst</code> Don't preprocess code output before the documentation is outputted e.g. <code><nowiki>subst</nowiki></code>. ([[Lua reference manual#boolean|boolean]]; optional)
:::<code id="options~options.ulist">options.ulist</code> Indent subitems as <code><nowiki><ul></nowiki></code> lists (LDoc/JSDoc behaviour). ([[Lua reference manual#boolean|boolean]]; optional)
:::<code id="options~options.verbose">options.verbose</code> Show the code description of a package function when documenting function modules. ([[Lua reference manual#boolean|boolean]]; optional)
<hr />
Generated by [[w:c:dev:Global Lua Modules/Docbunto|Docbunto]].
<table class="wikitable" style="width:75%;margin:0 auto 1em auto">
<caption>Module information card (autogenerated)</caption>
<tr><th scope="col">Name</th><th scope="col">Value</th></tr>
<tr><td scope="row">Image</td><td align="center">[[File:Docbunto.svg|270px|center]]</td></tr>
<tr><td scope="row">Variable</td><td align="center"><h1><b><code>docbunto</code></b></h1></td></tr><tr><td>Code</td><td>[[Module:Docbunto]]</td></tr>
<tr><td scope="row">Release status</td><td>stable</td></tr>
<tr><td scope="row">Description</td><td>Docbunto is an automatic documentation generator for Scribunto modules.</td></tr>
<tr><td scope="row">Author(s)</td><td>
* [[User:8nml|8nml]]
* [[User:TheReelDevs|TheReelDevs]]</td></tr>
<tr><td scope="row">Using code by</td><td>[[github:stevedonovan|@stevedonovan]] ([[github:stevedonovan/LDoc|Github]])</td></tr>
<tr><td scope="row">Dependencies</td><td>
* [[Module:I18n]]
* [[Module:Lexer]]
* [[Module:T]]
* [[Module:Unindent]]
* [[Module:Yesno]]</td></tr>
<tr><td scope="row">Language support</td><td>{{Language list| source-lua = Module:Docbunto/i18n | nocat = }}</td></tr>
</table><templatestyles src="Module:Docbunto/styles.css"></templatestyles>
]=]
},
-- `options.code`
{
'Docbunto/testcases/Classmod|code = 1',
unindent [=[
<h3>Package items</h3>
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Classmod#L-14|<code id="Color.tup">Color.tup</code>]]</span> ([[Lua reference manual#table|table]])
:Color tuple.
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Classmod#L-18|<code id="Color.typ">Color.typ</code>]]</span> (member • [[Lua reference manual#string|string]])
:Color space type.
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Classmod#L-22|<code id="Color.alp">Color.alp</code>]]</span> (member • [[Lua reference manual#number|number]])
:Color alpha channel value.
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Classmod#L-26|<code id="Color:new">Color:new(typ, tup, alp)</code>]]</span> ([[Lua reference manual#function|function]] • constructor)
:Color instance constructor.
:<b>Parameters</b>:
::<code id="Color:new~typ">typ</code> Color space type (<code><nowiki>'hsl'</nowiki></code> or <code><nowiki>'rgb'</nowiki></code>). ([[Lua reference manual#string|string]])
::<code id="Color:new~tup">tup</code> Color tuple in HSL or RGB ([[Lua reference manual#table|table]])
::<code id="Color:new~alp">alp</code> Alpha value range (<code><nowiki>0</nowiki></code> - <code><nowiki>1</nowiki></code>). ([[Lua reference manual#number|number]])
:<b>Errors</b>:
::'no color data provided' ([[Module:Docbunto/testcases/Classmod#L-304|line 304]])
::'invalid color type "$1" specified' ([[Module:Docbunto/testcases/Classmod#L-309|line 309]])
:<b>Returns</b>: Color instance. ([[#Color|Color]])
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Classmod#L-61|<code id="Color:string">Color:string()</code>]]</span> ([[Lua reference manual#function|function]])
:Color string default output.
:<b>Returns</b>: Hexadecimal 6-digit or HSLA color string. ([[Lua reference manual#string|string]])
:<b>Usage</b>:
::<syntaxhighlight lang="lua" inline="inline">colors.parse('hsl(214, 15%, 30%)'):string() == '#404a57'</syntaxhighlight>
::<syntaxhighlight lang="lua" inline="inline">colors.parse('#404a5780'):string() == 'hsl(214, 15%, 30%, 0.5)'</syntaxhighlight>
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Classmod#L-70|<code id="Color:hex">Color:hex()</code>]]</span> ([[Lua reference manual#function|function]])
:Color hexadecimal string output.
:<b>Returns</b>: Hexadecimal color string. ([[Lua reference manual#string|string]])
:<b>Usage</b>: <syntaxhighlight lang="lua" inline="inline">colors.parse('hsl(214, 15%, 30%)'):hex() == '#404a57'</syntaxhighlight>
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Classmod#L-93|<code id="Color:rgb">Color:rgb()</code>]]</span> ([[Lua reference manual#function|function]])
:RGBA functional color string output.
:<b>Returns</b>: RGBA color string. ([[Lua reference manual#string|string]])
:<b>Usage</b>: <syntaxhighlight lang="lua" inline="inline">colors.parse('hsl(214, 15%, 30%)'):rgb() == 'rgb(64, 74, 87)'</syntaxhighlight>
:<b>See also</b>: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#rgb()_and_rgba()
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Classmod#L-106|<code id="Color:hsl">Color:hsl()</code>]]</span> ([[Lua reference manual#function|function]])
:HSL functional color string output.
:<b>Returns</b>: HSLA color string. ([[Lua reference manual#string|string]])
:<b>Usage</b>: <syntaxhighlight lang="lua" inline="inline">colors.parse('rgb(64, 74, 87)'):hsl() == 'hsl(214, 15%, 30%)'</syntaxhighlight>
:<b>See also</b>: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#hsl()_and_hsla()
<templatestyles src="Module:Docbunto/styles.css"></templatestyles>
]=]
},
-- factory and pragma support
{
'Docbunto/testcases/Factory|code = 1',
unindent [=[
<h3>Package items</h3>
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Factory#L-238|<code id="i18nf.loadMessages">i18nf.loadMessages</code>]]</span> (member)
:Loads messages from JSON files in MediaWiki namespace. The messages are wrapped in a custom interface:
:* This function parses and caches messages in the module as a Lua data table.
:* These can be accessed using the <code>[[#I18n:msg|msg]]</code> method of the returned object.
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Factory#L-267|<code id="i18nf._getMsg">i18nf._getMsg</code>]]</span> (member)
:Fetch a message from the cache of parsed i18n data.
<h3><code>Message</code></h3>
Message object, providing getter methods for messages.
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Factory#L-59|<code id="Message:parse">Message:parse</code>]]</span> (member)
:Parse wikitext links in the message and return the result.
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Factory#L-71|<code id="Message:markdown">Message:markdown</code>]]</span> (member)
:Parse markdown links in the message and return the result.
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Factory#L-107|<code id="Message:escape">Message:escape</code>]]</span> (member)
:Escape the message wikitext and return the result.
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Factory#L-115|<code id="Message:plain">Message:plain</code>]]</span> (member)
:Return the message with no processing.
<h3><code>I18n</code></h3>
I18n object, providing message getter and language setters.
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Factory#L-126|<code id="I18n:msg">I18n:msg</code>]]</span> (member • factory • constructor)
:Factory returning <code>[[#Message|Message]]</code> instance.
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Factory#L-161|<code id="I18n:useLang">I18n:useLang</code>]]</span> (member)
:I18n language setter to specificed language.
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Factory#L-169|<code id="I18n:inLang">I18n:inLang</code>]]</span> (member)
:Temporary datastore language setter to a specificed language. Only affects the next <code>[[#I18n:msg|I18n:msg]]</code> call.
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Factory#L-178|<code id="I18n:useContentLang">I18n:useContentLang</code>]]</span> (member)
:I18n language setter to <code><nowiki>wgContentLanguage</nowiki></code>.
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Factory#L-185|<code id="I18n:inContentLang">I18n:inContentLang</code>]]</span> (member)
:Temporary language setter to <code><nowiki>wgContentLanguage</nowiki></code>. Only affects the next <code>[[#I18n:msg|I18n:msg]]</code> call.
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Factory#L-193|<code id="I18n:useUserLang">I18n:useUserLang</code>]]</span> (member)
:I18n language setter to <code><nowiki>wgUserLanguage</nowiki></code>.
:<b>Note</b>: Scribunto only registers <code><nowiki>wgUserLanguage</nowiki></code> when an invocation is at the top of the call stack.
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Factory#L-202|<code id="I18n:inUserLang">I18n:inUserLang</code>]]</span> (member)
:Temporary language setter to <code><nowiki>wgUserLanguage</nowiki></code>. The message language reverts to the default language in the next <code>[[#I18n:msg|I18n:msg]]</code> call.
<h3>See also</h3>
* [[I18n-js|Original JS library]]
* [[wikipedia:Factory method pattern|"Factory method pattern" on Wikipedia]]
<templatestyles src="Module:Docbunto/styles.css"></templatestyles>
]=]
},
-- `options.boilerplate` and pragma
{
'Docbunto/testcases/Export|boilerplate = 1|code = 1',
unindent [=[
<h3>Package items</h3>
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Export#L-7|<code id="docbunto.testcases.Export[1]">docbunto.testcases.Export[1]</code>]]</span> (member)
:The ultimate subjects.
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Export#L-19|<code id="docbunto.testcases.Export.answer">docbunto.testcases.Export.answer</code>]]</span> (member)
:Answer to everything.
<templatestyles src="Module:Docbunto/styles.css"></templatestyles>
]=]
},
-- `options.colon` `options.ulist` and LDoc compatibility
{
'Docbunto/testcases/LDoc|code = 1|colon = 1|ulist = 1',
unindent [=[
<h3>Package items</h3>
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/LDoc#L-8|<code id="multiple.mul1">multiple.mul1()</code>]]</span> ([[Lua reference manual#function|function]])
:Function with return groups.
:<b>Returns</b>: Result. ([[Lua reference manual#string|string]])
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/LDoc#L-13|<code id="multiple.mul2">multiple.mul2()</code>]]</span> ([[Lua reference manual#function|function]])
:Function with return and error tag.
:<b>Error</b>: 'message'
:<b>Returns</b>: Result.
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/LDoc#L-19|<code id="multiple.mul3">multiple.mul3()</code>]]</span> ([[Lua reference manual#function|function]])
:Function with multiple error tags.
:<b>Errors</b>:
:*'not found'
:** When <code><nowiki>multiple.lua</nowiki></code> is missing in the same directory.
:*'bad format'
:** When <code><nowiki>multiple.lua</nowiki></code> contains invalid UTF-8 sequences.
:<b>Returns</b>: Result.
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/LDoc#L-28|<code id="multiple.mul4">multiple.mul4()</code>]]</span> ([[Lua reference manual#function|function]])
:Function with inline return and errors.
:<b>Errors</b>:
:*'not a string' ([[Module:Docbunto/testcases/LDoc#L-31|line 31]])
:*'zero-length string' ([[Module:Docbunto/testcases/LDoc#L-34|line 34]])
:<b>Returns</b>: Name converted to uppercase. ([[Lua reference manual#string|string]])
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/LDoc#L-44|<code id="multiple.mul5">multiple.mul5()</code>]]</span> ([[Lua reference manual#function|function]])
:Function that raises an error.
:<b>Error</b>: 'file not found'
:<b>Returns</b>: Contents of file in UTF-8 charset. ([[Lua reference manual#string|string]])
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/LDoc#L-51|<code id="multiple.mul6">multiple.mul6()</code>]]</span> ([[Lua reference manual#function|function]])
:First no-op function. Optional type specifiers are allowed in this format. Note how these types are rendered!
:<b>Returns</b>: ([[Lua reference manual#table|table]]|[[Lua reference manual#string|string]]|[[Lua reference manual#nil|nil]])
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/LDoc#L-80|<code id="multiple.mul7">multiple.mul7(name)</code>]]</span> ([[Lua reference manual#function|function]])
:A function with typed args. Note the the standard tparam aliases, and how the 'opt' and 'optchain' modifiers may also be used. If the Lua function has varargs, then you may document an indefinite number of extra arguments!
:<b>Parameter</b>: <code id="multiple.mul7~name">name</code> Person's name. ([[Lua reference manual#string|string]]|[[#Person|Person]]|[[Lua reference manual#nil|nil]])
:<b>Returns</b>: Birthday month in calendar (usually Gregorian). ([[Lua reference manual#string|string]])
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/LDoc#L-92|<code id="multiple.mul8">multiple.mul8(one<span style="opacity:0.65">, two</span>, three<span style="opacity:0.65">, ...</span>)</code>]]</span> ([[Lua reference manual#function|function]])
:Testing <code><nowiki>[opt]</nowiki></code>.
:<b>Parameters</b>:
:*<code id="multiple.mul8~one">one</code> First parameter.
:*<code id="multiple.mul8~two">two</code> Second parameter. (optional)
:*<code id="multiple.mul8~three">three</code> Third parameter.
:*<code id="multiple.mul8~...">...</code> Other parameters after/including fourth parameter. (optional)
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/LDoc#L-100|<code id="multiple.mul9">multiple.mul9()</code>]]</span> ([[Lua reference manual#function|function]])
:Third no-op function. Can always put comments inline, may be multiple.
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/LDoc#L-108|<code id="multiple.mul10">multiple.mul10(<span style="opacity:0.65">three</span>)</code>]]</span> ([[Lua reference manual#function|function]])
:Function with single optional argument.
:<b>Parameter</b>: <code id="multiple.mul10~three">three</code> Third parameter. Limitations:
:* This parameter must be greater than two.
:* This parameter must be less than four.
:* Valve can now count to this number.
: (optional)
<h3>Other items</h3>
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/LDoc#L-61|<code id="person2">person2</code>]]</span> ([[Lua reference manual#table|table]])
:Implicit table can always use <code><nowiki>:</nowiki></code> notation.
:<b>Fields</b>:
:*<code id="person2~gender">gender</code> Has an official ID number. ([[Lua reference manual#boolean|boolean]])
:*<code id="person2~sex">sex</code> One of <code><nowiki>'M'</nowiki></code> (male), <code><nowiki>'F'</nowiki></code> (female) or 'N' (N/A). ([[Lua reference manual#boolean|boolean]])
:*<code id="person2~spouse">spouse</code> Has a wife or husband. ([[Lua reference manual#boolean|boolean]])
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/LDoc#L-73|<code id="person3">person3</code>]]</span> ([[Lua reference manual#table|table]])
:Explicit table in <code><nowiki>:</nowiki></code> format.
:<b>Fields</b>:
:*<code id="person3~surname">surname</code> Person's surname. ([[Lua reference manual#string|string]])
:*<code id="person3~birthdate">birthdate</code> Person's birthdate. ([[Lua reference manual#string|string]])
:*<code id="person3~options">options</code> List of options for person - <code>[[#person2|person2]]</code>. ([[Lua reference manual#table|table]])
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/LDoc#L-116|<code id="person4">person4</code>]]</span> ([[Lua reference manual#table|table]])
:An implicit table.
:<b>Fields</b>:
:*<code id="person4~name">name</code> Name of person. ([[Lua reference manual#string|string]])
:*<code id="person4~age">age</code> Age of person. ([[Lua reference manual#number|number]])
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/LDoc#L-125|<code id="person4">person4</code>]]</span> ([[Lua reference manual#table|table]])
:An explicit table. Can use tparam aliases in table definitions.
:<b>Fields</b>:
:*<code id="person4~name">name</code> ([[Lua reference manual#string|string]])
:*<code id="person4~age">age</code> ([[Lua reference manual#number|number]])
<templatestyles src="Module:Docbunto/styles.css"></templatestyles>
]=]
},
-- function module `options.box` and `options.card`
{
'Docbunto/testcases/Function|box = 1|card = 1',
unindent [=[
__NOEDITSECTION__{{Infobox Lua
| Type = invocable
| Title = Docbunto/testcases/Function
| Code = Docbunto/testcases/Function
| Status = stable
| Author = * [[User:8nml|8nml]]
* [[User:TheReelDevs|TheReelDevs]]
| Description = Delay the execution of a function by t seconds.
}}
Delay the execution of a function by t seconds.
<h2>Documentation</h2>
<h3>Package function</h3>
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Function#L-35|<code id="delay">delay(fn, t)</code>]]</span> ([[Lua reference manual#function|function]])
:Delay the execution of a function by t seconds.
:<b>Parameters</b>:
::<code id="delay~fn">fn</code> The function to execute after the delay. ([[Lua reference manual#function|function]])
::<code id="delay~t">t</code> The delay in seconds before executing the function. ([[Lua reference manual#number|number]])
:<b>Returns</b>: Function that will execute <code>[[#delay~fn|delay~fn]]</code> after t seconds - <code>[[#handle|handle]]</code>. ([[Lua reference manual#function|function]])
<h3>Other items</h3>
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Function#L-21|<code id="handle">handle()</code>]]</span> ([[Lua reference manual#function|function]])
:Function handle generated by <code>[[#delay|delay]]</code>.
:<b>Errors</b>:
::'Expected function for argument #1' ([[Module:Docbunto/testcases/Function#L-28|line 28]])
::'Expected number for argument #2' ([[Module:Docbunto/testcases/Function#L-31|line 31]])
:<b>Returns</b>: Nothing. ([[Lua reference manual#nil|nil]])
<h2>Notes</h2>
* Based on a simple busy-wait loop, which is not efficient for long delays.
* This module is likely to timeout if used in Scribunto.
<h2>See also</h2>
https://github.com/rxi/tick/blob/master/tick.lua
<table class="wikitable" style="width:75%;margin:0 auto 1em auto">
<caption>Module information card (autogenerated)</caption>
<tr><th scope="col">Name</th><th scope="col">Value</th></tr>
<tr><td scope="row">Variable</td><td align="left"><span><b><code>delay(fn, t)</code></b></span></td></tr><tr><td>Code</td><td>[[Module:Docbunto/testcases/Function]]</td></tr>
<tr><td scope="row">Release status</td><td>stable</td></tr>
<tr><td scope="row">Description</td><td>Delay the execution of a function by t seconds.</td></tr>
<tr><td scope="row">Author(s)</td><td>
* [[User:8nml|8nml]]
* [[User:TheReelDevs|TheReelDevs]]</td></tr>
</table><templatestyles src="Module:Docbunto/styles.css"></templatestyles>
]=]
},
-- Markdown support
{
'Docbunto/testcases/Markdown',
unindent [=[
__NOEDITSECTION__<h2>Documentation</h2>
<h3>Package items</h3>
<h3>Text formatting</h3>
'''This''' is bold text. <b>This</b> is also bold text. ''This'' is italic text. <i>This</i> is also italic text. '''''This''''' is bold italic text. Also <b><i>this</i></b> is rendered as bold & italic. <del>This</del> is strikethrough text. <del>This</del> is also strikethrough text. <i>x<sup>2</sup></i> renders as superscript text. It is rendered as <i>x<sup>2</sup></i>.
<h3>Block formatting</h3>
==== Setext heading ====
# This appears as a 1st list item.
# This appears as a second list item.
* Unordered list item number 1
* Unordered list item number 2
<h3>Special formatting</h3>
<code>[[#Class|Class]]</code> is a type reference. <code>[[#Class|Class]]</code> is how it renders. [https://www.lua.org/manual/5.1/index.html] links to the official Lua reference manual. The Markdown syntax for this is: [lua.org https://www.lua.org/manual/5.1/index.html]. <code><nowiki>Class:method</nowiki></code> is wrapped in backticks to produce the <code><nowiki>code</nowiki></code> tag. <code>Class:method</code> is how it renders. <math display="inline">10^2</math> renders like 10<sup>2</sup> using the <code><nowiki>math</nowiki></code> tag. <math display="inline">10^2</math> is how it renders. The <code><nowiki><chem>H_2O</chem></nowiki></code> tag works too. It renders as H<sub>2</sub>O in the MediaWiki parser. The {{t|t}} module is usable for {{t|sandbox}}ing template usage.
<templatestyles src="Module:Docbunto/styles.css"></templatestyles>
]=]
},
-- `options.all`
{
'Docbunto/testcases/Function|code= 1|all = 1',
unindent [=[
<h3>Package function</h3>
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Function#L-35|<code id="delay">delay(fn, t)</code>]]</span> ([[Lua reference manual#function|function]])
:Delay the execution of a function by t seconds.
:<b>Parameters</b>:
::<code id="delay~fn">fn</code> The function to execute after the delay. ([[Lua reference manual#function|function]])
::<code id="delay~t">t</code> The delay in seconds before executing the function. ([[Lua reference manual#number|number]])
:<b>Returns</b>: Function that will execute <code>[[#delay~fn|delay~fn]]</code> after t seconds - <code>[[#handle|handle]]</code>. ([[Lua reference manual#function|function]])
<h3>Other items</h3>
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Function#L-21|<code id="handle">handle()</code>]]</span> ([[Lua reference manual#function|function]])
:Function handle generated by <code>[[#delay|delay]]</code>.
:<b>Errors</b>:
::'Expected function for argument #1' ([[Module:Docbunto/testcases/Function#L-28|line 28]])
::'Expected number for argument #2' ([[Module:Docbunto/testcases/Function#L-31|line 31]])
:<b>Returns</b>: Nothing. ([[Lua reference manual#nil|nil]])
<h3>Private items</h3>
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Function#L-13|<code id="wait">wait(t)</code>]]</span> ([[Lua reference manual#function|function]] • local)
:A simple function that waits t seconds.
:<b>Parameter</b>: <code id="wait~t">t</code> The number of seconds to wait. ([[Lua reference manual#number|number]])
:<b>Returns</b>: Nothing. ([[Lua reference manual#nil|nil]])
<h3>Notes</h3>
* Based on a simple busy-wait loop, which is not efficient for long delays.
* This module is likely to timeout if used in Scribunto.
<h3>See also</h3>
https://github.com/rxi/tick/blob/master/tick.lua
<templatestyles src="Module:Docbunto/styles.css"></templatestyles>
]=]
},
-- `options.box`
{
'Docbunto|box = 1|card = 0',
unindent [=[
__NOEDITSECTION__{{Infobox Lua
| Type = invocable
| Description = Docbunto is an automatic documentation generator for Scribunto modules.
| Code = Docbunto
| Author = * [[User:8nml|8nml]]
* [[User:TheRealCI7|TheRealCI7]]
| Title = Docbunto
| Languages = auto
| Status = stable
| Dependencies = * [[Module:I18n]]
* [[Module:Lexer]]
* [[Module:T]]
* [[Module:Unindent]]
* [[Module:Yesno]]
| Image file = Docbunto.svg
| Using code by = [[github:stevedonovan|@stevedonovan]] ([[github:stevedonovan/LDoc|Github]])
}}
<b>Docbunto</b> is an automatic documentation generator for Scribunto modules. The module is based on LuaDoc and LDoc. It produces documentation in the form of MediaWiki markup, using <code><nowiki>@tag</nowiki></code>-prefixed comments embedded in the source code of a Scribunto module. The taglet parser & doclet renderer Docbunto uses are also publicly exposed to other modules.
Docbunto code items are introduced by a block comment (<code><nowiki>--[[]]--</nowiki></code>), an inline comment with three hyphens (<code><nowiki>---</nowiki></code>), or an inline <code><nowiki>@tag</nowiki></code> comment. The module can use static code analysis to infer variable names, item privacy (<code><nowiki>local</nowiki></code> keyword), tables (<code><nowiki>{}</nowiki></code> constructor) and functions (<code><nowiki>function</nowiki></code> keyword). MediaWiki and Markdown formatting is supported.
Items are usually rendered in the order they are defined, if they are public items, or emulated classes extending the Lua primitives. There are many customisation options available to change Docbunto behaviour.
<h2>Documentation</h2>
<h3>Package items</h3>
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1071|<code id="docbunto._main">docbunto._main(f)</code>]]</span> ([[Lua reference manual#function|function]])
:Template entrypoint for [[Template:Docbunto]].
:<b>Parameter</b>: <code id="docbunto._main~f">f</code> Scribunto frame object. ([[Lua reference manual/Scribunto libraries#Frame object|Frame]])
:<b>Returns</b>: Module documentation output. ([[Lua reference manual#string|string]])
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1105|<code id="docbunto.main">docbunto.main(frame)</code>]]</span> ([[Lua reference manual#function|function]])
:Entrypoint for the module.
:<b>Parameter</b>: <code id="docbunto.main~frame">frame</code> Module frame. ([[Lua reference manual#table|table]])
:<b>Returns</b>: Module documentation output. ([[Lua reference manual#string|string]])
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1111|<code id="docbunto.build">docbunto.build(<span style="opacity:0.65">modname</span><span style="opacity:0.65">, options</span>)</code>]]</span> ([[Lua reference manual#function|function]])
:Scribunto documentation generator entrypoint.
:<b>Parameters</b>:
::<code id="docbunto.build~modname">modname</code> Module page name (without namespace). Default: second-level subpage. ([[Lua reference manual#string|string]]; optional)
::<code id="docbunto.build~options">options</code> Configuration options. ([[#options|options]]; optional)
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1126|<code id="docbunto.taglet">docbunto.taglet(<span style="opacity:0.65">modname</span><span style="opacity:0.65">, options</span>)</code>]]</span> ([[Lua reference manual#function|function]])
:Docbunto taglet parser for Scribunto modules.
:<b>Parameters</b>:
::<code id="docbunto.taglet~modname">modname</code> Module page name (without namespace). ([[Lua reference manual#string|string]]; optional)
::<code id="docbunto.taglet~options">options</code> Configuration options. ([[#options|options]]; optional)
:<b>Errors</b>:
::'Lua source code not found in $1' ([[Module:Docbunto#L-1144|line 1144]])
::'documentation markup for Docbunto not found in $1' ([[Module:Docbunto#L-1154|line 1154]])
:<b>Returns</b>: Module documentation data. ([[Lua reference manual#table|table]])
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1637|<code id="docbunto.doclet">docbunto.doclet(data<span style="opacity:0.65">, options</span>)</code>]]</span> ([[Lua reference manual#function|function]])
:Doclet renderer for Docbunto taglet data.
:<b>Parameters</b>:
::<code id="docbunto.doclet~data">data</code> Taglet documentation data. ([[Lua reference manual#table|table]])
::<code id="docbunto.doclet~options">options</code> Configuration options. ([[#options|options]]; optional)
:<b>Returns</b>: Wikitext documentation output. ([[Lua reference manual#string|string]])
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-2136|<code id="docbunto.tags">docbunto.tags</code>]]</span> ([[Lua reference manual#table|table]])
:Token dictionary for Docbunto tags. Maps Docbunto tag names to tag tokens.
:* Multi-line tags use the <code><nowiki>'M'</nowiki></code> token.
:* Multi-line preformatted tags use the <code><nowiki>'ML'</nowiki></code> token.
:* Identifier tags use the <code><nowiki>'ID'</nowiki></code> token.
:* Single-line tags use the <code><nowiki>'S'</nowiki></code> token.
:* Flags use the <code><nowiki>'N'</nowiki></code> token.
:* Type tags use the <code><nowiki>'T'</nowiki></code> token.
<h3>Other items</h3>
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-62|<code id="options">options</code>]]</span> ([[Lua reference manual#table|table]])
:Configuration options.
:<b>Fields</b>:
:::<code id="options~options.all">options.all</code> Include local items in documentation. ([[Lua reference manual#boolean|boolean]]; optional)
:::<code id="options~options.autodoc">options.autodoc</code> Whether the module is being called to automatically provide missing documentation. ([[Lua reference manual#boolean|boolean]]; optional)
:::<code id="options~options.boilerplate">options.boilerplate</code> Removal of boilerplate (license block comments). ([[Lua reference manual#boolean|boolean]]; optional)
:::<code id="options~options.caption">options.caption</code> Infobox image caption. ([[Lua reference manual#string|string]]; optional)
:::<code id="options~options.code">options.code</code> Only document Docbunto code items - exclude article infobox and lede from rendered documentation. Permits article to be edited in VisualEditor. ([[Lua reference manual#boolean|boolean]]; optional)
:::<code id="options~options.colon">options.colon</code> Format tags with a <code><nowiki>:</nowiki></code> suffix and without the <code><nowiki>@</nowiki></code> prefix. This bypasses the "doctag soup" some authors complain of. ([[Lua reference manual#boolean|boolean]]; optional)
:::<code id="options~options.image">options.image</code> Infobox image. ([[Lua reference manual#string|string]]; optional)
:::<code id="options~options.box">options.box</code> Include infobox in output. ([[Lua reference manual#boolean|boolean]]; optional)
:::<code id="options~options.footer">options.footer</code> Append a horizontal line & "generated by Docbunto" to the bottom of the output. ([[Lua reference manual#boolean|boolean]]; optional)
:::<code id="options~options.noluaref">options.noluaref</code> Don't link to the [[Lua reference manual]] for types. ([[Lua reference manual#boolean|boolean]]; optional)
:::<code id="options~options.card">options.card</code> Include endmatter card in the output at the end of the documentation. ([[Lua reference manual#boolean|boolean]]; optional)
:::<code id="options~options.plain">options.plain</code> Disable Markdown formatting in documentation. ([[Lua reference manual#boolean|boolean]]; optional)
:::<code id="options~options.preface">options.preface</code> Preface text to insert between lede & item documentation, used to provide usage and code examples. ([[Lua reference manual#string|string]]; optional)
:::<code id="options~options.simple">options.simple</code> Limit documentation to descriptions only. Removes documentation of subitem tags such as <code><nowiki>@param</nowiki></code> and <code><nowiki>@field</nowiki></code> ([[#Item subtags|see list]]). ([[Lua reference manual#boolean|boolean]]; optional)
:::<code id="options~options.sort">options.sort</code> Sort documentation items in alphabetical order. ([[Lua reference manual#boolean|boolean]]; optional)
:::<code id="options~options.strip">options.strip</code> Remove table index in documentation. ([[Lua reference manual#boolean|boolean]]; optional)
:::<code id="options~options.subst">options.subst</code> Don't preprocess code output before the documentation is outputted e.g. <code><nowiki>subst</nowiki></code>. ([[Lua reference manual#boolean|boolean]]; optional)
:::<code id="options~options.ulist">options.ulist</code> Indent subitems as <code><nowiki><ul></nowiki></code> lists (LDoc/JSDoc behaviour). ([[Lua reference manual#boolean|boolean]]; optional)
:::<code id="options~options.verbose">options.verbose</code> Show the code description of a package function when documenting function modules. ([[Lua reference manual#boolean|boolean]]; optional)
<templatestyles src="Module:Docbunto/styles.css"></templatestyles>
]=]
},
-- `options.noluaref`
{
'Docbunto|code = 1|simple = 1|noluaref = 1',
unindent [=[
<h3>Package items</h3>
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1071|<code id="docbunto._main">docbunto._main(f)</code>]]</span> (function)
:Template entrypoint for [[Template:Docbunto]].
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1105|<code id="docbunto.main">docbunto.main(frame)</code>]]</span> (function)
:Entrypoint for the module.
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1111|<code id="docbunto.build">docbunto.build(<span style="opacity:0.65">modname</span><span style="opacity:0.65">, options</span>)</code>]]</span> (function)
:Scribunto documentation generator entrypoint.
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1126|<code id="docbunto.taglet">docbunto.taglet(<span style="opacity:0.65">modname</span><span style="opacity:0.65">, options</span>)</code>]]</span> (function)
:Docbunto taglet parser for Scribunto modules.
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1637|<code id="docbunto.doclet">docbunto.doclet(data<span style="opacity:0.65">, options</span>)</code>]]</span> (function)
:Doclet renderer for Docbunto taglet data.
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-2136|<code id="docbunto.tags">docbunto.tags</code>]]</span> (table)
:Token dictionary for Docbunto tags. Maps Docbunto tag names to tag tokens.
:* Multi-line tags use the <code><nowiki>'M'</nowiki></code> token.
:* Multi-line preformatted tags use the <code><nowiki>'ML'</nowiki></code> token.
:* Identifier tags use the <code><nowiki>'ID'</nowiki></code> token.
:* Single-line tags use the <code><nowiki>'S'</nowiki></code> token.
:* Flags use the <code><nowiki>'N'</nowiki></code> token.
:* Type tags use the <code><nowiki>'T'</nowiki></code> token.
<h3>Other items</h3>
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-62|<code id="options">options</code>]]</span> (table)
:Configuration options.
<templatestyles src="Module:Docbunto/styles.css"></templatestyles>
]=]
},
-- `options.plain`
{
'Docbunto|code = 1|simple = 1|plain = 1',
unindent [=[
<h3>Package items</h3>
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1071|<code id="docbunto._main">docbunto._main(f)</code>]]</span> ([[Lua reference manual#function|function]])
:Template entrypoint for [[Template:Docbunto]].
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1105|<code id="docbunto.main">docbunto.main(frame)</code>]]</span> ([[Lua reference manual#function|function]])
:Entrypoint for the module.
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1111|<code id="docbunto.build">docbunto.build(<span style="opacity:0.65">modname</span><span style="opacity:0.65">, options</span>)</code>]]</span> ([[Lua reference manual#function|function]])
:Scribunto documentation generator entrypoint.
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1126|<code id="docbunto.taglet">docbunto.taglet(<span style="opacity:0.65">modname</span><span style="opacity:0.65">, options</span>)</code>]]</span> ([[Lua reference manual#function|function]])
:Docbunto taglet parser for Scribunto modules.
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1637|<code id="docbunto.doclet">docbunto.doclet(data<span style="opacity:0.65">, options</span>)</code>]]</span> ([[Lua reference manual#function|function]])
:Doclet renderer for Docbunto taglet data.
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-2136|<code id="docbunto.tags">docbunto.tags</code>]]</span> ([[Lua reference manual#table|table]])
:Token dictionary for Docbunto tags. Maps Docbunto tag names to tag tokens.
:* Multi-line tags use the `'M'` token.
:* Multi-line preformatted tags use the `'ML'` token.
:* Identifier tags use the `'ID'` token.
:* Single-line tags use the `'S'` token.
:* Flags use the `'N'` token.
:* Type tags use the `'T'` token.
<h3>Other items</h3>
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-62|<code id="options">options</code>]]</span> ([[Lua reference manual#table|table]])
:Configuration options.
<templatestyles src="Module:Docbunto/styles.css"></templatestyles>
]=]
},
-- `options.strip`
{
'Docbunto|code = 1|simple = 1|strip = 1',
unindent [=[
<h3>Package items</h3>
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1071|<code id="docbunto._main">_main(f)</code>]]</span> ([[Lua reference manual#function|function]])
:Template entrypoint for [[Template:Docbunto]].
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1105|<code id="docbunto.main">main(frame)</code>]]</span> ([[Lua reference manual#function|function]])
:Entrypoint for the module.
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1111|<code id="docbunto.build">build(<span style="opacity:0.65">modname</span><span style="opacity:0.65">, options</span>)</code>]]</span> ([[Lua reference manual#function|function]])
:Scribunto documentation generator entrypoint.
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1126|<code id="docbunto.taglet">taglet(<span style="opacity:0.65">modname</span><span style="opacity:0.65">, options</span>)</code>]]</span> ([[Lua reference manual#function|function]])
:Docbunto taglet parser for Scribunto modules.
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-1637|<code id="docbunto.doclet">doclet(data<span style="opacity:0.65">, options</span>)</code>]]</span> ([[Lua reference manual#function|function]])
:Doclet renderer for Docbunto taglet data.
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-2136|<code id="docbunto.tags">tags</code>]]</span> ([[Lua reference manual#table|table]])
:Token dictionary for Docbunto tags. Maps Docbunto tag names to tag tokens.
:* Multi-line tags use the <code><nowiki>'M'</nowiki></code> token.
:* Multi-line preformatted tags use the <code><nowiki>'ML'</nowiki></code> token.
:* Identifier tags use the <code><nowiki>'ID'</nowiki></code> token.
:* Single-line tags use the <code><nowiki>'S'</nowiki></code> token.
:* Flags use the <code><nowiki>'N'</nowiki></code> token.
:* Type tags use the <code><nowiki>'T'</nowiki></code> token.
<h3>Other items</h3>
;<span class="plainlinks docbunto-link">[[Module:Docbunto#L-62|<code id="options">options</code>]]</span> ([[Lua reference manual#table|table]])
:Configuration options.
<templatestyles src="Module:Docbunto/styles.css"></templatestyles>
]=]
},
-- `options.preface`
{
unindent [=[
Docbunto/testcases/Function|box = 0|preface =
== Usage ==
The Scribunto module can now be used with the following code:
p(function() print(2) end, 2)
]=],
unindent [=[
__NOEDITSECTION__Delay the execution of a function by t seconds.
== Usage ==
The Scribunto module can now be used with the following code:
p(function() print(2) end, 2)
<h2>Documentation</h2>
<h3>Package function</h3>
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Function#L-35|<code id="delay">delay(fn, t)</code>]]</span> ([[Lua reference manual#function|function]])
:Delay the execution of a function by t seconds.
:<b>Parameters</b>:
::<code id="delay~fn">fn</code> The function to execute after the delay. ([[Lua reference manual#function|function]])
::<code id="delay~t">t</code> The delay in seconds before executing the function. ([[Lua reference manual#number|number]])
:<b>Returns</b>: Function that will execute <code>[[#delay~fn|delay~fn]]</code> after t seconds - <code>[[#handle|handle]]</code>. ([[Lua reference manual#function|function]])
<h3>Other items</h3>
;<span class="plainlinks docbunto-link">[[Module:Docbunto/testcases/Function#L-21|<code id="handle">handle()</code>]]</span> ([[Lua reference manual#function|function]])
:Function handle generated by <code>[[#delay|delay]]</code>.
:<b>Errors</b>:
::'Expected function for argument #1' ([[Module:Docbunto/testcases/Function#L-28|line 28]])
::'Expected number for argument #2' ([[Module:Docbunto/testcases/Function#L-31|line 31]])
:<b>Returns</b>: Nothing. ([[Lua reference manual#nil|nil]])
<h2>Notes</h2>
* Based on a simple busy-wait loop, which is not efficient for long delays.
* This module is likely to timeout if used in Scribunto.
<h2>See also</h2>
https://github.com/rxi/tick/blob/master/tick.lua
<templatestyles src="Module:Docbunto/styles.css"></templatestyles>
]=]
}
}
}
}