Jump to content

Template:Docbunto/doc

From The Petit Planet Wiki
Revision as of 15:06, 2 September 2026 by ReisuDesign (talk | contribs) (Created page with "{{Documentation/Header}} {{Docbunto}} <includeonly>")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
This is the documentation page for Docbunto.
It contains usage information, categories, and other content not part of the original template page.
Docbunto, based on the version on the dev wiki.

Compared to the version on the dev wiki, this version:

  • changes documentation output format to always produce valid HTML and allow CSS styling
  • adds support for object types that link to other modules
  • adds better support for block documentation comments
  • fixes a few bugs

(Note: @export seems buggy in the version on the dev wiki, and may not be completely fixed in this version either.)

Documentation from the dev wiki:

Docbunto 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 @tag-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 (--[[]]--), an inline comment with three hyphens (---), or an inline @tag comment. The module can use static code analysis to infer variable names, item privacy (local keyword), tables ({} constructor) and functions (function 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.

Documentation

Package items

docbunto.main(f)(function)

Template entrypoint for Template:Docbunto.

Parameter:

(table) f Scribunto frame object.

Returns:

(string) Module documentation output.

docbunto.build([options])(function)

Scribunto documentation generator entrypoint.

Parameters:

(table;optional) options Configuration options.

Keys:

(string;optional) options.file Module page name (without namespace). Default: second-level subpage.

(string;optional) options.content An parameter used for debugging this module. Pass in a string containing source code to view the documentation it would generate.

(boolean;optional) options.all Include local items in documentation.

(boolean;optional) options.boilerplate Removal of boilerplate (license block comments).

(string;optional) options.caption Infobox image caption.

(boolean;optional) options.code Only document Docbunto code items - exclude article infobox and lede from rendered documentation. Permits article to be edited in VisualEditor.

(boolean;optional) options.colon Format tags with a : suffix and without the @ prefix. This bypasses the "doctag soup" some authors complain of.

(string;optional) options.image Infobox image.

(boolean;optional) options.noluaref Don't link to the Lua reference manual for types.

(boolean;optional) options.plain Disable Markdown formatting in documentation.

(string;optional) options.preface Preface text to insert between lede & item documentation, used to provide usage and code examples.

(boolean;optional) options.simple Limit documentation to descriptions only. Removes documentation of subitem tags such as @param and @field (see list).

(boolean;optional) options.strip Remove table index in documentation.

docbunto.taglet([options])(function)

Docbunto taglet parser for Scribunto modules.

Parameter:

(table;optional) options Configuration options.

Errors:

(string;line 915) 'Lua source code not found in $1'

(string;line 922) 'documentation markup for Docbunto not found in $1'

Returns:

(table) Module documentation data.

docbunto.doclet(data, [options])(function)

Doclet renderer for Docbunto taglet data.

Parameters:

(table) data Taglet documentation data.

(table;optional) options Configuration options.

Returns:

(string) Wikitext documentation output.

docbunto.tags(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.