Template:Quote box/doc

From Linguifex
Jump to navigation Jump to search


Usage

The {{quote box}} template allows you to easily put a quote (and its source) inside a box, with flexible control over bordering, background color, alignment, and other features. The box itself is floating div, which (like images) can appear on the right or left or across the entire page. Article text will wrap around the div in the first two cases. This is useful in articles that are short on images and need some graphic-like element, or where an important or interesting quote wants to be presented in a way that sets it off from the surrounding text.

Caution: This is a div-based template, and may break if indented using wikitext syntax. This is a current limitation of the Wikipedia HTML parsing software.

Parameters

Basic parameters

  • title = Optional title to appear at the top of the quote box.
  • quote = The quote or text to be displayed in the box.
  • source = Optional source of the quote (author, publication, etc.).

Main box styling

  • align: Alignment of the quote box on the page—left / right / center / none. Defaults to right alignment. Using align=none will remove word wrapping.
  • width: The width of the quote box. Defaults to the width of the quote included, unless |align=center where the width will default to 100%.
  • border: The width of the quote box border. Defaults to 1px. Remember to include 'px' or 'em' to specify the correct width.
  • fontsize: The fontsize of the quote box text. Defaults to 88%.
  • bgcolor: The RGB background color of the box. Defaults to #F9F9F9 (light gray).
  • style: A generic CSS style parameter. Entries in this parameter supersede any duplicates in the preceding parameters.

Title styling

  • title_bg: The RGB background color of the title. Defaults to #F9F9F9 (light gray).
  • title_fnt: The title font color. Defaults to black.
  • tstyle: A generic CSS style parameter. Entries in this parameter supersede any duplicates in the preceding title parameters.

Quote styling

  • qalign: Alignment of the quote element—left / right / center. Defaults to left.
  • qstyle: A generic CSS style parameter. Entries in this parameter supersede any duplicates in the preceding quote parameters.
  • quoted: If this parameter evaluates to true (is not 0, false, or empty) the quote box will enclose the quote in fat-quotes. Use judiciously, and read the Manual of Style.

Source styling

  • salign: Alignment of the source element—left / right / center. Defaults to the value of qalign.
  • sstyle: A generic CSS style parameter. Entries in this parameter supersede any duplicates in the preceding source parameters.

Full syntax

{{Quote box
 |class = <!-- Advanced users only.  See the "Custom classes" section below. -->
 |title = 
 |quote = 
 |source = 
 |align = 
 |width = 
 |border = 
 |fontsize = 
 |bgcolor = 
 |style = 
 |title_bg = 
 |title_fnt = 
 |tstyle = 
 |qalign = 
 |qstyle = 
 |quoted = 
 |salign = 
 |sstyle = 
}}

Examples

Various example codes and their results. For more intricate examples see Template:Quote_box/examples.

Floating and wrapping

Minimal code, defaults to floating right and minimal width:

{{Quote box
 |quote  = Cry "Havoc", and let slip the dogs of war.
 |source = [[William Shakespeare]], ''[[Julius Caesar (play)|Julius Caesar]]'', Act III, Scene I.
}}
{{Lorem ipsum}}

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

Template:Lorem ipsum

Floating right:

{{Quote box
 |quote  = Cry "Havoc", and let slip the dogs of war.
 |source = [[William Shakespeare]], ''[[Julius Caesar (play)|Julius Caesar]]'', Act III, Scene I.
 |width  = 50%
 |align  = right
}}
{{Lorem ipsum}}

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

Template:Lorem ipsum

Floating left:

{{Quote box
 |quote  = Cry "Havoc", and let slip the dogs of war.
 |source = [[William Shakespeare]], ''[[Julius Caesar (play)|Julius Caesar]]'', Act III, Scene I.
 |width  = 50%
 |align  = left
}}
{{Lorem ipsum}}

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

Template:Lorem ipsum

Centered (but not floating any more):

{{Quote box
 |quote  = Cry "Havoc", and let slip the dogs of war.
 |source = [[William Shakespeare]], ''[[Julius Caesar (play)|Julius Caesar]]'', Act III, Scene I.
 |width  = 50%
 |align  = center
}}
{{Lorem ipsum}}

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

Template:Lorem ipsum

Fat-quotes

Using fat-quotes:

{{Quote box
 |quote  = Cry "Havoc", and let slip the dogs of war.
 |source = [[William Shakespeare]], ''[[Julius Caesar (play)|Julius Caesar]]'', Act III, Scene I.
 |quoted = 1
}}

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

Quote alignment

{{Quote box
 |title = Centered quote
 |quote  = Cry "Havoc", and let slip the dogs of war.
 |source = [[William Shakespeare]], ''[[Julius Caesar (play)|Julius Caesar]]'', Act III, Scene I.
 |qalign = center
}}
Centered quote

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

{{Quote box
 |title = Left title, right quote
 |tstyle = text-align: left;
 |quote  = Cry "Havoc", and let slip the dogs of war.
 |source = [[William Shakespeare]], ''[[Julius Caesar (play)|Julius Caesar]]'', Act III, Scene I.
 |qalign = right
}}
Left title, right quote

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

