Template:Bq

From Wikipedia, the free encyclopedia
Jump to: navigation, search

Example indented content. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Documentation icon Template documentation[view] [edit] [history] [purge]

Usage[edit]

This template is to help facilitate the indentation of blocks of content (quotations, computer source code, etc.) with the semantically correct <blockquote>...</blockquote> element, which can also be further styled and given metadata. This method is often preferred to using wikimarkup's ";" indentation (actually an abuse of <dt>...</dt> code), and other means that can cause problems or which are complicated and error-prone, and for accessibility, content/presentation separation, semantic Web, and metadata reasons; [X]HTML's <blockquote>...</blockquote> element has semantic meaning, while many tricks for indenting do not, or even have incorrect semantics.

Example:

Markup
{{bq|text=Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.}}
Renders as

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Compare to:

Markup
<blockquote>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</blockquote>
Renders as

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Parameters[edit]

  • |text= or |quote= or |1= (required) the content of the indented block; it is always safest to specify this parameter explicitly, as it will otherwise break if the content ever contains the "=" character, and can also fail under other technical circumstances.
  • |class= an additional CSS class; it already uses templatequote by default.
  • |id= an identifier, which can be used as a link target or for other purposes, e.g. custom user scripts; it must begin with a letter, not a number or symbol, and be unique on a page.
  • |style= inline CSS directives for custom styling, like background color.
  • |title= metadata that indicates a title or label for the element; different browsers handle this differently, most often as a pop-up tooltip on mouseover.

Cited quotations[edit]

For use with cited quotations, {{bq}} supports the sourcing parameters (and their aliases) of the older and simpler {{quote}} templates and the frequently abused {{cquote}}, so {{bq}} can be used as a drop-in replacement for them that provides the above additional features. Conversion from several other templates, including {{quote box}} and {{quotation}}, even {{talkquote}}, is trivially easy. Converting from {{rquote}} requires deletion of its first parameter, which is always left or right and then the rest of its data will just work without modification. Such conversions of course lose features (decoration, etc.) of many of those templates, but sometimes that is precisely what is desired.

  • |2= or |sign= or |cite= or |author= or |by= author/speaker of the quotation; this is free-form text and can include a link to the author's article.
  • |3= or |source= or |ts= source from which the quotation is drawn; this is free-form text and can including links, styling, etc.; if converting from {{quote box}}, the author would also be included in |source=, but should really be moved manually to the above parameter.
  • |4= optionally, you can divide the citation up further, e.g. |2=Lastname, Firstname|3="Article Title"|4=Book Title, but this is not really necessary, and is mainly to make conversion from {{quotation}} a little easier. Parameter 4 is automatically italicized, since it is only used for larger works like books, albums, magazines, or TV shows. It also maps to |diff= for conversion of {{talkquote}}.

Examples:

Markup
{{bq |text=Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. |sign=Anne O. Nymus |source=<cite>The Unlightable Being of Bareness</cite>, 1992, p. 37}}
Renders as

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

—Anne O. Nymus, The Unlightable Being of Bareness, 1992, p. 37
Markup
{{bq |text=Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. |2=Anne O. Nymus |3=1992, "Introduction", pp. vii–ix |4=<cite>The Unlightable Being of Bareness</cite>}}
Renders as

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

—Anne O. Nymus, 1992, "Introduction", pp. vii–ix, The Unlightable Being of Bareness

Working around display problems[edit]

