Diferencia entre revisiones de «Módulo:HtmlBuilder/doc»
De Familia Sanchez Arjona
(create rudimentary docs) |
(add) |
||
Línea 11: | Línea 11: | ||
* <code>create()</code> - the basic function. All of the sub-functions are called from this. | * <code>create()</code> - the basic function. All of the sub-functions are called from this. | ||
* <code>wikitext()</code> - normal wikitext text that occurs between html tags, or outside of html tags. | * <code>wikitext()</code> - normal wikitext text that occurs between html tags, or outside of html tags. | ||
− | * <code>allDone()</code> - this closes any open html tags. | + | * <code>allDone()</code> - this closes any open html tags. Every call to HtmlBuilder must end with this, regardless of whether it uses any tags or not. |
* <code>tag()</code> - this specifies which tag to use. It can be used to create unclosed tags using the <code>{unclosed = true}</code> parameter. | * <code>tag()</code> - this specifies which tag to use. It can be used to create unclosed tags using the <code>{unclosed = true}</code> parameter. | ||
* <code>attr()</code> - specifies any attributes used in the html tag. | * <code>attr()</code> - specifies any attributes used in the html tag. |
Revisión del 13:45 25 mar 2013
This module creates html using a fluent Lua interface.
Usage
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.
Examples
For examples, please see the test cases page and the test cases results.