Topic on Project:Support desk

Jump to: navigation, search

Two sections of blank parameters in a template are generating a break tag

Ms784 (talkcontribs)

I've created a template for listing specifications for fire apparatus in my mediawiki. The headers have an #if statement that hide them if certain parameters are blank. If two (or more) consecutive sections are blank, a <BR /> is being generated and creating an unwanted space in the middle of my text. Any thoughts on how to prevent this?

In the example, the "aerial" and "body" sections are left blank and are causing a space between the "pump & tank" and "equipment" sections.

URL to template:

URL to page showing the break:

Ciencia Al Poder (talkcontribs)

This happens because there's a blank line before the {{#if that open each group. You should put it next to the end }} of the previous. If you need a new line when the parameter is filled, you need to add it inside the {{#if:, by adding a <nowiki> before it to prevent the parser function to trim blank spaces.

If you want newlines to make your code more readable, you can use it inside HTML comments, like:


-->{{#if: whatever