Difference between revisions of "Template:Quote/doc"

From D&D 5e
Jump to: navigation, search
(Note: This template does work correctly if there are URLs in the phrase; Workarounds?)
(update docs for recent change)
Line 3: Line 3:
 
'''{{tl|Quote}}''' adds a [[block quote]] to an article page.
 
'''{{tl|Quote}}''' adds a [[block quote]] to an article page.
  
This is easier to type and more wiki-like than the equivalent HTML <code><nowiki><blockquote></nowiki></code> tags, has additional pre-formatted attribution and source parameters, and contains a workaround for [[Bugzilla:6200]], which means you don't need to type <code><nowiki><p></nowiki></code> tags manually.
+
This is easier to type and more wiki-like than the equivalent HTML {{tag|blockquote}} tags, has additional pre-formatted attribution and source parameters, and contains a workaround for [[Bugzilla:6200]], which means you don't need to type {{tag|p}} tags manually.
  
 
Note: Block quotes do not normally contain quotation marks.  See [[Block quote#Formatting block quotations|Formatting block quotations]].
 
Note: Block quotes do not normally contain quotation marks.  See [[Block quote#Formatting block quotations|Formatting block quotations]].
  
'''Note: This template does work correctly if the phrase contains characters found in some URLs.'''
+
=== Synopsis ===
  
=== Usage ===
+
;Unnamed (positional) parameters
 +
<code><nowiki>{{quote|phrase|person|source}}</nowiki></code>
  
<code><nowiki>{{Quote|Phrase}}</nowiki></code> produces:
+
; Named parameters
 
+
<code><nowiki>{{quote|text=phrase|sign=person|source=source}}</nowiki></code>
{{Quote|Phrase}}
 
 
 
<code><nowiki>{{Quote|Phrase|Somebody}}</nowiki></code> produces:
 
 
 
{{Quote|Phrase|Somebody}}
 
 
 
<code><nowiki>{{Quote|Phrase|Somebody|''Source''}}</nowiki></code> produces:
 
 
 
{{Quote|Phrase|Somebody|''Source''}}
 
  
 
=== Example ===
 
=== Example ===
  
<!-- for the documentation don't subst the result -->
+
; Wikitext:
{| class="wikitable"
+
<code><nowiki>{{quote|text=Cry “Havoc,” and let slip the dogs of war.|sign=[[William Shakespeare]]|source=[[Julius Caesar (play)|Julius Caesar]], Act III, Scene I}}</nowiki></code>
| '''Code'''
 
| '''Result'''
 
|-
 
| valign="top" | <code>{&#123;{{BASEPAGENAME}}&#124;<nowiki>{{lorem ipsum}}</nowiki>|Some Guy Who Thought He Spoke Latin|'&#39;Pseudo-Italic Nonsense&#39;'&#125;}</code>
 
| {{msg:{{BASEPAGENAME}}|{{lorem ipsum}}|Some Guy Who Thought He Spoke Latin|''Pseudo-Italic Nonsense''}}
 
|}
 
  
=== Issues ===
+
; Result:
 +
{{quote|text=Cry “Havoc,” and let slip the dogs of war.|sign=[[William Shakespeare]]|source=[[Julius Caesar (play)|Julius Caesar]], Act III, Scene I}}
  
Phrases containing some URLs are not displayed at all:
+
=== Restrictions ===
  
<code><nowiki>
+
If you do not provide quoted text, the template generates a parser error message, which will appear in red text in the rendered page.
{{Quote|Phrase with a URL: http://w.a.o/d.php?id=T |Somebody|''Source''}}</nowiki></code> produces:
 
  
{{Quote|Phrase with a URL: http://w.a.o/d.php?id=T |Somebody|''Source''}}
+
If any parameter's actual value contains an [[equals sign]] (=), you '''''must''''' use named parameters.  (The equals sign gets interpreted as a named parameter otherwise.)
  
<code><nowiki>
+
If any parameter's actual value contains characters used for wiki markup syntax (such as [[vertical bar|pipe]], [[brackets]], single quotation marks, etc.), you may need to escape it. See [[Template:!]] and friends.
{{Quote|1=Phrase with a URL: http://w.a.o/d.php?id=T |Somebody|''Source''}}</nowiki></code> produces:
 
  
{{Quote|1=Phrase with a URL: http://w.a.o/d.php?id=T |Somebody|''Source''}}
+
Be wary of URLs which contain restricted characters. The equals sign is especially common.
  
 
=== See also ===
 
=== See also ===
 
 
{{Quotation templates see also}}
 
{{Quotation templates see also}}
  

Revision as of 08:07, 30 December 2009

{{#ifeq:doc |doc

    | 

{{#ifeq:show |show

         | Template:Mbox
        }}{{#if: |
         |   {{#ifexist:Template:Quote
                  | [[Category:{{#switch:Template |Template=Template |Module=Module |User=User |#default=Wikipedia}} documentation pages]]
                  |
                 }}
        }}
    | 
   }}

Template:Tl adds a block quote to an article page.

This is easier to type and more wiki-like than the equivalent HTML {{#if:|

|

}}{{#switch:pair

|c|close  = 
|s|single
|o|open
|p|pair   = <blockquote{{#if:| {{{params}}}}}

}}{{#switch:pair

|c|close  = 
|s|single =  />
|o|open   = >
|p|pair   = >...

}}{{#switch:pair

|s|single
|o|open   = 
|c|close
|p|pair   = </blockquote>

}}{{#if:|

|

}} tags, has additional pre-formatted attribution and source parameters, and contains a workaround for Bugzilla:6200, which means you don't need to type {{#if:|

|

}}{{#switch:pair

|c|close  = 
|s|single
|o|open
|p|pair   = <p{{#if:| {{{params}}}}}

}}{{#switch:pair

|c|close  = 
|s|single =  />
|o|open   = >
|p|pair   = >...

}}{{#switch:pair

|s|single
|o|open   = 
|c|close
|p|pair   = </p>

}}{{#if:|

|

}} tags manually.

Note: Block quotes do not normally contain quotation marks. See Formatting block quotations.

Synopsis

Unnamed (positional) parameters

{{quote|phrase|person|source}}

Named parameters

{{quote|text=phrase|sign=person|source=source}}

Example

Wikitext

{{quote|text=Cry “Havoc,” and let slip the dogs of war.|sign=[[William Shakespeare]]|source=[[Julius Caesar (play)|Julius Caesar]], Act III, Scene I}}

Result
Cry “Havoc,” and let slip the dogs of war.
{{#if:William Shakespeare |
William Shakespeare{{#if:Julius Caesar, Act III, Scene I

|, Julius Caesar, Act III, Scene I

}}
}}

Restrictions

If you do not provide quoted 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 named parameters. (The equals sign gets interpreted as a named parameter otherwise.)

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 Template:! and friends.

Be wary of URLs which contain restricted characters. The equals sign is especially common.

See also

Template:Tnavbar

Similar templates comparison: