Module:HTMLParse/doc

From Caves of Qud Wiki
< Module:HTMLParse
Revision as of 20:23, 20 August 2019 by Egocarib (talk | contribs) (note about cargo / no html)
Jump to navigation Jump to search

This is the documentation page for Module:HTMLParse

Template-info.png Documentation

This module parses and manipulates HTML strings.

There is currently only 1 function:

  • pluralize


Pluralize

Pluralizes an HTML string by inserting an "s" between the final alphabetic character and closing tag </

For example, <span>book</span> becomes <span>books</span>.

Notes:

  • Won't pluralize anything that already ends in "s".
  • Won't pluralize anything that doesn't lua pattern match %a</
  • If passing a template that uses a cargo query as the html parameter, be sure that the cargo query is marked with no html or this Module might not be able to expand the template correctly.

Usage

{{#invoke: HTMLParse | pluralize | html = (html string here) }}

Examples

wikitext result
{{#invoke: HTMLParse | pluralize | html = {{Qud text|&Cultra-light &brobot| notxml }} }}
ultra-light robots
{{#invoke: HTMLParse | pluralize | html = <span style="color:red">big </span><span style="color:blue">book</span> }}
big books