This is the documentation page for Module:HtmlBuilder

This module creates html using a fluent Lua interface.

to start with, you need to load the module:

local HtmlBuilder = require('Module:HtmlBuilder')

Then, you can create html using the following sub-functions:

  • create() - the basic function. All of the sub-functions are called from this.
  • wikitext() - normal wikitext text that occurs between html tags, or outside of html tags.
  • allDone() - this closes any open html tags. Every call to HtmlBuilder must end with this, regardless of whether it uses any tags or not.
  • tag() - this specifies which tag to use. It can be used to create unclosed tags using the {unclosed = true} parameter.
  • attr() - specifies any attributes used in the html tag.
  • css() - specifies css styles used in a "style" attribute in the html tag. This sub-function accepts two parameters - the first one is the css property, and the second one is the value. E.g. ('background', 'red').
  • cssText() - this sets css style as a text string containing both the css property and the value. E.g. ('background:red;')
  • addClass() - this adds one more class value to the tag.

For examples, please see the test cases page and the test cases results.