Community Central
Community Central
Tags: Help sourceedit
mNo edit summary
Tag: Help
(25 intermediate revisions by 18 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.
   
== Example ==
+
== 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.
{| cellspacing=5 style="width:100%;"
 
  +
|-
 
  +
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.
! Input text
 
  +
! Output
 
  +
=== A simple example ===
|- valign="top"
 
  +
The following text in Source mode:
| <pre><poem>
 
  +
<pre>
In [[Wikipedia:Xanadu|Xanadu]] did Kubla Khan
 
 
<poem>
  +
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 22: Line 25:
 
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>
| <poem>
+
</pre>
  +
renders as:
In [[Wikipedia:Xanadu|Xanadu]] did Kubla Khan
 
  +
<poem>
  +
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 42:
 
Enfolding sunny spots of greenery.
 
Enfolding sunny spots of greenery.
 
</poem>
 
</poem>
|}
 
   
== Style ==
+
== 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.
+
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: <code><nowiki><poem style="text-align: center; border: 2px dashed #2f6fab; background-color: #eeeeee; color: #000; padding: 1em;"></nowiki></code>
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
 
   
  +
===Styling example===
<pre><poem style="border:1px dashed #2f6fab; background-color:#eeeeee; color:#000; padding:1em"></pre>
 
  +
The following text in Source mode:
 
  +
<pre>
When applied to the above example, the result is as follows:
 
 
<poem style="text-align: center; border: 2px dashed #2f6fab; background-color: #eeeeee; color: #000; padding: 1em;">
 
  +
The limerick packs laughs anatomical
<poem style="border:1px dashed #2f6fab; background-color:#eeeeee; color:#000; padding:1em">
 
  +
Into space that is quite economical.
In [[Wikipedia:Xanadu|Xanadu]] did Kubla Khan
 
  +
But the good ones I’ve seen
A stately pleasure-dome decree:
 
  +
So seldom are clean
Where Alph, the sacred river, ran
 
  +
And the clean ones so seldom are comical.
Through caverns measureless to man
 
  +
</poem>
Down to a sunless sea.
 
  +
</pre>
 
  +
renders as:
So twice five miles of fertile ground
 
  +
<poem style="text-align: center; border: 2px dashed #2f6fab; background-color: #eeeeee; color: #000; padding: 1em;">
With walls and towers were girdled round:
 
  +
The limerick packs laughs anatomical
And there were gardens bright with sinuous rills,
 
  +
Into space that is quite economical.
Where blossomed many an incense-bearing tree;
 
  +
But the good ones I’ve seen
And here were forests ancient as the hills,
 
  +
So seldom are clean
Enfolding sunny spots of greenery.
 
  +
And the clean ones so seldom are comical.
 
</poem>
 
</poem>
   
 
== "Compact" option ==
 
== "Compact" option ==
Normally, the parser renders each poem in a paragraph. Occasionally this is not desired; using the ''compact'' option (<tt><nowiki><poem compact></nowiki></tt>) suppresses newlines in the poem, to allow adjacent compact poems to blend together.
+
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 ==
 
== See also ==
  +
* [[Help:HTML|HTML]] and [[Help:Wikitext|Wikitext help]]
*[[mw:Extension:Poem|Extension:Poem]] at MediaWiki.org
+
* [[mw:Extension:Poem|Extension:Poem]] at MediaWiki.org
   
  +
== Further help and feedback ==
[[Category:Help|{{PAGENAME}}]]
 
  +
{{Help and feedback section}}
   
  +
[[fr:Aide:Poem]]
  +
[[hi:सहायता:कविता]]
  +
[[pl:Pomoc:Poezja]]
 
[[pt:Ajuda:Poema]]
 
[[pt:Ajuda:Poema]]
  +
[[ru:Справка:Стихи]]
  +
[[tr:Yardım:Şiir]]
  +
[[uk:Довідка:Вірші]]
  +
[[vi:Trợ giúp:Thơ]]
  +
[[zh:Help:詩歌]]
  +
 
[[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