Community Central
Community Central
mNo edit summary
Tag: Help
(35 intermediate revisions by 24 users not shown)
Line 1: Line 1:
{{enabled by default}}
+
{{Enabled by default}}
   
  +
{{tocright}}
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 '''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 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.
Minister of our coming doom, preaching
 
   
  +
=== A simple example ===
On the car radio, how right
 
  +
The following text in Source mode:
 
  +
<pre>
Your Hell and damnation sound to me
 
  +
<poem>
 
  +
In Xanadu did [[wikipedia:Kubla Khan|Kubla Khan]]
As I travel these small, bleak roads
 
  +
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
Thinking of the mailman’s son
 
  +
With walls and towers were girdled round:
 
  +
And there were gardens bright with sinuous rills,
The Army sent back in a sealed coffin.
 
  +
Where blossomed many an incense-bearing tree;
 
  +
And here were forests ancient as the hills,
 
  +
Enfolding sunny spots of greenery.
 
  +
</poem>
His house is around the next turn.
 
  +
</pre>
 
  +
renders as:
A forlorn mutt sits in the yard
 
  +
<poem>
 
  +
In Xanadu did [[wikipedia:Kubla Khan|Kubla Khan]]
Waiting for someone to come home.
 
 
I can see the TV is on in the living room,
 
 
Canned laughter in the empty house
 
 
Like the sound of beer cans tied to a hearse.
 
 
==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.
 
 
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>
 
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:
 
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 50: Line 43:
 
</poem>
 
</poem>
   
  +
== Styling a poem ==
=="compact" option==
 
 
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.
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.
 
  +
  +
For example: <code><nowiki><poem style="text-align: center; border: 2px dashed #2f6fab; background-color: #eeeeee; color: #000; padding: 1em;"></nowiki></code>
  +
  +
===Styling example===
  +
The following text in Source mode:
  +
<pre>
 
<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>
  +
</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 ==
  +
{{Help and feedback section}}
  +
  +
[[fr:Aide:Poem]]
  +
[[hi:सहायता:कविता]]
  +
[[pl:Pomoc:Poezja]]
  +
[[pt:Ajuda:Poema]]
  +
[[ru:Справка:Стихи]]
  +
[[tr:Yardım:Şiir]]
  +
[[uk:Довідка:Вірші]]
  +
[[vi:Trợ giúp:Thơ]]
  +
[[zh:Help:詩歌]]
   
[[Category:Help|{{PAGENAME}}]]
+
[[Category:Help]]
  +
[[Category:Extensions]]

Revision as of 09:49, 15 September 2021

This extension is enabled by default on Fandom.

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