Jump to content

Template:Quote/doc: Difference between revisions

From Project Mailer
m "{{TemplateDataHeader}}" --> "{{TemplateData header}}"
 
m 1 revision imported
(No difference)

Revision as of 19:54, 26 November 2018

Usage

{{Quote}} adds a block quotation to an article page.

This is easier to type and is more wiki-like than the equivalent HTML <syntaxhighlight lang="html" class="" id="" style="" inline="1">

...

</syntaxhighlight> tags, and has additional pre-formatted attribution parameters for author and source (though these are not usually used in articles; see § Reference citations, below).

Note: Block quotes do not normally contain quotation marks (see MOS:BLOCKQUOTE).

Examples

Basic use:
{{Quote
|text=Quoted material.
}}
With attribution displayed:
{{Quote
|text=Quoted material.
|author=First M. Last
}}
With more attribution:

<syntaxhighlight lang="moin">

Quoted material.

— First M. Last, "Article Title", Book Title (date)

</syntaxhighlight>

Parameters

|text= a.k.a. |1=—The material being quoted, without quotation marks around it. It is always safest to name this parameter (rather than use an unnamed positional parameter), because, otherwise, any inclusion of a non-escaped "=" character (e.g., in a URL in a source citation) will break the template.

Displayed attribution

These parameters for for displaying attribution information below the quote; this should not be confused with a citing a source (see § Reference citations, below). These parameters are entirely optional, and are usually used with famous quotations, not routine block quotations, which are usually sourced at the end of the introductory line immediately before the quotation, with a normal <syntaxhighlight lang="html" inline>[1]</syntaxhighlight> tag.

|author= a.k.a. |2= – optional author/speaker attribution information that will appear below the quotation, and preceded with an attribution dash.

|title= a.k.a. |3= – optional title of the work the quote appears in, to display below the quotation. This parameter immediately follows the output of |author= (and an auto-generated comma), if one is provided. It does not auto-italicize. Major works (books, plays, albums, feature films, etc.) should be italicized; minor works (articles, chapters, poems, songs, TV episodes, etc.) go in quotation marks (see MOS:TITLES). Additional citation information can be provided in a fourth parameter, |source=, below, which will appear after the title.

|source= a.k.a. |4= – optionally used for additional source information to display, after |title=, like so: <syntaxhighlight lang="moin" class="" id="" style="" inline="1">|title="The Aerodynamics of Shaved Weasels" |source=Perspectives on Mammal Barbering, 2016</syntaxhighlight>; a comma will be auto-generated between the two parameters. If |source= is used without |title=, it simply acts as |title=. (This parameter was added primarily to ease conversion from misuse of the pull quote template {{Quote frame}} for block quotation, but it may aid in cleaner meta-data implementation later.)

|character= a.k.a. |char= – to attribute fictional speech to a fictional character, with other citation information. Can also be used to attribute real speech to a specific speaker among many, e.g. in a roundtable/panel transcript, a band interview, etc. This parameter outputs "[Character's name], in" after the attribution dash and before the output of the parameters above, thus one or more of those parameters must also be supplied. If you need to cite a fictional speaker in an article about a single work of fiction, where repeating the author and title information would be redundant, you can just use the |author= parameter instead of |character=.

Technically, all citation information can be given in a single parameter, as in: <syntaxhighlight lang="moin" class="" id="" style="" inline="1">|source=Anonymous interview subject, in Jane G. Arthur, "The Aerodynamics of Shaved Weasels", Perspectives on Mammal Barbering (2016), Bram Xander Yojimbo (ed.)</syntaxhighlight> But this is a bit messy, and will impede later efforts to generate metadata from quotation attribution the way we are already doing with source citations. This is much more usable: <syntaxhighlight lang="moin"> |character=Anonymous interview subject |author=Jane G. Arthur |title="The Aerodynamics of Shaved Weasels" |source=Perspectives on Mammal Barbering (2016), Bram Xander Yojimbo (ed.) </syntaxhighlight> Later development can assign a CSS class and so forth to these separate parameters, upon which scripts would be able to operate (e.g. to look up things in WikiQuote).

Rarely used technical parameters

|multiline= – some of the issues with the formatting of quotes with line breaks can be fixed by using |multiline=y (see the line breaks section for other options).

|style= – allows specifying additional CSS styles (not classes) to apply to the <syntaxhighlight lang="html" class="" id="" style="" inline="1">

...

