| This code base is maintained by theReader Experience team.Code review only for UBNs or security fixes. |
Release status: stable | |
|---|---|
| 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> | |
| Translate the Poem extension if it is available at translatewiki.net | |
| Issues | Open tasks ·Report a bug |
ThePoem extension allows easy formatting of poems and similar material withinWikitext.Once the extension is enabled, you can put any block of text within<poem></poem> tags, which has the following effects:
<br /> tags<p>...</p> tags (as well as a div of class "poem")<pre> tagThe extension preserves wikilinks, bolding, etc. if they are present in the poem.
Wikisource provides the best usage model for this extension.It uses several templates and a module to create indentation, line numbers, etc.SeeWikisource:Help:Poetry for an explanation of how this is used there.This requiresExtension:Scribunto andExtension:TemplateStyles, which are both now bundled as standard.
| Input text | Output |
|---|---|
<poem>In [[Wikipedia:Xanadu|Xanadu]] did Kubla KhanA stately pleasure-dome decree:Where Alph, the sacred river, ranThrough caverns measureless to manDown to a sunless sea.So twice five miles of fertile groundWith 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> | InXanadu did Kubla Khan |
| Input text | Output |
|---|---|
<poem>Une terre au flanc maigre, âpre, avare, inclémentOù les vivants pensifs travaillent tristement, ::Et qui donne à regret à cette race humaineUn 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> | Une terre au flanc maigre, âpre, avare, inclément |
The poem text is wrapped in a div, which has no style by default; but inherits anystyle orclass 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:
<poemstyle="border: 2px solid #d6d2c5; color: var(--color-base, #202122); background-color: var(--background-color-warning-subtle, #fdf2d5); padding: 1em;">
When applied to the above example, the result is as follows:
InXanadu 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.
Applying the<poem> tag with thecompact 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 thecompact 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> | One, Three? | <poemcompact>One,Two.</poem><poemcompact>Three?Four!</poem> | One, Two. Three? Four! |
| Input | Output | Input | Output |
|---|---|---|---|
<poem>One,Two.Extra.</poem><poem>Three?Four!Extra.</poem> | One, Three? | <poemcompact>One,Two.Extra.</poem><poemcompact>Three?Four!Extra.</poem> | One, Two. Three? Four! |
<poem>...</poem> container, but NOT within the<poem...> tag itself; this prevents templates with code such as<poemstyle="{{{1}}}">.<divstyle="{{{1}}}"><poem> ...</poem></div> instead.#tagmagic word:{{#tag:poem| ... |style="{{{1}}}"}}.| Input (inside OK, within not OK) | Output |
|---|---|
<poemstyle="{{{1|border:1pxsolidBlack;}}}">One,{{{2|Two.}}}</poem> | One, |
| Input (both inside and within OK) | Output |
<divstyle="{{{1|border:1pxsolidBlack;}}}"><poem>One,{{{2|Two.}}}</poem></div> | One, |
{{#tag:poem|One,{{{2|Two.}}}|style="{{{1|border: 1px solid Black;}}}"}} | One, |
Poem folder to yourextensions/ directory.cdextensions/gitclonehttps://gerrit.wikimedia.org/r/mediawiki/extensions/PoemwfLoadExtension('Poem');
Vagrant installation:
vagrant roles enable poem --provision| This extension is being used on one or moreWikimedia projects. This probably means that the extension is stable and works well enough to be used by such high-traffic websites. Look for this extension's name in Wikimedia'sCommonSettings.php andInitialiseSettings.php configuration files to see where it's installed. A full list of the extensions installed on a particular wiki can be seen on the wiki'sSpecial:Version page. |
| This extension is included in the following wiki farms/hosts and/or packages:This is not an authoritative list. Some wiki farms/hosts and/or packages may contain this extension even if they are not listed here. Always check with your wiki farms/hosts or bundle to confirm. |