Jump to content

Extension talk:Poem/Archive 1

From mediawiki.org
Latest comment: 13 years ago by 118.209.6.73 in topic Breaks Headings
The following discussion has been transferred from Meta-Wiki.
Any user names refer to users of that site, who are not necessarily users of MediaWiki.org (even if they share the same username).

Name of the extension

The extension doesn't actually have a great deal to do with poems. Shouldn't it be called.... I dont know... <withnewlines> or something? -- Harry Wood 11:21, 26 January 2007 (UTC)

In retrospect, something like nofill or such may have been clearer. But formatting poems was the first use of it, and it's somewhat entrenched now, so renaming it or creating an alias may make things more confusing. -Sanbeg 18:18, 2 February 2007 (UTC)

Just use ':'

Common practice seems to be the use of : at the beginning of every line in a poem or song. It's a lot simpler than installing an extension, and it's a lot easier to type (IMHO) than <br />. – Minh Nguyễn (talk, contribs) 04:12, 8 March 2006 (UTC)

It indents the lines, which isn't always desirable. Nikola 06:23, 14 May 2006 (UTC)
This is obviously not true. It's much easier to use an extension than : at the begginning of every line. Thanks a lot to the developers for this long awaited feature. Yann 11:03, 24 June 2006 (UTC)

Problem with multiple transcluded poems

I wanted to use this for a project on a local wiki, but hit a problem. I wanted a page that transcluded a lot of other pages; each of these would contain a <poem> section. But strangely, every poem except the last one appears as strings like "UNIQ29a12c162018b230-poem15b3442f6e2c665300000001". A demonstration of this effect is here. /skagedal... 22:01, 19 April 2006 (UTC)

The corrected version fixes this. (At least with 1.7; possibly with 1.6 also.) --brion 12:48, 8 May 2006 (UTC)

Great

I am using this extension and I found it great. It is exactly what I was looking for.

Thanks,

Luis

I made a minor change to this extension to allow my poets to indent lines. It may not generate perfectly clean HTML, but it works for our needs:


function PoemExtension($in)
{
        global $wgOut;

        return $wgOut->parse(
                preg_replace(
                        array("/^\n/","/\n$/D","/\n/"),
                        array("",     "",      "<br />\n"),
                        str_replace(' ','&nbsp;',$in))
        );
}

(note, the wiki code is not perfect, as it involves character entities. I chose to make it display properly in the wiki view.)

fix to nest with nowiki

Since there's no entry in bugzilla for this extension, I guess I'll just post this bug here. This extension produces very strange results when it contains a nested nowiki: it renders html line breaks!

I took a quick look, it seems tricky to deal with in 1.7, but 1.8 has some new hooks to fix this, so I put a patch @ User:Sanbeg/poem-nw.patch -Sanbeg 23:09, 3 October 2006 (UTC)

Not working in extra namespaces

I have installed this extension on my own mediawiki site and am attempting to use it on a talk page in a custom namespace. The result is this text:

???UNIQ5d6e41292e61d388-poem-00000000-QINU?

This is similar to a previous problem, but I grabbed the latest version from SVN before posting this. The example (seen here) isn't very useful, but if you check the history, you can see a piece of what I typed. --Aquatiki 10:31, 5 May 2008 (UTC)

Using poem in a template

Hi

I'm trying to create my own template that works something like this:


some text

{{{1}}}

some more text


From my understanding of the extension page, this should work, but it only prints out {{{1}}} instead of the text I supply as the parameter.

Replaced by core functionality...how?

This page says that the poem formatting is present without the need for an extension--in an unreleased future version. For the time being, the "obsolete" notice should be removed, because it made downloading it a 20 minute exercise in frustration, since I assumed the latest version was, in fact, 1.14...when it's actually 1.13.

How does one use it? I've spent ten minutes searching, and the closest thing in the user help is the preformatted text option, which is NOT a replacement for poem formatting (which I would like to use on my wiki, which is predominantly recipes--I don't want to insert ANY character at the beginning of each line, whether it's a space, a colon, or an asterisk. What is the tag for that? -- 24.130.217.24 10:03, 12 November 2008 (UTC)

<poem> appears to break template expansion

I ran across this in wikipedia, which has the poem extension installed, and also has a bunch of templates.

In wikipedia, the wikitext: <poem>{{citation |author=me |title=abracadabra}}</poem> appears to break the expansion of the Citation template. The template expands as expected with the <poem>...</poem> wrapper removed. -- Boracay Bill 06:32, 5 June 2009 (UTC)

Compact option does not work with more than two lines

Compact option seems to work with two lines, but not with more than two. :-(

See here. This runs:

<poem compact>
First 
Second 
</poem>
<poem compact>
Third 
Fourth 
</poem>
First
Second
Third
Fourth

This doesn't:

<poem compact>
First 
Second
Third 
Fourth
</poem>
<poem compact>
First 
Second
Third 
Fourth 
</poem>
First

Second
Third

Fourth
First

Second
Third

Fourth

and I can't guess how to solve this issue. :-( --Alex brollo 20:41, 20 August 2009 (UTC)

Clash with <noinclude>

When transcluding multiple pages with <poem> wrappers, one may wish to <noinclude> the head and/or end tags of <poem> to allow for the original poem tag to set the formatting, however, <poem> misbehaves with <noinclude> and basically stops working as expected. I have insufficient knowledge of how it works to be able express a possible solution. — billinghurst sDrewth 08:31, 6 May 2010 (UTC)

Enhancements

It would be nice if this extension supported auto-numbering of stanzas (i.e. paragraphs) and side-by-side translations. Crissov 16:03, 17 May 2010 (UTC)

Inside poem "tag"

Please be patient for so long a post, but this comes from a peace after a long fight with poem tag... and I'd like to share my thoughts with you.

Poem is really tricky, into its double character of "div class" and "software compiling directive". As a "software directive", it's absolutely needed that both opening and closing tag are on the same page, into its raw text (this explains why you can't enclose it into a template, nor do any "noinclude trick"). Nevertheless it's effect is really simple. Take a look to this, then browse the wikicode.

How poem works

The following verses don't use poem tag:

Lasciate ogni speranza voi ch'entrate,
    Per me si va tra la perduta gente
    per me si va nell'eterno dolore

The resulting html code is the following:

<div class="poem">
<p>Lasciate ogni speranza voi ch'entrate,<br>
&nbsp;&nbsp;&nbsp;&nbsp;Per me si va tra la perduta gente<br>
&nbsp;&nbsp;&nbsp;&nbsp;per me si va nell'eterno dolore</p>
</div>

On the contrary, here I used the tag poem:

Lasciate ogni speranza voi ch'entrate,
    Per me si va tra la perduta gente
    per me si va nell'eterno dolore

As you can see browsing the source html of this page, the resulting html code is absolutely identical:

<div class="poem">
<p>Lasciate ogni speranza voi ch'entrate,<br>
&nbsp;&nbsp;&nbsp;&nbsp;Per me si va tra la perduta gente<br>
&nbsp;&nbsp;&nbsp;&nbsp;per me si va nell'eterno dolore</p>

</div>

So the tag poem, as a compiler directive, does these:

  1. opens and closes a div "class=poem";
  2. opens and closes a single p;
  3. converts new lines into br tags;
  4. converts any space at the beginning of the rows into &nbsp; html entities.

No more than this.

There's a "chaining issue" when a poem tagged text follows another poem tagged text. This comes from css settings of <div class="poem"> and <p>; the latter, in particular, inherits its css from environment, so you could be confused by differences of poem behavior into different namespaces or div. Any trouble and any strange behavior can be fixed assigning specific and explicit css attributes both to .poem and to .poem p jus as fr.source fellows (THANKS!) did:

.poem { 
	margin-bottom: 0em; 
	margin-top: 0em; 
	line-height: 1.6em;
	margin-left: 2.5em;
	text-indent: 0em;
}
.poem p { 
	margin-top: 0em ! important; 
	margin-bottom: 0em ! important; 
	text-indent: 0em !important;
}

We added this code to our s:it:MediaWiki:Common.css and a long lasting war came to its end. :-)

A code testing your css

Take a look to this table:

riga1
riga2
riga 3
riga 4

     riga1
     riga2
     riga 3
     riga 4

    riga1
    riga2
    riga3
    riga4

The first uses : wiki markup; the second poem tag; the third simply the <br /> tag. Are all the rows perfectly aligned? If they are not, css settings of <dd> and <dt> tags, of .poem and .poem p classes, and of plain line height are to be edited, then many of some subtle issues will be fixed. :-) --Alex brollo 07:28, 18 May 2010 (UTC)

Suggestions for improvement

  • Source (author, book, year, …)
  • Translation, line by line
  • “//” as an alternative line divider

90.136.55.202 15:57, 18 March 2011 (UTC)

Extension breaks comments

As it can be seen on [1], this extension can break comments. The comments enclosed between <!-- and --> end prematurely when the tags are enclosed within the comments which might be a problem if a page using the tags contains instructions on how to edit it. Nlemslu Phlyshi 19:18, 2 July 2011 (UTC)

Breaks Headings

Headings within the <Poem> tags don't work. they just display like: ==Heading== 118.209.6.73 13:13, 30 November 2011 (UTC)