Difference between revisions of "Template:Sourceheader"
Line 9: | Line 9: | ||
|- | |- | ||
|class="header_backlink" | {{#if:{{{previous|}}}|<span id="headerprevious">←{{{previous}}}</span>}} | |class="header_backlink" | {{#if:{{{previous|}}}|<span id="headerprevious">←{{{previous}}}</span>}} | ||
− | |class="header_title" | '''<span id="header_title_text">{{{title|Untitled}}}</span>''' {{#if:{{{override_author|}}}|<br /><i><span id="header_author_text">{{{override_author}}}</span></i>|{{#if:{{{author}}}|{{#if:{{{section|}}}| |<br/>}}<i>by {{#ifeq:{{#expr:{{{author}}}}}|<strong class="error">Expression error: Unrecognised punctuation character "["</strong>|{{{author}}}</i>|{{#ifeq:{{lc:{{{override_author|{{{author|}}}}}}}}|unknown|<span id="header_author_text">Unknown</span>| | + | |class="header_title" | '''<span id="header_title_text">{{{title|Untitled}}}</span>''' {{#if:{{{override_author|}}}|<br /><i><span id="header_author_text">{{{override_author}}}</span></i>|{{#if:{{{author}}}|{{#if:{{{section|}}}| |<br/>}}<i>by {{#ifeq:{{#expr:{{{author}}}}}|<strong class="error">Expression error: Unrecognised punctuation character "["</strong>|{{{author}}}</i>|{{#ifeq:{{lc:{{{override_author|{{{author|}}}}}}}}|unknown|<span id="header_author_text">Unknown</span>|{{{author}}}|<span id="header_author_text">{{{author}}}</span>}}}}</i>}}}} {{#if:{{{year|}}}|<span style="color:#999999">in the year {{{year}}}</span>}} {{#if:{{{translator|}}}|{{#switch:{{lc:{{{translator|}}}}} |
| ? = ([[:Category:Deletion requests/Unknown translators|unknown translator]]) | | ? = ([[:Category:Deletion requests/Unknown translators|unknown translator]]) | ||
| unknown =, ''unknown translator'' | | unknown =, ''unknown translator'' | ||
| not mentioned =, ''translator not mentioned'' | | not mentioned =, ''translator not mentioned'' | ||
− | | | + | | pensapedia =<i>, translated by [[Pensapedia:Translations|<span id="header_translator_text">Pensapedia</span>]]</i>{{#ifeq:{{BASEPAGENAME}}|{{PAGENAME}}|[[Category:Pensapedia translations]]}} |
− | |<i>, translated by {{#ifeq:{{#expr:{{{translator}}}}}|<strong class="error">Expression error: Unrecognised punctuation character "["</strong>|{{{translator}}}</i>| | + | |<i>, translated by {{#ifeq:{{#expr:{{{translator}}}}}|<strong class="error">Expression error: Unrecognised punctuation character "["</strong>|{{{translator}}}</i>|{{{translator}}}|<span id="header_translator_text">{{{translator}}}</span></i>}} |
}}}}{{#ifeq:{{lc:{{{override_translator|translated by {{{override_translator|}}}}}}}}}}{{#if:{{{section|}}}|<br /><span id="header_section_text">{{{section|}}}</span>}} | }}}}{{#ifeq:{{lc:{{{override_translator|translated by {{{override_translator|}}}}}}}}}}{{#if:{{{section|}}}|<br /><span id="header_section_text">{{{section|}}}</span>}} | ||
|class="header_forelink" | {{#if:{{{next|}}}|<span id="headernext">{{{next}}}→</span>}} | |class="header_forelink" | {{#if:{{{next|}}}|<span id="headernext">{{{next}}}→</span>}} | ||
Line 38: | Line 38: | ||
|{{#expr:{{{translator}}}}} = [[Category:Sources using the author field hack]] | |{{#expr:{{{translator}}}}} = [[Category:Sources using the author field hack]] | ||
}}{{#ifeq:{{lc:{{{override_author|{{{author|}}}}}}}}|unknown|[[Category:Anonymous texts]]}} | }}{{#ifeq:{{lc:{{{override_author|{{{author|}}}}}}}}|unknown|[[Category:Anonymous texts]]}} | ||
− | {{#if:{{{year|}}}|[[Category:{{{year}}} | + | {{#if:{{{year|}}}|[[Category:{{{year}}} sources]]}} |
</includeonly><noinclude> | </includeonly><noinclude> | ||
{{Sourceheader/doc}} | {{Sourceheader/doc}} | ||
</noinclude> | </noinclude> |
Latest revision as of 16:47, 21 September 2009
Untitled by {{{author}}} |
{{{notes}}} |
<section begin="Usage" />
{{sourceheader | title = | author = | year = | translator = | section = | previous = | next = | notes = }}
<section end="Usage" />
This template is meant to be used at the top of an article. Fill in any relevant information, and leave unknown or inapplicable parameters empty. Don't remove unused parameters, as this will break the template and make bot maintenance difficult.
Contents
Documentation[edit]
Relative links[edit]
With lengthy, multi-page works, using relative links is highly recommended. This shortens the code and ensures that a work remains linked together even if it is moved or reorganised. The three formats are [[/subpage]] (subpage), [[../]] (parent), and [[../sibling]] (sibling); see the example usage below. Note that [[../]] will expand to the title of the parent page, which is ideal if the work is renamed at a later time.
This depends on a page conforming to the page title standards in the naming conventions, with works in the form [[Work title]] and [[Work title/Subpage]].
Chapter titles[edit]
In general, include chapter titles in the "section" field, but avoid including them in the "previous" and "next" fields. For example:
←Chapter X | How the Other Half Lives by Jacob Riis Chapter XI: The Sweaters of Jewtown |
Chapter XII→ |
Special cases[edit]
Translations[edit]
|translator=Joe
The name of the translator. This will automatically be linked to an author page unless it contains the "[" character.
(A value of "?" or "unknown" adds {{No translator info}} to the page.)
(A value of "not mentioned" adds translator not mentioned to the page.)
No link to author page[edit]
| author= |override_author=Joe
Displays the author's name without a link to an author page (for works that don't have traditional authors).
Usage examples[edit]
Normal[edit]
{{sourceheader | title = [[../]] | author = Lewis Carroll | section = Chapter 3: A Caucus-Race and a Long Tale | previous = [[../Chapter 2|Chapter 2]] | next = [[../Chapter 4|Chapter 4]] | notes = }}
←Chapter 2 | Alice's Adventures in Wonderland by Lewis Carroll Chapter 3: A Caucus-Race and a Long Tale |
Chapter 4→ |
No author link[edit]
{{sourceheader | title = Peerage Act 1963 | author = |override_author= the United Kingdom Parliament | section = | previous = | next = | notes = }}
Peerage Act 1963 |
Translation[edit]
{{sourceheader | title = Fables | author = Jean de La Fontaine | translator= Elizur Wright | section = | previous = | next = | notes = }} {{sourceheader | title = Pantagruel | author = François Rabelais | translator= [[Author:Thomas Urquhart|]] and [[Author:Peter Antony Motteux|]] | section = | previous = | next = | notes = }}
Fables by Jean de La Fontaine , translated by Elizur Wright |
Pantagruel by François Rabelais , translated by Thomas Urquhart and Peter Antony Motteux |
Advanced manipulation[edit]
JavaScript extraction[edit]
The header values can be extracted using JavaScript by accessing the text values of their span wrappers:
value | wrapper id |
---|---|
title | header_title_text |
author | header_author_text |
translator | header_translator_text |
previous | headerprevious |
next | headernext |
notes | none |