Template:Bq/doc

From Vita Dev Wiki
Jump to navigation Jump to search


Usage[edit]

This template is to help facilitate the indentation of blocks of content (quotations, computer source code, etc.) with the semantically correct Template:Tag element, which can also be further styled and given metadata. This method is often preferred to using wikimarkup's ";" indentation (actually an abuse of Template:Tag 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 Template:Tag element has semantic meaning, while many tricks for indenting do not, or even have incorrect semantics.

Example:

{{bq|1={{lorem}}}}

which 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 the longwinded <blockquote>{{lorem}}</blockquote> markup:

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.

Note that this example makes use of the "lorem" template-- if you wish to use other text in your own quote (which you almost certainly will) you should not enclose that quote in pairs of template brackets. Doing so will produce a template error and your text will appear in red.

Parameters[edit]

  • Template:Para or Template:Para or Template:Para (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.
  • Template:Para an additional CSS class; it already uses templatequote by default.
  • Template:Para 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.
  • Template:Para inline CSS directives for custom styling, like background color.
  • Template:Para 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, Template:Tnull supports the sourcing parameters (and their aliases) of the older and simpler {{quote}} templates and the frequently abused {{cquote}}, so Template:Tnull 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.

Examples:

{{bq |text={{Lorem}} |sign=Anne O. Nymus |source=''<cite>The Unlightable Being of Bareness</cite>'', 1992, p. 37}}

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

{{bq |1={{Lorem}} |2=Anne O. Nymus |3=1992, "Introduction", pp. vii–ix |4=The Unlightable Being of Bareness}}

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 Template:Para (or Template:Para if the content following the = begins with a linebreak:

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

  • 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

Template:Blockquote paragraphs

URLs and other breakage

Make sure that all the parameters are named (e.g. Template:Para, etc. or with word names like Template:Para). 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:Quotation templates see also

Semantic markup

Template:Var/seealso