Content deleted Content added
Sophivorus (talk | contribs) mNo edit summary |
Sophivorus (talk | contribs) Document more methods |
||
Line 84:
Returns a table with the parameter names as keys and the parameter values as values. For unnamed parameters, the keys are numerical. If the given wikitext is not recognized as that of a template, nil will be returned.
==== getTags ====
<code>getTags( wikitext )</code>
Returns a table with each value being a tag (like <nowiki><div></nowiki>, <nowiki><gallery></nowiki>, <nowiki><ref></nowiki>, <nowiki><noinclude></nowiki>) including its contents. Tags inside tags will be skipped. If you're interested in getting them too, run this method again for each of the returned tags.
==== getTagName ====
<code>getTagName( tagWikitext )</code>
Returns the name of the tag in the given wikitext. For example 'div', 'span', 'gallery', 'ref', etc.
==== getTagAttribute ====
<code>getTagAttribute( tagWikitext, attribute )</code>
Returns the value of an attribute in the given tag. For example the id of a div or the name of a reference.
==== getGalleries ====
<code>getGalleries( wikitext )</code>
Returns a table with each value being a gallery.
==== getReferences ====
<code>getReferences( wikitext )</code>
Returns a table with each value being a reference. This includes self-closing references (like <code><nowiki><ref name="foo" /></nowiki></code>) as well as full references.
==== getTables ====
<code>getTables( wikitext )</code>
Returns a table with each value being a wiki table.
==== getTableId ====
<code>getTableId( tableWikitext )</code>
Returns the id of the given wiki table.
==== getTableById ====
<code>getTableById( wikitext, id )</code>
Returns the wiki table with the given id. If not found, nil will be returned.
==== getTableData ====
<code>getTableData( tableWikitext )</code>
Returns a Lua table representing the data of the given wiki table.
==== getLinks ====
<code>getLinks( wikitext )</code>
Returns a Lua table with each value being a wiki link. For external links, use [[#getExternalLinks]] instead.
==== getFileLinks ====
<code>getFileLinks( wikitext )</code>
Returns a Lua table with each value being a file link.
==== getFileName ====
<code>getFileName( fileWikitext )</code>
Returns the name of the given template. If the given wikitext is not recognized as that of a file, nil will be returned.
==== getCategories ====
<code>getCategories( wikitext )</code>
Returns a Lua table with each value being a category link.
==== getExternalLinks ====
<code>getExternalLinks( wikitext )</code>
Returns a Lua table with each value being an external link. For internal links, use [[#getLinks]] instead.
== See also ==
|