Jump to content

Module:Call wikitext/doc

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by BrandonXLF (talk | contribs) at 19:52, 1 September 2024 (Add usage and examples). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

{{#invoke:Call wikitext|main}} allows wikitext to be called as if it were part of a template. The contents of the <nowiki>...</nowiki> tag passed to |sourceCode= parameter will be called with the other arguments passed to this module.

This module is most useful on the documentation pages of module like Module:For nowiki and Module:ArgRest that require parent frame arguments to function. It was orginally designed for providing an effective way to create testcases for Module:ArgRest.

Usage

{{#invoke:Call wikitext|main|sourceCode=<nowiki>wikitext to call</nowiki>|parameters to call with}}

It is most commonly used with Lua modules like so:

{{#invoke:Call wikitext|main|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

  • {{#invoke:Call wikitext|main|sourceCode=<nowiki>{{{1}}} {{{foo}}} {{{1}}}</nowiki>|One|foo=Foo}} → One Foo One
  • {{#invoke:Call wikitext|main|sourceCode=<nowiki>{{#invoke:ArgRest|main|<nowiki>{{{1}}}! </nowiki>|1}}</nowiki>|One|Two|Three}} → {{#invoke:ArgRest|main|<nowiki>1! </nowiki>|One|Two|Three}}