সাঁচ:Ppoem
Lua error in Module:Lua_banner at line 113: attempt to index field 'edit' (a nil value).
| This template uses TemplateStyles: |
Usage
[সম্পাদনা কৰক]Ppoem, a.k.a. Proper Poem.
- Parameters
- 1 the poem content
- gutter
left,rightorboth. You should use this if you use line or verse numbers and they don't occur in the first instance of the template (it's automatically determined if they do). - class extra classes to set on the outer ppoem div
- align text-alignment to set on the outer ppoem div (e.g.
center) - style extra styles to set on the outer ppoem div
- lang the lang code to set for the outer ppoem div (same codes as {{lang}}, e.g.
frorla, etc.)
Special syntax:
- Lines that start with
>>are right aligned. - Lines that start with
<>are centred. - Lines that end with
>>> XXXhave a line number "XXX" appended at the right, past the right margin - Lines that start with
XXX <<<have a verse/line number "XXX" on the left, past the left margin - Lines that start with
+XX>are indented relatively to the line XX lines further up.+>can be used instead of+1>. - Lines that start with
{class}have the HTML class namedws-poem-classapplied. This can be targeted by TemplateStyles CSS (and some are predefined in Template:Ppoem/styles.css) - Leading spaces are converted to
- Leading colons are converted to
 
You can control the stanzas with similar syntax:
- Blank lines start a new stanza.
- Stanzas prefixed with
{class}have the HTML class namedws-poem-classapplied to the whole following stanza. This can be targeted by TemplateStyles CSS (and some are predefined in Template:Ppoem/styles.css) - Stanzas prefixed with
>>are block-right-aligned. - Stanzas prefixed with
<>are centred.
The lines have a default 4em hanging indent, which is roughly consistent with most printed poetry:
It can be disabled by giving any value to no_hi.
Page breaks
[সম্পাদনা কৰক]The template works across page breaks and produces a single poem container (unlike the <poem> tag).
The start and end parameters control how the sections join up. Each has four options: open/close (which is the default), follow, stanza and same-line:
- For the first section, use start=open (or omit the parameter)
- For a section that ends a stanza, use end=stanza, and start the next one with start=stanza
- For a section that doesn't end a stanza (so the next section continues in the same stanza), the first section sets end=follow and the next uses start=follow.
- For a line that continues onto the next page, the first section sets end=same-line and the next uses start=same-line.
- For the last section, use end=close (or omit).
This means that the end parameter of one section and the start of the next must always be the same. It also means that for a simple poem in a single section, you do not need either start or end.
For example, for a template spanning four pages:
In the page namespace, the template always opens and closes the ppoem tags, so it will appear correctly in both page and mainspace (as long as any abutting ppoems on previous/following pages use matching start and end parameters).
Drop initials
[সম্পাদনা কৰক]Floated content, such as {{dropinitial}}s, should be placed as normal:
Braces
[সম্পাদনা কৰক]Braced lines work as expected (using the >>> syntax for right-floats):
Floating punctuation
[সম্পাদনা কৰক]No changes are needed for floating punctuation, e.g. with {{fqm}}
Gutter width
[সম্পাদনা কৰক]Some poems have very long line numbers. In this case, the default gutter width of 2em may not be enough. You can modify the gutters of poems using the Index-based CSS and set a wider padding on the left or right of relevant .ws-poem-line elements.
Poems with a left gutter are denoted by the class .ws-poem-left-gutter on the top-level poem container, added automatically when the <<< syntax is used, or gutter is set to left or both). Right gutters (>>> syntax or gutter set to right or both) work the same way.
In the case below, every poem in a given work that has a left gutter has the line padding increased to 3em:
/* Increase the gutter because the line numbers have up to 4 digits */
.ws-poem-left-gutter .ws-poem-line {
padding-left: 3em;
}
Comparison with <poem>
[সম্পাদনা কৰক]Below is a comparison of the output of this template and the <poem> tag (or manual <br/>, which is equivalent), rendered as an EPUB on an e-reader.
With poem tag/<br/>:

With {{ppoem}}, there are hanging indents and right-alignment not causing a paragraph break:

Advantages
[সম্পাদনা কৰক]- Simple syntax for common cases
- Handles hanging indent which resolves the problem of ambiguous new lines
- Semantically more correct: lines are spans, and stanzas are paragraphs, poems are divs
- Can continue a line across a page break (which can't be done with
<poem>) - Combines into a single element even when transcluded from multiple pages
- Copy-pastes as separate lines
- Exports sensibly
- Automatic block-centering (which can't be done with
<poem>because the separate elements don't have the same widths) - Very easy to apply CSS classes to lines or stanzas
- Drop-in replacement for
<poem>
Disadvantages
[সম্পাদনা কৰক]- Some care is needed to match the start and end parameters across pages.
- Dropinitials can sometimes cause a line to wrap prematurely (can be avoided by adding length to the first line, such as with {{em}}).
- Because this is a single template and cannot be split, poems must escape
=and|character[১]
Notes
[সম্পাদনা কৰক]- ↑ Unless it becomes an extension.
Template data
[সম্পাদনা কৰক]Format a poem nicely
| পেৰামিটাৰ | বিৱৰণ | প্ৰকাৰ | স্থিতি | |
|---|---|---|---|---|
| 1 | 1 | The poem content
| সমল | প্ৰয়োজনীয় |
| start | start | The start type: one of open, stanza, follow, same-line. If this is not "open", this MUST use the same value as the previous {{ppoem}}'s "end" parameter.
| শাৰী | প্ৰস্তাৱিত |
| end | end | The closure type: one of close, stanza, follow, same-line. If this is not "close", the next {{ppoem}} MUST use the same value for it's "start" parameter.
| শাৰী | প্ৰস্তাৱিত |
| lang | lang | Language code to apply to the whole poem
| শাৰী | ঐচ্ছিক |
| class | class | CSS classes to add to the entire poem. Use this if you would like to target the whole poem for styling with a CSS rule.
| শাৰী | ঐচ্ছিক |
Categories
[সম্পাদনা কৰক]- Feature usage tracking for custom classes
See also
[সম্পাদনা কৰক]| The above documentation is transcluded from সাঁচ:Ppoem/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |