[Mediawiki-l] Maintaining newline as first line of a template

Jean-Marc van Leerdam j.m.van.leerdam at gmail.com
Thu Jan 21 20:37:28 UTC 2010


Hi,

2010/1/21 Jack D. Pond <jack.pond at psitex.com>:
> MW 1.15.1 (and before)
>
> Does anyone know what causes this and how to remedy?
>
> Wiki code only recognizes table commands ("{|", "|-", "|}") when they begin
> on a new line.  Therefore if your template is using these commands, the
> first line of your template MUST be a newline - otherwise the wiki code is
> likely to be continued on the line in which it is referenced.
>
> In the  mediawiki article editor, this newline is stripped when it is
> re-edited and must be manually reinserted. So if you create a template such
> as this (note the necessary preceeding empty new line):
> --------
>
> {| class="smwtable sortable"
> ! Col Hdr 1
> ! Col Hdr 2
> --------
>
> When you go in and edit again - even though the preceeding new line had been
> saved, it will be removed, and you will need to add it again. Example,
> before line reinserted:
>
> --------
> {| class="smwtable sortable"
> ! Col Hdr 1
> ! Col Hdr 2
> --------
>
> Any ideas?
>

You could circumvent the issue by adding a dummy tag or text on the
first line in the template, like <noinclude></noinclude>. That way the
first line is no longer empty, doesn't get stripped and should have no
further ill side effects.


-- 
Regards,

Jean-Marc
--
.       ___
.  @@  // \\      "De Chelonian Mobile"
. (_,\/ \_/ \     TortoiseSVN
.   \ \_/_\_/>    The coolest Interface to (Sub)Version Control
.   /_/   \_\     http://tortoisesvn.net



More information about the MediaWiki-l mailing list