Custom classes

This parameter should only be used by editors who fully understand how this template works.

The "class=" parameter can be used add a generic CSS class to this template. Some classes are not compatible with other options or require specific options be set to be useful or look good.

Letterhead custom class

The "letterhead" class should be used with |title_bg=none, |border=none, and |bgcolor= either not used or set to "none". Since the upper-left-corner will have a white background, it should only be used on pages with a white background.

Care should be taken that neither the title nor the text extends into the "left corner" portion of the box. To use a blank line for a title, use |title= . To provide a blank line at the bottom of the letterhead, add <br /><br /> to the end of the |source= parameter.

{{Quote box
 |class = letterhead
 |title =  
 |tstyle = text-align: right;
 |title_bg = none
 |border=none
 |quote  = Cry "Havoc", and let slip the dogs of war.
 |source = [[William Shakespeare]], ''[[Julius Caesar (play)|Julius Caesar]]'', Act III, Scene I. <br /><br />
 |qalign = right
}}
 

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

William Shakespeare, Julius Caesar, Act III, Scene I.

Collapsing text

Sections of text can be collapsed by use of {{hidden begin}} and {{hidden end}}.

Template:Markup

Note that, although |halign=center, the centering is reset after the {{hidden begin}}, since that template applies its own styling. This can be resolved by using |bodystyle= in {{hidden begin}} with appropriate markup; in this case:

{{hidden begin |bodystyle=width: auto; margin-left: auto; margin-right: auto;}}

Template:Markup

TemplateData

Template:TemplateDataHeader <templatedata>{

 "description": "Put a quote, and its source, inside a box, with flexible control over bordering, background color, alignment, and other features",
 "params": {
   "class": {
     "label": "class",
     "description": "Optional CSS class to modify or override the default class quotebox.  Care should be used when using this parameter.  Consider using other templates instead.  See the Custom classes section of this document for more information.",
     "type": "string",
     "required": false
   },
   "title": {
     "label": "title",
     "description": "Optional title to appear at the top of the quote box.",
     "type": "string",
     "required": false
   },
  "quote": {
     "label": "quote",
     "description": "The quote or text to be displayed in the box.",
     "type": "string",
     "required": true
   },
  "source": {
     "label": "source",
     "description": "Optional source of the quote (author, publication, etc.).",
     "type": "string",
     "required": false
   },
  "align": {
     "label": "align",
     "description": "Alignment of the quote box on the page—left / right / center / none. Defaults to right alignment. Using align=none will remove word wrapping.",
     "type": "string",
     "required": false
   },
  "width": {
     "label": "width",
     "description": "The width of the quote box. Defaults to the width of the quote included, unless align=center where the width will default to 100%. Use CSS lengths eg. 50% or 400px",
     "type": "string",
     "required": false
   },
  "border": {
     "label": "border",
     "description": "The width of the quote box border. Defaults to 1px. Remember to include 'px' or 'em' to specify the correct width.",
     "type": "string",
     "required": false
   },
  "fontsize": {
     "label": "fontsize",
     "description": "The fontsize of the quote box text. Defaults to 88%.",
     "type": "string",
     "required": false
   },
  "bgcolor": {
     "label": "bgcolor",
     "description": "The RGB background color of the box. Defaults to #F9F9F9 (light gray).",
     "type": "string",
     "required": false
   },
  "style": {
     "label": "style",
     "description": "A generic CSS style parameter. Entries in this parameter supersede any duplicates in the preceding parameters.",
     "type": "string",
     "required": false
   },
  "title_bg": {
     "label": "title_bg",
     "description": "The RGB background color of the title. Defaults to #F9F9F9 (light gray).",
     "type": "string",
     "required": false
   },
  "title_fnt": {
     "label": "title_fnt",
     "description": "The title font color. Defaults to black.",
     "type": "string",
     "required": false
   },
  "tstyle": {
     "label": "tstyle",
     "description": "A generic CSS style parameter. Entries in this parameter supersede any duplicates in the preceding title parameters.",
     "type": "string",
     "required": false
   },
  "qalign": {
     "label": "qalign",
     "description": "Alignment of the quote element—left / right / center. Defaults to left.",
     "type": "string",
     "required": false
   },
  "qstyle": {
     "label": "qstyle",
     "description": "A generic CSS style parameter. Entries in this parameter supersede any duplicates in the preceding quote parameters.",
     "type": "string",
     "required": false
   },
  "quoted": {
     "label": "quoted",
     "description": "If this parameter evaluates to true (is not 0, false, or empty) the quote box will enclose the quote in fat-quotes. Use judiciously, and read the Manual of Style.",
     "type": "string",
     "required": false
   },
  "salign": {
     "label": "salign",
     "description": "Alignment of the source element—left / right / center. Defaults to the value of qalign.",
     "type": "string",
     "required": false
   },
  "sstyle": {
     "label": "sstyle",
     "description": "A generic CSS style parameter. Entries in this parameter supersede any duplicates in the preceding source parameters.",
     "type": "string",
     "required": false
   }
 }

}</templatedata>

See also

Template:Quotation templates see also