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?)
m (71 revisions imported: Export Template:Quote from mediawiki.org)
 
(39 intermediate revisions by 29 users not shown)
Line 1: Line 1:
 
{{Documentation subpage}}
 
{{Documentation subpage}}
  
'''{{tl|Quote}}''' adds a [[block quote]] to an article page.
+
{{For|linking a subject to a collection of quotes on [[Wikiquote]]|Template:Wikiquote}}
  
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.
+
== Usage ==
  
Note: Block quotes do not normally contain quotation marks.  See [[Block quote#Formatting block quotations|Formatting block quotations]].
+
{{tlx|Quote}} adds a [[block quotation]] to an article page.
  
'''Note: This template does work correctly if the phrase contains characters found in some URLs.'''
+
This is easier to type and more wiki-like than the equivalent [[HTML]] {{tag|blockquote}} tags, and has additional pre-formatted attribution and source parameters. <!-- THIS WORKAROUND FAILED; see talk page and its archives. New workaround provided hereafter. It also contains a workaround for [[Bugzilla:6200]], which means you don't need to type {{tag|p}} tags manually. -->
  
=== Usage ===
+
'''Note:''' Block quotes do not normally contain quotation marks. See [[MOS:QUOTE]].
  
<code><nowiki>{{Quote|Phrase}}</nowiki></code> produces:
+
=== Synopsis ===
  
{{Quote|Phrase}}
+
;Unnamed (positional) parameters
 +
<code><nowiki>{{quote|phrase|person|source}}</nowiki></code>
 +
This markup will fail if any parameter contains an equals sign (=).
  
<code><nowiki>{{Quote|Phrase|Somebody}}</nowiki></code> produces:
+
;Numbered (positional) parameters
 +
<code><nowiki>{{quote|1=phrase|2=person|3=source}}</nowiki></code>
  
{{Quote|Phrase|Somebody}}
+
;Named parameters
 +
<code><nowiki>{{quote|text=phrase|sign=person|source=source}}</nowiki></code>
  
<code><nowiki>{{Quote|Phrase|Somebody|''Source''}}</nowiki></code> produces:
+
=== Example ===
  
{{Quote|Phrase|Somebody|''Source''}}
+
;Wikitext:
 +
<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>
  
=== Example ===
+
;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}}
  
