Community Central
Community Central
(Undo revision 6785 by 35.13.201.134 (talk))
No edit summary
(33 intermediate revisions by 23 users not shown)
Line 1: Line 1:
  +
{{Extension infobox
{{enabled by default}}
 
  +
| name = Poem
  +
| author =
  +
* Nikola Smolenski
  +
* Brion Vibber
  +
* Steve Sanbeg
  +
| link = [[mw:Extension:Poem|MediaWiki.org]]
  +
| desc = {{int:poem-desc}}
  +
| default = yes
 
}}
  +
{{tocright}}
 
The '''poem extension''' allows for easy inclusion of poems and similar material on articles, by simply putting them between <code>&lt;poem>&lt;/poem&gt;</code> tags, instead of adding <code>&lt;br&gt;</code> to the end or <code>:</code> to the beginning of every line.
   
  +
== How it works ==
The '''poem extension''' allows for easy inclusion of poems and similar material in MediaWiki pages, by simply putting them between &lt;poem></poem&gt; tags, instead of adding &lt;br&gt; to the end or : to the beginning of every line, which is common practice now. The extension preserves wikilinks, bolding, etc. if they are present in the poem, as well as indenting lines which start with spaces.
 
  +
The extension preserves [[Help:Links|wikilinks]], bolding, ''etc.'' if they are present in the poem, as well as lines that begin with spaces. Note that the spaces will be rendered in whatever font is being used and will have different widths based on the font.
   
  +
Beginning a line with a colon (<code>:</code>) will wrap the line in a <code>&lt;span class="mw-poem-indented" style="margin-left: 1em;"&gt;</code> tag with a left margin of <code>+1em</code> for each colon. You may use the <code>mw-poem-indented</code> class to apply additional styling to indented lines.
==Example==
 
  +
{| cellspacing=5
 
  +
=== A simple example ===
!Input text
 
  +
The following text in Source mode:
!Output
 
  +
<pre>
|-
 
|valign=top|<pre><poem>
+
<poem>
In [[Wikipedia:Xanadu|Xanadu]] did Kubla Khan
+
In Xanadu did [[wikipedia:Kubla Khan|Kubla Khan]]
 
A stately pleasure-dome decree:
 
A stately pleasure-dome decree:
Where Alph, the sacred river, ran
+
:Where Alph, the sacred river, ran
 
Through caverns measureless to man
 
Through caverns measureless to man
Down to a sunless sea.
+
Down to a sunless sea.
   
 
So twice five miles of fertile ground
 
So twice five miles of fertile ground
Line 21: Line 33:
 
And here were forests ancient as the hills,
 
And here were forests ancient as the hills,
 
Enfolding sunny spots of greenery.
 
Enfolding sunny spots of greenery.
</poem></pre>
+
</poem>
  +
</pre>
|valign=top|
 
  +
renders as:
 
<poem>
 
<poem>
In [[Wikipedia:Xanadu|Xanadu]] did Kubla Khan
+
In Xanadu did [[wikipedia:Kubla Khan|Kubla Khan]]
 
A stately pleasure-dome decree:
 
A stately pleasure-dome decree:
Where Alph, the sacred river, ran
+
:Where Alph, the sacred river, ran
 
Through caverns measureless to man
 
Through caverns measureless to man
Down to a sunless sea.
+
Down to a sunless sea.
   
 
So twice five miles of fertile ground
 
So twice five miles of fertile ground
Line 37: Line 50:
 
Enfolding sunny spots of greenery.
 
Enfolding sunny spots of greenery.
 
</poem>
 
</poem>
|}
 
   
  +
== Styling a poem ==
==Style==
 
The poem text is wrapped in a div, which has no style by default, but inherits any ''style'' or ''class'' option passed to the poem.
+
The poem text is wrapped in a div, which has no style by default, but inherits any '''style''' or '''class''' option passed to the poem.
   
For example, while indented text can be used for simple examples to prevent filling and draw a nice blue box, it can be hard to read in some cases, since long lines aren't broken. A similar, but somewhat better effect can be obtained with <pre><poem style="border: 1px dashed #2f6fab;background-color: #eeeeee; padding:1em"></pre>
+
For example: <code><nowiki><poem style="text-align: center; border: 2px dashed #2f6fab; background-color: #eeeeee; color: #000; padding: 1em;"></nowiki></code>
When applied to the above example, the result is as follows:
 
<poem style="border: 1px dashed #2f6fab; background-color: #eeeeee; padding:1em">
 
In [[Wikipedia:Xanadu|Xanadu]] did Kubla Khan
 
A stately pleasure-dome decree:
 
Where Alph, the sacred river, ran
 
Through caverns measureless to man
 
Down to a sunless sea.
 
   
  +
===Styling example===
So twice five miles of fertile ground
 
  +
The following text in Source mode:
With walls and towers were girdled round:
 
  +