</syntaxhighlight> element. (See #Nested quotations, below, for the most common use case.)

Parameter list

{{Quote
| quote     =
| author    =
| title     =
| source    =
| character =
| multiline =
| style     =
}}

Reference citations

A reference citation can be placed before the quote, after the quote, or in the |source= parameter:


Please do not place the citation in a |author= or |source= parameter by itself, as it will produce a nonsensical attribution line that looks like:
     — [1]
Please also do not put it just outside the {{Quote}} template, as this will cause a:
     [1]
on a line by itself.

Examples

Markup
<syntaxhighlight lang="moin"><blockquote class="templatequote" >Cry "Havoc" and let slip the dogs of war.<div class="templatequotecite">— <cite>Mark Antony, in [[William Shakespeare]], ''[[Julius Caesar (play)|Julius Caesar]]'', act III, scene I</cite></div>
</blockquote></syntaxhighlight>
Renders as

Cry "Havoc" and let slip the dogs of war.

— Mark Antony, in William Shakespeare, Julius Caesar, act III, scene I

Limitations

If you do not provide text, the template generates a parser error message, which will appear in red text in the rendered page.

If any parameter's actual value contains an equals sign (=), you must use a named parameter (e.g. |text="E=MC2" is a formula everyone knows but few understand, not a blank-name positional parameter. The text before the equals sign gets misinterpreted as a named parameter otherwise. Be wary of URLs, which frequently contain this character. Named parameters are always safer, in this and other templates.

If any parameter's actual value contains characters used for wiki markup syntax (such as pipe, brackets, single quotation marks, etc.), you may need to escape it. See {{!}} and friends.

Next to right-floated boxes

As of September 2015, the text of a block quotation may rarely overflow (in Firefox or other Gecko browsers) a right-floated item (e.g. a {{Listen}} box, when that item is below another right-floated item of a fixed size that is narrower. In Safari and other Webkit browsers (and even more rarely in Chrome/Chromium) the same condition can cause the block quotation to be pushed downward. Both of these problems can be fixed by either:

  1. removing the sizing on the upper item and letting it use its default size (e.g. removing ###x###px sizing or |upright= from a right-floated image above a wider right-floated object that is being overflowed by quotation text; or
  2. using |style=<syntaxhighlight lang="css" class="" id="" style="" inline="1">overflow:inherit;</syntaxhighlight> in the quotation template.

There may be other solutions, and future browser upgrades may eliminate the issue. It arises at all because of the <syntaxhighlight lang="css" inline>blockquote {overflow: hidden;}</syntaxhighlight> CSS declaration in Mediawiki:Common.css, which itself works around other, more common display problems. A solution that fixes all of the issues is unknown at this time.

Vanishing quotes

In rare layout cases, e.g. when quotes are sandwiched between userboxes, a quotation may appear blanked out, in some browsers. The workaround for this problem is to add |style=<syntaxhighlight lang="css" class="" id="" style="" inline="1">overflow:inherit;</syntaxhighlight> to such an instance of the template.

Line breaks

The <syntaxhighlight lang="html" class="" id="" style="" inline="1">

</syntaxhighlight> element and any templates that use it do not honor newlines:

Markup Renders as
<blockquote>
Line 1
Line 2
Line 3
Line 4
</blockquote>

The simplest workaround for this is to use the <poem> tag inside <syntaxhighlight lang="html" class="" id="" style="" inline="1">

</syntaxhighlight>, which will convert line breaks to <syntaxhighlight lang="html" class="" id="" style="" inline="1">
</syntaxhighlight> tags:

Markup Renders as
<blockquote>
Line 1
Line 2
Line 3
Line 4
</blockquote>

This template sets a text style which might ignore one blank line, and so the template must be ended with a break (newline) or the next blank line might be ignored. Otherwise, beware inline, as:
     text here {{Quote|this is quoted}} More text here
spans a blank line, unless a {{Quote|...}} is ended with a line break, then the next blank line might be ignored and two paragraphs joined.

Nested quotations

The <syntaxhighlight lang="html" class="" id="" style="" inline="1">

...

</syntaxhighlight> element has styles that change the font size: on desktop, text is smaller; on mobile, it is larger. This change is relative to the enclosing context, meaning that if you quote from a source that itself uses a block quotation, you'll find that the inner quotation is either really tiny and hard to read, or really large and barely fits on the screen. Additionally, you'll get an extra pair of decorative, oversize quotation marks. To fix both these issues, add the parameter |style=<syntaxhighlight lang="css" class="" id="" style="" inline="1">font-size:inherit;quotes:none;</syntaxhighlight> on any inner {{Quote}} templates.

Technical issues with block templates

If the block-formatted content begins with a list (or any other wikimarkup that is dependent upon a specific markup character being at the beginning of a line) then due to a bug in MediaWiki, a <nowiki /> must exist before the list (or whatever) starts. Compare:

  code result
FAIL
 {{Quote|1=
 *Firstly, ...
 *Secondly, ...
 *Thirdly, ...
 }}

*Firstly, ...

  • Secondly, ...
  • Thirdly, ...
Works as intended
 {{Quote|1=<nowiki />
 *Firstly, ...
 *Secondly, ...
 *Thirdly, ...
 }}
  • Firstly, ...
  • Secondly, ...
  • Thirdly, ...

To embed a table in block markup like this, the block template's content parameter must be named or numbered and include the self-closing noinclude – as in |1=<nowiki /> – then every | character in the table markup must be escaped with {{!}}. An alternative is to use explicit HTML <syntaxhighlight lang="html" class="" id="" style="" inline="1">

</syntaxhighlight>, <syntaxhighlight lang="html" class="" id="" style="" inline="1"></syntaxhighlight>, <syntaxhighlight lang="html" class="" id="" style="" inline="1">
</syntaxhighlight>, and <syntaxhighlight lang="html" class="" id="" style="" inline="1"></syntaxhighlight> markup.

Errors

Pages where this template is not used correctly populate Category:Pages incorrectly using the quote template. The category tracks tranclusions of Template:Quote that have no text given for quotation or use an equals sign in the argument of an unnamed parameter. It also tracks usage of |class=, |id=, |diff=, |4=, or |5=.

TemplateData

This is the TemplateData documentation for this template used by VisualEditor and other tools; see the monthly parameter usage report for this template.

TemplateData for Quote

Adds a block quotation.

Template parameters

ParameterDescriptionTypeStatus
texttext 1 quote

The text to quote

Example
Cry "Havoc" and let slip the dogs of war.
Contentrequired
signsign 2 cite author

The person being quoted

Example
[[William Shakespeare]]
Contentsuggested
sourcesource 3

A source for the quote

Example
''[[Julius Caesar (play)|Julius Caesar]]'', act III, scene I
Contentsuggested


  1. ...
  2. ...
  3. ...
  4. ...
  5. ...
  6. ...
  7. ...