Extension:Poem
Poem Release status: stable |
|
---|---|
File:Gci mediwiki.png | |
Implementation | Tag |
Description | Adds <poem> tag for poem formatting |
Author(s) | Nikola Smolenskitalk |
Latest version | continuous updates |
MediaWiki | 1.25+ |
Database changes | No |
License | Creative Commons Zero v1.0 Universal |
Download | |
<poem> |
|
Quarterly downloads | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Public wikis using | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Translate the Poem extension if it is available at translatewiki.net | |
Issues | Open tasks · Report a bug |
The Poem extension allows easy formatting of poems and similar material within Wikitext .
Once the extension is enabled, you can put any block of text within <poem></poem>
tags, which has the following effects:
- All newlines are preserved by converting them into
<br />
tags - The block of text is enclosed in
<p>...</p>
tags (as well as a div of class "poem") - Colons at the beginning of a line are converted into 1 em indentation
- Spaces at the beginning of a line are preserved and no longer invoke the
<pre>
tag
The extension preserves wikilinks, bolding, etc. if they are present in the poem.
Usage
Example
Input text | Output |
---|---|
<poem>
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.
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>
|
<poem> 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. </poem> |
Example with indentation
Input text | Output |
---|---|
<poem>
Une terre au flanc maigre, âpre, avare, inclément
Où les vivants pensifs travaillent tristement,
::Et qui donne à regret à cette race humaine
Un peu de pain pour tant de labeur et de peine ;
::Des hommes durs, éclos sur ces sillons ingrats ;
Des cités d’où s’en vont, en se tordant les bras,
::La charité, la paix, la foi, sœurs vénérables ;
L’orgueil chez les puissants et chez les misérables ;
</poem>
|
<poem> Une terre au flanc maigre, âpre, avare, inclément Où les vivants pensifs travaillent tristement,
Un peu de pain pour tant de labeur et de peine ;
Des cités d’où s’en vont, en se tordant les bras,
L’orgueil chez les puissants et chez les misérables ; </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.
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:
<poem style="border: 2px solid #d6d2c5; background-color: #f9f4e6; padding: 1em;">
When applied to the above example, the result is as follows:
<poem style="border: 2px solid #d6d2c5; background-color: #f9f4e6; padding: 1em;"> 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. </poem>
"compact" option
Applying the <poem>
tag with the compact option to a text of more than two lines, every line becomes a separate paragraph.
(That is to say, it allows for more compact markup, not for a more compact output.)
Subsequent use of the <poem>
tag with the compact option, with up to two newlines in between, gives just a single newline between texts, not a new paragraph.
Thus, applied to texts of more than two lines each, every line becomes a separate paragraph, except that the last line of each text and the first line of the next text are combined into one paragraph.
Input | Output | Input | Output |
---|---|---|---|
<poem>
One,
Two.
</poem>
<poem>
Three?
Four!
</poem>
|
<poem> One, Two. </poem> <poem> Three? Four! </poem> |
<poem compact>
One,
Two.
</poem>
<poem compact>
Three?
Four!
</poem>
|
<poem compact> One, Two. </poem> <poem compact> Three? Four! </poem> |
Input | Output | Input | Output |
---|---|---|---|
<poem>
One,
Two.
Extra.
</poem>
<poem>
Three?
Four!
Extra.
</poem>
|
<poem> One, Two. Extra. </poem> <poem> Three? Four! Extra. </poem> |
<poem compact>
One,
Two.
Extra.
</poem>
<poem compact>
Three?
Four!
Extra.
</poem>
|
<poem compact> One, Two. Extra. </poem> <poem compact> Three? Four! Extra. </poem> |
Problems and solutions
- Variables and ParserFunctions do work inside the
<poem>...</poem>
container, but NOT within the<poem ... >
tag itself; this prevents templates with code such as<poem style="{{{1}}}">
. - One workaround is to use
<div style="{{{1}}}"><poem> ... </poem></div>
instead. - Another way is to use the
#tag
magic word: {{#tag:poem| ... |style="{{{1}}}"}}.- NB: this would however seem not to work with the "compact" option.
Input (inside OK, within not OK) | Output |
---|---|
<poem style="{{{1|border: 1px solid Black;}}}">
One,
{{{2|Two.}}}
</poem>
|
<poem style="border: 1px solid Black;"> One, Two. </poem> |
Input (both inside and within OK) | Output |
<div style="{{{1|border: 1px solid Black;}}}">
<poem>
One,
{{{2|Two.}}}
</poem>
</div>
|
<poem> One, Two. </poem> |
{{#tag:poem|
One,
{{{2|Two.}}}
|style="{{{1|border: 1px solid Black;}}}"
}}
|
<poem style="border: 1px solid Black;"> One, Two. </poem> |
Installation
- <translate> [[<tvar name=2>Special:ExtensionDistributor/Poem</tvar>|Download]] and move the extracted <tvar name=name>
Poem
</tvar> folder to your <tvar name=ext>extensions/
</tvar> directory.</translate>
<translate> Developers and code contributors should install the extension [[<tvar name=git>Special:MyLanguage/Download from Git</tvar>|from Git]] instead, using:</translate>cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Poem - <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
wfLoadExtension( 'Poem' );
- File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>
<translate> Vagrant installation:</translate>
- <translate> If using <tvar name=vagrant>Vagrant </tvar>, install with <tvar name=code>
vagrant roles enable poem --provision
</tvar></translate>
File:Wikimedia-logo black.svg | <translate> This {{<tvar name=1>#ifeq:Extension|Extension</tvar>|extension|skin}} is being used on one or more [[<tvar name=2>m:Special:MyLanguage/Wikimedia projects</tvar>|Wikimedia projects]].</translate> <translate> This probably means that the {{<tvar name=1>#ifeq:Extension|Extension</tvar>|extension|skin}} is stable and works well enough to be used by such high-traffic websites.</translate> <translate> Look for this {{<tvar name=1>#ifeq:Extension|Extension</tvar>|extension's|skin's}} name in Wikimedia's <tvar name=2>CommonSettings.php</tvar> and <tvar name=3>InitialiseSettings.php</tvar> configuration files to see where it's installed.</translate> <translate> A full list of the {{<tvar name=1>#ifeq:Extension|Extension</tvar>|extensions|skins}} installed on a particular wiki can be seen on the wiki's <tvar name=ver>Special:Version</tvar> page.</translate> |
Gci mediwiki.png |
- Pages with script errors
- Extensions bundled with MediaWiki 1.21
- Pages with broken file links
- Stable extensions
- Tag extensions
- Extensions without a compatibility policy
- Extensions with manual MediaWiki version
- Public domain licensed extensions
- Extensions in Wikimedia version control
- ParserFirstCallInit extensions
- All extensions
- Extensions used on Wikimedia