<pre>
And there were gardens bright with sinuous rills,
 
 
<poem style="text-align: center; border: 2px dashed #2f6fab; background-color: #eeeeee; color: #000; padding: 1em;">
Where blossomed many an incense-bearing tree;
 
  +
The limerick packs laughs anatomical
And here were forests ancient as the hills,
 
  +
Into space that is quite economical.
Enfolding sunny spots of greenery.
 
  +
But the good ones I’ve seen
  +
So seldom are clean
  +
And the clean ones so seldom are comical.
 
</poem>
 
</poem>
  +
</pre>
  +
renders as:
  +
<poem style="text-align: center; border: 2px dashed #2f6fab; background-color: #eeeeee; color: #000; padding: 1em;">
  +
The limerick packs laughs anatomical
  +
Into space that is quite economical.
  +
But the good ones I’ve seen
  +
So seldom are clean
  +
And the clean ones so seldom are comical.
  +
</poem>
  +
 
== "Compact" option ==
 
Normally, the parser renders each poem in a paragraph (<code>&lt;p&gt;</code> tag) inside the <code>&lt;div&gt;</code>. Occasionally this is not desired; using the ''compact'' option (<code>&lt;poem compact&gt;</code>) suppresses paragraphs in the poem, to allow adjacent compact poems to blend together.
  +
  +
== See also ==
  +
* [[Help:HTML|HTML]] and [[Help:Wikitext|Wikitext help]]
  +
* [[mw:Extension:Poem|Extension:Poem]] at MediaWiki.org
   
  +
== Further help and feedback ==
=="compact" option==
 
  +
{{Help and feedback section}}
Normally, the parser renders each poem in a paragraph. Occasionally this is not desired; using the ''compact'' option suppresses newlines in the poem, to allow adjacent compact poems to blend together.
 
   
  +
[[fr:Aide:Poem]]
[[Category:Help|{{PAGENAME}}]]
 
  +
[[hi:सहायता:कविता]]
  +
[[pl:Pomoc:Poezja]]
  +
[[pt:Ajuda:Poema]]
  +
[[ru:Справка:Стихи]]
  +
[[tr:Yardım:Şiir]]
  +
[[uk:Довідка:Вірші]]
  +
[[vi:Trợ giúp:Thơ]]
  +
[[zh:Help:詩歌]]
 
[[Category:Help]]

Revision as of 12:47, 6 May 2021

The poem extension allows for easy inclusion of poems and similar material on articles, by simply putting them between <poem></poem> tags, instead of adding <br> to the end or : to the beginning of every line.

How it works

The extension preserves wikilinks, bolding, etc. if they are present in the poem, as well as lines that begin with spaces. Note that the spaces will be rendered in whatever font is being used and will have different widths based on the font.

Beginning a line with a colon (:) will wrap the line in a <span class="mw-poem-indented" style="margin-left: 1em;"> tag with a left margin of +1em for each colon. You may use the mw-poem-indented class to apply additional styling to indented lines.

A simple example

The following text in Source mode:

<poem>
In Xanadu did [[wikipedia:Kubla Khan|Kubla Khan]]
A stately pleasure-dome decree:
:Where Alph, the sacred river, ran
Through caverns measureless to man
                    Down to a sunless sea.

So twice five miles of fertile ground
With walls and towers were girdled round:
And there were gardens bright with sinuous rills,
Where blossomed many an incense-bearing tree;
And here were forests ancient as the hills,
Enfolding sunny spots of greenery.
</poem>

renders as:

In Xanadu did Kubla Khan
A stately pleasure-dome decree:
Where Alph, the sacred river, ran
Through caverns measureless to man
                    Down to a sunless sea.

So twice five miles of fertile ground
With walls and towers were girdled round:
And there were gardens bright with sinuous rills,
Where blossomed many an incense-bearing tree;
And here were forests ancient as the hills,
Enfolding sunny spots of greenery.

Styling a poem

The poem text is wrapped in a div, which has no style by default, but inherits any style or class option passed to the poem.

For example: <poem style="text-align: center; border: 2px dashed #2f6fab; background-color: #eeeeee; color: #000; padding: 1em;">

Styling example

The following text in Source mode:

<poem style="text-align: center; border: 2px dashed #2f6fab; background-color: #eeeeee; color: #000; padding: 1em;">
The limerick packs laughs anatomical
Into space that is quite economical.
But the good ones I’ve seen
So seldom are clean
And the clean ones so seldom are comical.
</poem>

renders as:

The limerick packs laughs anatomical
Into space that is quite economical.
But the good ones I’ve seen
So seldom are clean
And the clean ones so seldom are comical.

"Compact" option

Normally, the parser renders each poem in a paragraph (<p> tag) inside the <div>. Occasionally this is not desired; using the compact option (<poem compact>) suppresses paragraphs in the poem, to allow adjacent compact poems to blend together.

See also

Further help and feedback