Template:Transclude: Difference between revisions

From wikiNonStop
Content added Content deleted
(Update from sandbox.)
 
m (1 revision imported: initial setup)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{#switch: {{NAMESPACE: {{{1}}} }}
<onlyinclude>{{#switch: {{NAMESPACE: {{{1}}} }}
|#default = {{FULLPAGENAME: {{{1}}} }} <!-- the namespace was specified eg "User:Foo" "Template:Foo", "Category:Foo" -->
|#default = {{FULLPAGENAME: {{{1}}} }} <!-- leading namespace prefix, eg "Template:Foo" -->
|{{ns:0}} =
|{{ns:0}} = <!-- we have either ":Foo" (mainspace) or "Foo" (a template) -->
{{#if: {{#invoke:string2|startswith|1={{{1|}}}|2=:}}
{{#ifeq: {{NAMESPACE: {{{1}}} }} | {{NAMESPACE: Template{{{1}}} }}
|{{PAGENAME: {{{1}}} }} <!-- leading colon, eg ":Foo", so we want the article -->
| Template:{{{1}}} <!-- no leading colon, eg "Foo" -->
|Template:{{{1}}} <!-- no leading colon, eg "Foo", so we want the template -->
| {{PAGENAME: {{{1}}} }} <!-- leading colon, eg ":Foo", so we want the article -->
}}
}}
}}<noinclude>
}}</onlyinclude>
{{documentation}}
{{Documentation}}
</noinclude>

Latest revision as of 07:11, 17 September 2024

Template:{{{1}}}

Template documentation


This template resolves page names as they would be handled by MediaWiki's page-transclusion process. It thereby removes ambiguity when doing other things with template pagenames, e.g. linking.

Usage

  • {{transclude| Template:Foo }}Template:Foo
  • {{transclude| Category:Foo }}Category:Foo
  • {{transclude| Foo }}Template:Foo
  • {{transclude| :Foo }}Foo
  • {{transclude| :File:Foo }}File:Foo
  • {{transclude| Project:Foo }}Project:Foo

TemplateData

This is the TemplateData documentation for this template used by VisualEditor and other tools.

Transclude

This template resolves page names as they would be handled by MediaWiki's template-transclusion process. It thereby removes ambiguity when doing other things with template pagenames, e.g. linking.

Template parameters

ParameterDescriptionTypeStatus
Page name1

The name of the page you are trying to link to

Stringrequired

See also