Difference between revisions of "Template:DISPLAYTITLE/doc"

From Wiki
Jump to: navigation, search
(Description: wikilink to another example page)
 
m (1 revision)
 
(No difference)

Latest revision as of 20:41, 3 February 2014


The Template:DISPLAYTITLE directly invokes magic word {{DISPLAYTITLE:___}} to set the formatting of the title of the page which contains it. It can be used to show part of a page title in italics, show a leading colon ":" or shift to superscripted or subscripted text.

Examples

Notice the use of the ":" instead of "|" as separator.

Title Magic variable Changed title
Lorem ipsum dolor {{DISPLAYTITLE:Lorem ''ipsum'' dolor }} Lorem ipsum dolor
Book:Lorem ipsum dolor sit amet {{DISPLAYTITLE:BooK:Lorem ipsum dolor sit amet}} BooK:Lorem ipsum dolor sit amet
Portal:Lorem ipsum dolor sit {{DISPLAYTITLE:: _ Portal _ _ _ : _ _ _ Lorem ipsum_dolor sit}}  : _ Portal _ _ _ : _ _ _ Lorem ipsum dolor sit
Kalai's 3^d conjecture Kalai's 3<span style="position:absolute; top: -9999px">^</span ><sup>''d''</sup> conjecture Kalai's 3^d conjecture
E sub 0 <code>E<span style="position:absolute; top: -9999px"> sub </span ><sub>0</sub> E0
Lorem ipsum dolor sit {{DISPLAYTITLE:Lorem ''ipsum'' doLor sit}} Lorem ipsum dolor sit ← (unchanged as capital "L" does not match original)

Note that some parts of a title can be hidden by using a span-tag (with "position:absolute; top: -9999px") to shift some text off-screen, such as: <span style="position:absolute; top: -9999px">^</span>, to hide a caret "^" before a superscript in a title, or similar to hide the word " sub " before a subscript.

Introduction

The title of a page name can always be copied and pasted to affect links, inclusions, and categories. DISPLAYTITLE enforces this, so then only changes that will convert to canonical form (standard format) will actually change the displayed title. It is possible to preview the changed title while on the edit page. One invalid change, such as the capitalization of a pagename letter after the first letter will invalidate any other allowed changes, and the whole title will display unchanged.

The title of a named page is the fullpagename, denoted "namespace:pagename". The namespace of an article is nameless, so it does not display, and the fullpagename is pagename.

It is important to note the warning sign at the top of this page preferring that the template form of DISPLAYTITLE not be used, but that rather the magic variable form of {{DISPLAYTITLE:___}} be used directly as documented next. The template would simply call the magic word "DISPLAYTITLE:" anyway, so using template DISPLAYTITLE creates an (acceptable but) unnecessary step in page processing.

Magic variables use colon ":" but templates use bar/pipe "|" as the separator to indicate the page name to process here. Use the magic variable. If "|" is used instead of ":", it places the page in Category:Pages which use a template in place of a magic word, which may cause distractions.

Description

The title (the fullpagename) is changed using {{DISPLAYTITLE:namespace:pagename}} anywhere in the wikitext. As usual in markup, multiple spaces are made singular. The allowed visual changes are simply:

  • lower-case the initial letter of the pagename (example page eBay)
  • change the case of any letter of the namespace
  • add an initial colon to the title (the fullpagename)
  • change any space to an underscore "_" character or any underscore character to a space (example page mod_perl)
  • add any number or mixture of spaces and underscores
    • around the separator character ":" (between the namespace and pagename), or
    • between words in the pagename
    • before or after the title (where spaces alone are ignored) (example page _NSAKEY)
  • add bold or italic character formatting to any letters in the fullpagename (example page Allosaurus)

These possibilities exist because of the definition of a page name, which allows for the canonicalization of any title by copying and pasting the title into links, inclusions, and category names.

If there is more than one instance of DISPLAYTITLE in the wikitext, the last one overrides the previous ones. This means that if the DISPLAYTITLE automatically generated by something like some bookbox template needs to be overridden, then an explicit DISPLAYTITLE must be placed after that template to make your version display. If all efforts to change the title (with canonicalization compliance) fail, try looking at the bottom of the page for some stray magic variable DISPLAYTITLE.

Instructions

Template DISPLAYTITLE has the same instructions as magic variable DISPLAYTITLE. Please use ":" instead of "|".

  1. Type {{DISPLAYTITLE: anywhere in the wikitext.
  2. Type the wikitext for the fullpagename after that last ":" character. (See the description above.)
  3. After that changed title type the closing "}}". (See the examples above.)
  4. Preview the page and check the results.

Because more than one instance of DISPLAYTITLE can surreptitiously occur, only the last instance is enacted. DISPLAYTITLE is guaranteed to work when placed after any other templates such as the info box templates.

See also