11

In mediawiki, whenever you embed a template into an article, it is always proceeded by a line break (as far as I know). Is there some way to prevent this so that I may place templates next to one another without the second one being on a new line?

Koukaakiva
  • 283
  • 1
  • 3
  • 11

1 Answers1

12

Use the <includeonly> tag if you didn't already, and make sure not to put any returns in your template before the </includeonly>

So

<includeonly>This is a template. </includeonly>

makes {{Template}}{{Template}} output as

This is a template. This is a template


But,

<includeonly>This is a template. 

</includeonly>

makes {{Template}}{{Template}} output as

This is a template. 

This is a template

Even single returns are dangerous. If template A contains:

<includeonly>{{B}}
</includeonly>

and template B contains:

<includeonly>Text
</includeonly>

then when you insert {{A}} into your page, both returns are subsequent and give paragraph break.

skalee
  • 12,331
  • 6
  • 55
  • 57
Adrian Archer
  • 2,323
  • 1
  • 17
  • 20
  • Thank you very much. This is a much simpler solution than I was expecting. – Koukaakiva Mar 27 '09 at 05:02
  • 6
    This is normally enough, but sometimes you want to have multiple templates in a row, allowing some of them to return empty results, If you, for readability, put each of them on a new line, you might still get unwanted line breaks in your article. The trick then is to use the [nowiki hack](http://smw.referata.com/wiki/Avoiding_newlines_between_template_calls): `{{{1|}}}`. Ending the template with `` will supress any new line – leo Dec 27 '13 at 19:46
  • In addition, if you use `` on the page, remove any space & line breaks you have between `` and `` as well, or you'd get the same line break problem. – BayesianBroccoli Nov 13 '20 at 19:20