Module:Escape/doc explained

Usage

This module is designed as an way to escape strings in a customized and efficient manner. It works by replacing characters that are preceded by your escape char (or phrase) There are two ways to call this module:

From another module: local esc = require('Module:Escape') esc:char local to_escape = esc:text local result = esc:undo(to_escape)

From a template: {{invoke:Escape|main|mode=|char=|}}

In a template, the most useful function is .

This module is primarily intended to be used by other modules. However all functions can be called in template space using followed by arguments.

All module functions (i.e. any func. other than main) should be called using a colon (:), e.g. or <nowiki>esc:kill{'{{example|\\}}}', '}'} == '{{example|}'</nowiki>

style='vertical-align:top;width:7em'This function takes only one argument: A string. All characters in this string which are preceded by the sequence set by escape:char will be replaced with placeholders that can be converted back into that char by escape:undo
style='vertical-align:top;width:5em'Takes two arguments:
  1. The string that may contain placeholders set by escape:text
  2. Optional, a char to be placed in front of any characters that have been de-escaped. (i.e. if you need to re-escape those string with a different char)
style='vertical-align:top;width:5em'This is basically equivalent to calling string.gsub on the string returned by escape:text and feeding that result into escape:undo in a single step. Takes three arguments:
  1. A string
  2. A sequence of characters to be removed from that string. (May use a string.gsub pattern)
  3. Optional, a char to be placed in front of any characters that have been de-escaped.
style='vertical-align:top'This function's primary use is to initialize the patterns to scan a string for an escape/escaped sequence. It takes two arguments, the first being the escape character and the second being a table of arguments (optional). By default, this module will escape the char. To escape the