• Home
  • Random
  • Recent changes
  • Special pages
  • Settings
  • About MOASSpedia
  • Disclaimers
MOASSpedia
  • 216.73.216.55
  • Talk
  • Watchlist
  • Contributions
  • Log in

Template:Escape

Template Discussion
  • Language
  • Watch
  • History
  • Edit
    • Page information
    • Permanent link
    • What links here
Template documentation[view] [edit] [history] [purge]
File:Edit-clear.svg
This article provides insufficient context for those unfamiliar with the subject. Please help improve the article by providing more context for the reader. (Learn how and when to remove this template message)
This template uses Lua:
  • Module:Escape

Usage

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.

Code 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 |.

Non-execution

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 \{\{done\}\} as the first parameter and nothing else will simply cause the default escape character \ to be removed:

{{done}}

Examples

Module talk:Escape/testcases

The above documentation is transcluded from Template:Escape/doc. (edit | history)
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this template.
Retrieved from "https://moasspedia.org/w/index.php?title=Template:Escape&oldid=15644"
Categories:
  • Lua-based templates
  • Wikipedia utility templates
Last edited on 20 April 2018, at 10:27

MOASSpedia

Content is available under Creative Commons Attribution-ShareAlike unless otherwise noted.
  • This page was last edited on 20 April 2018, at 10:27.
  • Content is available under Creative Commons Attribution-ShareAlike unless otherwise noted.
  • Privacy policy
  • About MOASSpedia
  • Disclaimers
  • Desktop