Template:Transclude: Difference between revisions

m
Changed protection level for "Template:Transclude": downgraded protection level per consensus ([Move=Allow only template editors and administrators] (indefinite) [Edit=Allow only template editors and administrators] (indefinite))
(Simpler approach)
 
Wikimedia+Commons>4nn1l2
m (Changed protection level for "Template:Transclude": downgraded protection level per consensus ([Move=Allow only template editors and administrators] (indefinite) [Edit=Allow only template editors and administrators] (indefinite)))
Line 1: Line 1:
{{#switch: {{NAMESPACE: {{{1}}} }}
{{#switch: {{NAMESPACE: {{{1}}} }}
  |#default = {{FULLPAGENAME: {{{1}}} }} <!-- the namespace was specified eg "User:Foo" "Template:Foo", "Category:Foo" -->
  |#default = {{FULLPAGENAME: {{{1}}} }} <!-- eg "User:Foo" -->
  |{{ns:0}} = <!-- we have either ":Foo" (mainspace) or "Foo" (a template) -->
  |{{ns:0}} =  
     {{#ifeq: {{First character|{{{1|}}}}}|:
     {{#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>
}}<noinclude>
{{documentation}}
{{documentation}}
</noinclude>
</noinclude>