1

Today, I tried to create a template on Portuguese Wikipedia inside one of my subpages. It works fine with this code:

<includeonly>'''{{{num}}}''': <span style="font-family:monospace;">{{{date}}}</span> — [[{{{title}}}]]<!--
--> {{#if:{{{faults|}}}<!--
-->|({{{faults}}})<!--
--->|}}<br /></includeonly>

This code creates items like this:

81: 28/febDer heimliche Aufmarsch gegen die Sowjetunion (one source)

But, I want to do more! The purpose of creating this template isn't just to set the date to monospace fonts... I want to add support for information about translations, and about deletions. Every time I tried to add text about deletions (you can check in the page history), the space between the lines got enormous, making the "lists" very, very ugly...

For example, this is one of the solutions I tried to add deletion information:

<includeonly>'''{{{num}}}''': <span style="font-family:monospace;">{{{date}}}</span> — [[{{{title}}}]]<!--
--> {{#if:{{{faults|}}}<!--
-->|({{{faults}}})<!--
-->|}}<!--
-->{{#if:{{{Speedy-del|{{{Semi-speedy-del|{{{Consensus-del|}}}}}}}}}|
{{#if:{{{Speedy-del|}}}<!--
-->|<div style="margin-left:2em">✘ <small>Speedy deletion denied by {{{Speedy denier}}} on {{{Speedy date}}}</small></div><!--
-->|}}
{{#if:{{{Semi-speed-del|}}}<!--
-->|<div style="margin-left:2em">✘ <small>Semi-speedy deletion denied by {{{Semi-speedy denier}}} on {{{Semi-speedy date|}}}</small></div><!--
-->|}}
{{#if:{{{Consensus-del|}}}|<!--
--><div style="margin-left:2em">✘ <small>Consensus deletion denied on {{{Consensus date|}}}</small></div><!--
-->|}}
|<br />}}</includeonly>

Why is this happening to me? I could not find any typo. So the problem must be logical, and I gave up trying to find a solution alone. My logic must be broken.

1 Answers1

0

You can use HTML comments if you want to make sure there is no extra output from your template, but still need linebreaks etc for readability:

<includeonly><!--


  -->'''{{{num}}}''': {{{date}}}<!--


  -->[[{{{title}}}]]<!--


  -->{{#if:{{{faults|}}}| ({{{faults}}})|}}<br><!--


--></includeonly>
leo
  • 8,106
  • 7
  • 48
  • 80
  • Okay, I will use the comments. But even without line breaks, the template inserts space between the lines, so the problem isn't that. –  Dec 30 '15 at 13:30
  • Do you have a lot of templates? In that case you can prevent linebreaks between them by ending the templates with a ``. Or is it just one? Are you sure you are not sending spaces into the template? Without seeing the code, I can only guess. – leo Dec 30 '15 at 14:08
  • You can see [here](https://pt.wikipedia.org/wiki/Usu%C3%A1rio:MisterSanderson/Artigos_criados/Arquivo/2014) an example of how I'm using the template for which I'm needing help. –  Dec 30 '15 at 15:12
  • I see, and what is not working, exactly? The template seem to be working just fine? – leo Dec 30 '15 at 16:26
  • To be clear: Each template is wrapped in a p-tag, because you have linebreaks between them, and ends in another linebreak, because you have inserted a br tag in the template – leo Dec 30 '15 at 16:30
  • It's working fine because I reverted all changes that doesn't works properly. In [the history page of the template](https://pt.wikipedia.org/w/index.php?title=Usu%C3%A1rio:MisterSanderson/Predefini%C3%A7%C3%A3o:Item-artigo&action=history) you can see what I attempted. –  Dec 30 '15 at 16:36
  • I'm sorry, but you'll have to be a bit more specific. How does the code look, that doesn't work as intended? What did you expect, and what happened? – leo Dec 31 '15 at 15:29
  • 1
    Ughhh... I added to the original post the code I tried, but with the HTML comments on the unnecessary line breaks, and with some pipelines I missed... Now the code is working correctly.... –  Dec 31 '15 at 16:36