Lists and other complexities Complex markup may require a simple trick to work around a longstanding MediaWiki bug; this is the inclusion of the code <nowiki /> immediately after the |1= (or |text= if the content following the = begins with a linebreak:

This fails:
Markup Renders as
{{bq|1=
* Foo
* Bar
* Baz
}}

* Foo

  • Bar
  • Baz
This works properly:
Markup Renders as
{{bq|1=<nowiki />
* Foo
* Bar
* Baz
}}
  • Foo
  • Bar
  • Baz

This tweak unfortunately cannot be put into the template code itself, as the <nowiki /> markup doesn't pass through the transclusion process.

Multiple paragraphs

The <blockquote> element and any templates that use it do not honor newlines:

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

Line 1 Line 2 Line 3 Line 4

To work around this, use the <poem> tag inside <blockquote>, which will convert line breaks to br tags:

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

Line 1
Line 2
Line 3
Line 4

URLs and other breakage

Make sure that all the parameters are named (e.g. |1=, etc. or with word names like |source=). Many URLs, and plenty of other things, contain the "=" character, which due to MediaWiki limitations, will cause the template to malfunction if used in an unnamed parameter.

See also[edit]

Block quotations

  • Template:Bq – quote without border, page-wide; like (and compatible with parameters of) the older {{Quote}} but with more features; conversion from all others listed here is trivially easy (retaining key data, losing decoration, etc.)
  • Template:Pull quote – pull quote between large quotation marks, page-wide; should rarely be used in articles and is not for block quotations, only pull quotes
  • Template:Quote—quote without border, page-wide, smaller-sized attribution
  • Template:Quotation – quote with border, page-wide
  • Template:Quote box – quote with border, in a reduced floating box
  • Template:Reduced pull quote – pull quote between large quotation marks, in a reduced floating area; also rarely appropriate in articles
  • Template:Talkquote – for quoting other editors (or guidelines, etc.) on talk pages (in a block)
  • Template:Tq – for quoting on talk pages, inline
  • Template:Gbq – A {{Bq}} variant for use in glossaries (less vertical padding)
  • Category:Quotation templates

Semantic markup

Template Example output Use
{{strong}} strong semantic emphasis To indicate <strong> emphasis instead of (or as well as) simple typographical boldfacing.
{{strongbad}} "Never use..." Same as {{strong}} but in red.
{{stronggood}} "Only use..." Same as {{strong}} but in green.
{{em}} mild semantic emphasis As per {{strong}} but for the milder <em> emphasis (instead of / as well as typographical italicization).
{{var}} strPrefix To indicate text is a variable name. Use for any variables except those whose names include "I" (uppercase i) and/or "l" (lowercase L), where {{varserif}} below should be used instead to ensure a distinction between these letters is noticeable.
{{varserif}} strIllustratePrefix (see {{var}} above).
{{wikivar}} {{PAGENAME}}  {{DEFAULTSORT:Y, X}} To display wikicode variables and magic words as they would appear in code.
{{para}} |title=  |year=2008 To display template parameters with or without values.
{{param}} {{{title}}}  {{{title|alt}}}  etc. To display parameters as used in code (i.e. with triple braces), especially to indicate relationships between them. May be combined with {{para}} above.
{{tlx}} etc. {{Template|first parameter|...}} To display a template call (with or without parameters and values) as code.
{{tag}} "With HTML <img>...</img> tags..." To render HTML elements ("tags") as prose.
{{code}} "Always include the alt= parameter..." To indicate text is source code. To nest other templates within {{code}}, use <code>...</code>.
{{subst:CoNo}} <code><nowiki>your code</nowiki></code> To wrap example code in <code> and nested <nowiki> tags.
{{syntaxhighlight}} (or {{sxhl}})  Wrapper for <syntaxhighlight>...</syntaxhighlight>, but will wrap overflowing text.
{{deprecated code}} "Do not use <blink>." (or {{dc}})  To indicate deprecated source code in template documentation, articles on HTML specs, etc. The {{dc2}} variant uses strike-through: <blink>, and {{dc|red=y}} uses red: <blink>.
{{pre}} For larger blocks of source code and other pre-formatted text.
{{bq}} For indented blocks of content, such as block quotations, examples, poems, etc.
{{kbd}} user input To indicate user input.
{{key press}} CtrlX To indicate specific-keystroke input.
{{pskeypress}} × To indicate PlayStation-style gamepad key presses.
{{samp}} example output To indicate sample or example output.