Difference between revisions of "Template:Blockquote paragraphs"
(creating page) |
(loop fix) |
||
Line 7: | Line 7: | ||
<blockquote><code><nowiki> | <blockquote><code><nowiki> | ||
− | {{</nowiki>{{BASEPAGENAME}}|1=<!--<br /> | + | {{</nowiki><includeonly>{{BASEPAGENAME}}</includeonly><noinclude>bq</noinclude>|1=<!--<br /> |
-->Line 1<br/><!--<br /> | -->Line 1<br/><!--<br /> | ||
-->Line 2<br/><!--<br /> | -->Line 2<br/><!--<br /> | ||
Line 17: | Line 17: | ||
<blockquote><code><nowiki> | <blockquote><code><nowiki> | ||
− | {{</nowiki>{{BASEPAGENAME}}|1=<!--<br /> | + | {{</nowiki><includeonly>{{BASEPAGENAME}}</includeonly><noinclude>bq</noinclude>|1=<!--<br /> |
<br /> | <br /> | ||
-->Line 1<br/><!--<br /> | -->Line 1<br/><!--<br /> | ||
Line 30: | Line 30: | ||
Result of either: | Result of either: | ||
− | {{{{BASEPAGENAME}}|1=<!-- | + | {{<includeonly>{{BASEPAGENAME}}</includeonly><noinclude>bq</noinclude>|1=<!-- |
-->Line 1<br/><!-- | -->Line 1<br/><!-- |
Revision as of 17:51, 2 February 2012
Due to the utterly intractable MediaWiki bug reported at Template:Bugzilla, block quoting cannot handle freeform linebreaking for paragraphs and poems and the like. The Template:Em solution for this is to use unbroken markup with {{#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:|
|
}} or {{#if:|
|
}}{{#switch:single
|c|close = |s|single |o|open |p|pair = <br{{#if:| {{{params}}}}}
}}{{#switch:single
|c|close = |s|single = /> |o|open = > |p|pair = >...
}}{{#switch:single
|s|single |o|open = |c|close |p|pair = </br>
}}{{#if:|
|
}} elements:
Which results in:
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: |
}}
However there is an HTML-comment workaround for readability that lets you do whatever you want, and is even indentable with
*, : and #
markup:{{bq|1=<!--
-->Line 1<br/><!--
-->Line 2<br/><!--
-->Line 3<br/><!--
-->Line 4.}}Or even:
{{bq|1=<!--
-->Line 1<br/><!--
-->Line 2<br/><!--
-->Line 3<br/><!--
-->Line 4.}}Result of either:
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Please add categories to the /doc subpage. Subpages of this template.