[Mediawiki-l] Understanding <p> behaviour in template expansion.

The Gadget Doctor mediawiki at thegadgetdoctor.com
Fri Sep 21 13:08:55 UTC 2007


I have a few templates to which I pass extended blocks of text. These can be
multi-paragraph with new lines in them that are supposed to break into
paragraphs.

The template looks like this:

<div class="wmd-cite-heading">
==='''[{{{web link}}} {{{title}}} - {{{date}}}]''' {{ #if: {{{author|}}}|by
[[{{{author}}}]]}} - [[{{{source}}}]]===
{{ #if: {{{extract|}}}|<div class="wmd-cite"><span
class="wmd-cite-sechead">Extract:</span>{{{extract}}}</div>}}
</div>

When I pass {{{extract}}} I seem to get unpredictable behaviour. Sometimes
the blank lines between paragraphs turn into paragraphs with <p> ... </p>
tags and sometimes they don't. I've tracked down the issue and it seems to
be that I need to pass at least three paragraphs! If I pass two (exactly)
then they run together:

{{Web citation
|web link=http://www.google.com
|title=Test
|author=Me
|date=Month dd, YYYY
|source=none
|wmdsays=
|extract=para1

para2}}

{{Web citation
|web link=http://www.google.com
|title=another test
|author=someone else
|date=July 1, 2002
|source=Some place on the net
|extract=A longer para1.

Para2

Para3}}

Gives:

<div class="wmd-cite"><span class="wmd-cite-sechead">Extract:</span>para1
para2</div>

and
<div class="wmd-cite"><span class="wmd-cite-sechead">Extract:</span>A longer
para1.
<p>Para2

</p>
Para3</div>

OK... Para1 and Para3 are not inside <p></p> but I'll cope but why must I
have 3 paras not 2?

Bit of an esoteric question but I'd love to know.

Gadgetdoctor

Is there some speciall secret when passing multi line parameters?


More information about the MediaWiki-l mailing list