Difference between revisions of "Template:File title"

From blackwiki
Jump to navigation Jump to search
imported>Amalthea
m (Protected Template:File title: Highly visible page: about to be used in other protected templates ([edit=sysop] (indefinite) [move=sysop] (indefinite)))
imported>Amalthea
(Allow substing. Ugly.)
Line 1: Line 1:
 
{{
 
{{
   #if: {{{1|}}}
+
   {{{subst|}}}#if: {{{1|}}}
 
   | {{
 
   | {{
       #ifeq: {{NAMESPACE:{{{1|}}}}} | {{ns:File}}
+
       {{{subst|}}}#ifeq: {{{{{subst|}}}NAMESPACE:{{{1|}}}}} | {{{{{subst|}}}ns:File}}
       | {{FULLPAGENAME:{{{1|}}}}} <!-- File name with namespace, we strip a potential leading column -->
+
       | {{{{{subst|}}}FULLPAGENAME:{{{1|}}}}}
       | {{ns:File}}:{{str trim|{{{1|}}}}}     <!-- File name without namespace -->
+
       | {{{{{subst|}}}ns:File}}:{{{{{subst|}}}#if:X|{{{1|}}}}}
 
     }}
 
     }}
 
   |  <!-- Empty first parameter -->
 
   |  <!-- Empty first parameter -->

Revision as of 13:23, 28 November 2009

50px Template documentation[view] [edit] [history] [purge]

This template can be used to create proper file titles, both if the name space was omitted or supplied by the user.

It is primarily of use in templates and should not be used in articles directly.

This template can be substituted.

Usage

  • "{{File title| Example.svg }}" → "File:Example.svg"
  • "{{File title| File:Example.svg }}" → "File:Example.svg"
  • "{{File title| :File:Example.svg }}" → "File:Example.svg"

To Do

This template could be expanded to a series of "Namespace title" templates, if needed (hopefully sharing the same code).

See also