User:Wikid77/Fix newline of protect-tag

From Wikipedia, the free encyclopedia

The Template:Fix newline of protect-tag displays an explanation for fixing other templates which have a top newline-bug caused by using a separate line for the edit-protect tag. There are no template parameters needed. The explanation, generated by this template, for fixing that newline-bug, appears as shown below:


Stop the newline-bug caused by the protect-tag. The top line of the template should be changed to join with the 2nd line (and stop the newline) by adding an HTML comment "<!--...-->" as follows:

<noinclude>{{pp-template|small=yes}}</noinclude><!--
--><includeonly>...

In templates like this one, that generate text-only (with no infoboxes, or tables or images), the top protect-tag will generate a newline (after the 1st line), unless it is followed by an HTML comment of the form "<!--...-->" to join the top 2 lines.

This is a systemic problem in Wikipedia, which only affects templates that generate inline-text, because other templates are not affected when they generate most infoboxes, tables or images.

The problem is based on another systemic problem in the MediaWiki markup language: consecutive <xxx> tag-groups sometimes leave newline-breaks when coded on multiple lines, although true HTML coding would suppress newlines between 2 lines of tag groups such as "<table><tr>" followed by line "<td>xxx</td></tr></table>". In true HTML, the newline would be suppressed after coding a "<tr>". The problem could be automatically fixed, for everyone long-term, by fixing MediaWiki to suppress a newline after "</noinclude>" or similar tags. It is a trivial issue, but difficult for some to comprehend.

Anyway, the problem can be expected to re-occur, with other protected templates that generate inline-text.