Template:Blockquote paragraphs: Difference between revisions

Nothing to hide, but nothing to show you either.
Jump to navigation Jump to search
Content added Content deleted
(color fix)
m (52 revisions imported from wikipedia:Template:Blockquote_paragraphs)
 
(39 intermediate revisions by 23 users not shown)
Line 1: Line 1:
----
Due to the utterly intractable [[MediaWiki]] bug reported at {{bugzilla|6200}}, and still unfixed {{as of|February 2012|lc=y}}, block quoting on Wikipedia, with or without a template, cannot handle freeform linebreaking for paragraphs and poems and the like, unless formatted one very specific (and annoying) way.
''(This section is transcluded from [[Template:Blockquote paragraphs]])''

<div style="float: right; padding: 0 1em;">{{navbar|Blockquote paragraphs|plain=y}}</div>
{{collapse top|title=<div style="text-align: left;">The problem in action: test cases that seem like they should work but fail</div>|bg=#EEEEEE|bg2=#ECFCF4}}<div class="collapse-workaround">
The {{code|lang=html|code=<blockquote>}} element and any templates that use it do not honor newlines:
The intuitive choice:
{{markup

|<syntaxhighlight lang="html">
<blockquote><code><nowiki>{{</nowiki><includeonly>{{BASEPAGENAME}}</includeonly><noinclude>bq</noinclude>|Line 1<br />
<blockquote>
Line 2<br />
Line 3<br />
Line 1
Line 4}}</code></blockquote>

results in the mangled:

{{<includeonly>{{BASEPAGENAME}}</includeonly><noinclude>bq</noinclude>|Line 1
Line 2
Line 2
Line 3
Line 3
Line 4}}
Line 4
</blockquote>

</syntaxhighlight>
Blank lines seem to work at first:
|<blockquote>

Line 1
<blockquote><code><nowiki>{{</nowiki><includeonly>{{BASEPAGENAME}}</includeonly><noinclude>bq</noinclude>|Line 1<br />
<br />
Line 2<br />
<br />
Line 3<br />
<br />
Line 4}}</code></blockquote>

though with quite tall spacing between the content blocks (lines, in our test cases):

{{<includeonly>{{BASEPAGENAME}}</includeonly><noinclude>bq</noinclude>|Line 1

Line 2
Line 2

Line 3
Line 3
Line 4
</blockquote>
}}


An easy solution is to use the {{tl|poemquote}} template instead of {{xtag|blockquote}}. This is effectively the same as using the {{xtag|poem}} tag inside {{code|lang=html|code=<blockquote>}}, which converts line breaks to {{code|lang=html|code=<br />}} tags:
Line 4}}
{{markup

|<syntaxhighlight lang="html">
Yet this markup fails with wiki ":" indentation:
<blockquote><poem>

Line 1
:{{<includeonly>{{BASEPAGENAME}}</includeonly><noinclude>bq</noinclude>|Line 1

Line 2
Line 2

Line 3
Line 3
Line 4
</poem></blockquote>
</syntaxhighlight>
|<blockquote><poem>
Line 1
Line 2
Line 3
Line 4
</poem></blockquote>
}}


To markup actual paragraphs within block quotations, entire blank lines can be used between them, which will convert to {{code|lang=html|code=<p>...</p>}} tags:
Line 4}}


{{markup
Just trying to use {{tag|p}} or {{tag|br|single}} markup won't solve all the problems:
|<syntaxhighlight lang="html">
<blockquote>
Paragraph 1


Paragraph 2
<blockquote><code><nowiki>{{</nowiki><includeonly>{{BASEPAGENAME}}</includeonly><noinclude>bq</noinclude>|Line 1&lt;br/><br />
Line 2&lt;br/><br />
Line 3&lt;br/><br />
Line 4}}</code></blockquote>


Paragraph 3
results in odd spacing, with the middle blocks too close together:
</blockquote>
</syntaxhighlight>
|<blockquote>
Paragraph 1


Paragraph 2
{{<includeonly>{{BASEPAGENAME}}</includeonly><noinclude>bq</noinclude>|Line 1<br/>
Line 2<br/>
Line 3<br/>
Line 4}}


Paragraph 3
Meanwhile this version seems ok at first:
</blockquote>
}}


This paragraph style also works with {{tl|quote}}, which is a replacement for {{xtag|blockquote}} that also has parameters to make formatting of the attribution more conveniently and consistently.
<blockquote><code><nowiki>{{</nowiki><includeonly>{{BASEPAGENAME}}</includeonly><noinclude>bq</noinclude>|&lt;p>Line 1&lt;/p><br />
----
&lt;p>Line 2&lt;/p><br />
{{Documentation}}
&lt;p>Line 3&lt;/p><br />
&lt;p>Line 4&lt;/p>}}</code></blockquote>


<!-- Categories go on the /doc subpage. -->
{{<includeonly>{{BASEPAGENAME}}</includeonly><noinclude>bq</noinclude>|<p>Line 1</p>
<p>Line 2</p>
<p>Line 3</p>
<p>Line 4</p>}}


but again can't be indented:

:{{<includeonly>{{BASEPAGENAME}}</includeonly><noinclude>bq</noinclude>|<p>Line 1</p>
<p>Line 2</p>
<p>Line 3</p>
<p>Line 4</p>}}

{{collapse bottom}}

{{As of|February 2012}}, the {{em|only}} solution for the problem is to use {{em|unbroken markup}} with {{tag|p}} or {{tag|br|single}} elements (or others, like nested blockquotes and lists):

:{{tnull|<includeonly>{{BASEPAGENAME}}</includeonly><noinclude>bq</noinclude>|Line 1&lt;br/>Line 2&lt;br/>Line 3&lt;br/>Line 4.}}

which, while hard to read, especially for long content, results in the expected:

{{<includeonly>{{BASEPAGENAME}}</includeonly><noinclude>bq</noinclude>|Line 1<br/>Line 2<br/>Line 3<br/>Line 4.}}

And it {{em|does}} work with wikimarkup ":" indentation, unlike the failed test cases above:

:{{<includeonly>{{BASEPAGENAME}}</includeonly><noinclude>bq</noinclude>|Line 1<br/>Line 2<br/>Line 3<br/>Line 4.}}

Happily, there is an HTML-comment workaround for readability that lets you do whatever you want:

<blockquote><code><nowiki>
{{</nowiki><includeonly>{{BASEPAGENAME}}</includeonly><noinclude>bq</noinclude>|1=&lt;!--<br />
-->Line 1&lt;br/>&lt;!--<br />
-->Line 2&lt;br/>&lt;!--<br />
-->Line 3&lt;br/>&lt;!--<br />
-->Line 4.}}
</code></blockquote>

or even:

<blockquote><code><nowiki>
{{</nowiki><includeonly>{{BASEPAGENAME}}</includeonly><noinclude>bq</noinclude>|1=&lt;!--<br />
<br />
-->Line 1&lt;br/>&lt;!--<br />
<br />
-->Line 2&lt;br/>&lt;!--<br />
<br />
-->Line 3&lt;br/>&lt;!--<br />
<br />
-->Line 4.}}
</code></blockquote>

which results in the expected:

{{<includeonly>{{BASEPAGENAME}}</includeonly><noinclude>bq</noinclude>|1=<!--

-->Line 1<br/><!--

-->Line 2<br/><!--

-->Line 3<br/><!--

-->Line 4.}}

They {{em|are}} indentable:

:{{<includeonly>{{BASEPAGENAME}}</includeonly><noinclude>bq</noinclude>|1=<!--
-->Line 1<br/><!--
-->Line 2<br/><!--
-->Line 3<br/><!--
-->Line 4.}}
<noinclude>
{{Documentation}}
<!--Categories and interwikis go on the /doc subpage.-->
</noinclude>
</noinclude>

Latest revision as of 19:48, 31 May 2021


(This section is transcluded from Template:Blockquote paragraphs)

The <blockquote> element and any templates that use it do not honor newlines:

Markup Renders as
<blockquote>
Line 1
Line 2
Line 3
Line 4
</blockquote>

Line 1 Line 2 Line 3 Line 4

An easy solution is to use the {{poemquote}} template instead of <tag>. This is effectively the same as using the <poem> tag inside <blockquote>, which converts line breaks to <br /> tags:

Markup Renders as
<blockquote><poem>
Line 1
Line 2
Line 3
Line 4
</poem></blockquote>

<poem>

Line 1 Line 2 Line 3 Line 4

</poem>

To markup actual paragraphs within block quotations, entire blank lines can be used between them, which will convert to <p>...</p> tags:

Markup Renders as
<blockquote>
Paragraph 1

Paragraph 2

Paragraph 3
</blockquote>

Paragraph 1

Paragraph 2

Paragraph 3

This paragraph style also works with {{quote}}, which is a replacement for <tag> that also has parameters to make formatting of the attribution more conveniently and consistently.