• Home
  • Random
  • Nearby
  • Log in
  • Settings
Donate Now If Wikipedia is useful to you, please give today.
  • About Wikipedia
  • Disclaimers
Wikipedia

Template:Call wikitext

  • Template
  • Talk
  • Language
  • Watch
  • Edit
Template documentation[view] [edit] [history] [purge]
This template uses Lua:
  • Module:Call wikitext

{{Call wikitext}} allows wikitext to be called as if it were part of a template. The contents of the <nowiki>...</nowiki> tag, or unprocessed wikitext from {{Make code}} etc., passed to |sourceCode= parameter will be called with the other arguments passed to this template.

This template is useful for documentation pages of module like Module:For nowiki and Module:ArgRest that require parent frame arguments to function or for defining parameters with complex logic that are used a few times in a short section of wikitext.

Usage

edit

{{Call wikitext|sourceCode=<nowiki>wikitext to call</nowiki>|parameters to call with}}

When used it invoke a module, its usage is like so:

{{Call wikitext|sourceCode=<nowiki>{{#invoke:module|function|child frame parameters}}</nowiki>|parent frame parameters}}

The |sourceCode= parameters take the wikitext to call wrapped in <nowiki>...</nowiki> tags. This parameter is not passed to the wikitext.

Examples

edit
  • {{Call wikitext|sourceCode=<nowiki>{{{1}}}{{#if:{{{twice|}}}|{{sp}}{{{1}}}}}</nowiki>|{{#expr:5 + 3}}}} → 8
  • {{Call wikitext|sourceCode=<nowiki>{{{1}}}{{#if:{{{twice|}}}|{{sp}}{{{1}}}}}</nowiki>|{{#expr:5 + 3}}|twice=yes}} → 8 8
  • {{Call wikitext|sourceCode=<nowiki>{{#invoke:ArgRest|main|<nowiki>{{{1}}}! &lt;/nowiki>|1}}</nowiki>|One|Two|Three}} → One! Two! Three!
  • {{Call wikitext|sourceCode={{Make code|<<<3>>><<<2>>><<<1>>>}}|A|B|C}} → CBA

See also

edit
  • {{Make code}}
  • {{Expand wikitext}} - Passes wikitext through frame:preprocess with less of a focus on unstripping nowiki tags while also using the |1= parameter
The above documentation is transcluded from Template:Call wikitext/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://en.wikipedia.org/w/index.php?title=Template:Call_wikitext&oldid=1243499520"
Last edited on 1 September 2024, at 20:39

Languages

      This page is not available in other languages.

      Wikipedia
      • Wikimedia Foundation
      • Powered by MediaWiki
      • This page was last edited on 1 September 2024, at 20:39 (UTC).
      • Content is available under CC BY-SA 4.0 unless otherwise noted.
      • Privacy policy
      • About Wikipedia
      • Disclaimers
      • Contact Wikipedia
      • Code of Conduct
      • Developers
      • Statistics
      • Cookie statement
      • Terms of Use
      • Desktop