Teamplaid:Escape
(eisimpleir)
Uses Lua: |
Ùsaid - Usage
[deasaich]While primarily intended for use by other Lua modules, it can provide an alternative to multiple <nowiki>...</nowiki>
tags when part of the desired output should be executed.
For example, {{Demo}} normally requires the demonstrated template to be wrapped in <nowiki>...</nowiki>
. However, you may want part of the value to be shown in the 'pre' Tag to be processed before it reaches {{Demo}}, such as in the example below where the result of {{#invoke:Escape/testcases|test_string2}}
is shown inside the <pre>...</pre>
tags.
Còd - Code | Buil - Result |
---|---|
{{Demo
|<!--not escaped: -->{{Escape | mode = kill
| char=;
| {*{#invoke:Escape ; main ; mode {{=}} kill ;
<!--unescaped:-->{{#invoke:Escape/testcases|test_string2}}<br>; { }*}
| *
| {{!}} }}
}}
|
{{#invoke:Escape | main | mode = kill | test { test {\{ test, \test, \{,test\ \ \ {\ test test { test, test, {,test |
Note how the
character, used to break up the *
to prevent execution, is removed and how the {{
character is replaced by ;
.
|
Neo-gnìomhadh - Non-execution
[deasaich]After removal of the Escape chars, the returned text is inert; i.e. not executed even without <pre>...</pre>
. (The above example is executed only because {{Demo}} forces execution.)
For example, setting |mode=kill
with
} as the first parameter and nothing else will simply cause the default Escape character \{\{done\}\
to be removed:
\
{{done}}
Eisimpleirean - Examples
[deasaich]The above documentation is transcluded from Teamplaid:Escape/documentation. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /documentation subpage. Subpages of this template. |