<!-- for the documentation don't subst the result -->
+
=== Restrictions ===
{| class="wikitable"
 
| '''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 ===
+
If you do not provide quoted text, the template generates a parser error message, which will appear in red text in the rendered page.
  
Phrases containing some URLs are not displayed at all:
+
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|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''}}
+
Be wary of URLs which contain restricted characters. The equals sign is especially common.
  
<code><nowiki>
+
=== Multiple paragraphs ===
{{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''}}
+
{{Blockquote paragraphs}}
  
=== See also ===
+
== TemplateData ==
 +
{{TemplateDataHeader}}
 +
<templatedata>{
 +
  "description": "Adds a block quotation.",
 +
  "params": {
 +
    "text": {
 +
      "label": "text",
 +
      "description": "The text to quote",
 +
      "type": "string",
 +
      "required": false,
 +
      "aliases": [ "1", "quote" ]
 +
    },
 +
    "sign": {
 +
      "label": "sign",
 +
      "description": "The person who is being quoted",
 +
      "type": "string",
 +
      "required": false,
 +
      "aliases": [ "2", "cite" ]
 +
    },
 +
    "source": {
 +
      "label": "source",
 +
      "description": "A source for the quote",
 +
      "type": "string",
 +
      "required": false,
 +
      "aliases": [ "3" ]
 +
    }
 +
  }
 +
}</templatedata>
  
 +
== See also ==
 
{{Quotation templates see also}}
 
{{Quotation templates see also}}
  
 
<includeonly>
 
<includeonly>
{{pp-template|small=yes}}
+
<!-- ADD CATEGORIES AFTER THIS LINE -->
<!-- ADD CATEGORIES BELOW THIS LINE -->
+
[[Category:Quotation templates|Quote]]
[[Category:Quotation templates|{{PAGENAME}}]]
+
[[Category:Semantic markup templates]]
 
+
[[ar:قالب:اقتباس]]
<!-- ADD INTERWIKIS BELOW THIS LINE -->
+
[[as:Template:Quote]]
 +
[[bg:Шаблон:Цитат]]
 +
[[ca:Plantilla:Citació]]
 +
[[cs:Šablona:Citace]]
 +
[[cy:Nodyn:Dyfyniad]]
 +
[[da:Skabelon:Citat]]
 +
[[de:Vorlage:Zitat]]
 +
[[dsb:Pśedłoga:Citat]]
 
[[es:Plantilla:Cita]]
 
[[es:Plantilla:Cita]]
 
[[eo:Ŝablono:Citaĵo]]
 
[[eo:Ŝablono:Citaĵo]]
 +
[[eu:Txantiloi:Aipua]]
 +
[[fa:الگو:نقل قول]]
 +
[[fi:Malline:Cquote]]
 
[[fr:modèle:citation]]
 
[[fr:modèle:citation]]
 +
[[gl:Modelo:Cita]]
 +
[[gu:ઢાંચો:ઉક્તિ]]
 +
[[he:Template:ציטוט]]
 +
[[hi:साँचा:Quote]]
 +
[[hsb:Předłoha:Citat]]
 +
[[hu:Sablon:Idézet]]
 +
[[hy:Կաղապար:Քաղվածք]]
 +
[[id:Templat:Quote]]
 +
[[is:Snið:Tilvitnun]]
 
[[it:Template:quote]]
 
[[it:Template:quote]]
 
[[ja:Template:Quote]]
 
[[ja:Template:Quote]]
 +
[[ka:თარგი:ციტირება]]
 +
[[kk:Үлгі:Cquote]]
 +
[[ky:Калып:Цитата]]
 +
[[la:Formula:Locus]]
 +
[[lv:Veidne:Quotation]]
 +
[[mwl:Modelo:Quote]]
 
[[no:Mal:Sitat]]
 
[[no:Mal:Sitat]]
[[th:แม่แบบ:คำพูด]]
+
[[os:Хуызæг:Cquote]]
[[zh-yue:Template:Quote]]
+
[[pl:Szablon:Cytat]]
[[zh:Template:Quote]]
+
[[pt:Predefinição:Quote]]
 +
[[ro:Format:Cquote]]
 +
[[ru:Шаблон:Цитата]]
 +
[[sco:Template:Quote]]
 +
[[sh:Šablon:Citat]]
 +
[[sk:Šablóna:Citát]]
 +
[[sl:Predloga:Citatni blok]]
 +
[[sv:Mall:Citat]]
 
</includeonly>
 
</includeonly>

Latest revision as of 21:40, 28 January 2018

{{#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]]
                  |
                 }}
        }}
    | 
   }}

Usage[edit]

{{[[{{#if:|{{{SISTER}}}Template|Template}}:Quote|Quote]]{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||...}}}} adds a block quotation 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, and has additional pre-formatted attribution and source parameters.

Note: Block quotes do not normally contain quotation marks. See MOS:QUOTE.

Synopsis[edit]

Unnamed (positional) parameters

{{quote|phrase|person|source}} This markup will fail if any parameter contains an equals sign (=).

Numbered (positional) parameters

{{quote|1=phrase|2=person|3=source}}

Named parameters

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

Example[edit]

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[edit]

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.

Multiple paragraphs[edit]

{{#if:y||This box: }}{{#if:|[}}{{#if:|v|view}} · {{#if:|d|talk}}{{#if:|| · {{#if:|e|edit}}}}{{#if:|]}}

The {{#if:|

|

}}{{#switch:o

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

}}{{#switch:o

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

}}{{#switch:o

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

}}{{#if:|

|

}} element and any templates that use it do not honor newlines:

{{#if: | |+ {{{title}}}}} {{#if: || ! style="width:50%" scope="col" | Markup}} {{#if: || ! style="width:50%" scope="col" | Renders as}}{{#if: <blockquote> Line 1 Line 2 Line 3 Line 4 </blockquote>

<blockquote>
Line 1
Line 2
Line 3
Line 4
</blockquote>

Line 1 Line 2 Line 3 Line 4

}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}

To resolve this, use the {{#switch:pair

|c|close  = 
|s|single
|o|open
|p|pair   = <{{#switch:poem
|categorytree=categorytree
|charinsert=charinsert
|gallery=gallery
|hiero=hiero
|imagemap=imagemap
|inputbox=inputbox
|math=math
|nowiki=nowiki
|poem=poem
|pre=pre
|ref=ref
|references=references
|section=section
|score=score
|source=source
|syntaxhighlight=syntaxhighlight
|templatedata=templatedata
|timeline=timeline
|#default=tag

}}{{#if:| {{{params}}}}} }}{{#switch:open

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

}}{{#switch:open

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

}} tag inside {{#if:|

|

}}{{#switch:o

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

}}{{#switch:o

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

}}{{#switch:o

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

}}{{#if:|

|

}}:

{{#if: | |+ {{{title}}}}} {{#if: || ! style="width:50%" scope="col" | Markup}} {{#if: || ! style="width:50%" scope="col" | Renders as}}{{#if: <blockquote><poem> Line 1 Line 2 Line 3 Line 4 </poem></blockquote>

<blockquote><poem>
Line 1
Line 2
Line 3
Line 4
</poem></blockquote>
<poem>

Line 1 Line 2 Line 3 Line 4

</poem>

}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}{{#if: |


}}

TemplateData[edit]

{{#if:| |This is the TemplateData documentation for this template used by VisualEditor and other tools.}}

Quote

{{#ifeq:doc|sandbox||

}} <templatedata>{

 "description": "Adds a block quotation.",
 "params": {
   "text": {
     "label": "text",
     "description": "The text to quote",
     "type": "string",
     "required": false,
     "aliases": [ "1", "quote" ]
   },
   "sign": {
     "label": "sign",
     "description": "The person who is being quoted",
     "type": "string",
     "required": false,
     "aliases": [ "2", "cite" ]
   },
   "source": {
     "label": "source",
     "description": "A source for the quote",
     "type": "string",
     "required": false,
     "aliases": [ "3" ]
   }
 }

}</templatedata>

See also[edit]

Template:Tnavbar

Similar templates comparison: