I have the following template
{{#if:{{{1|}}}|{{Subtemplate|{{{1}}}}}}}
{{#if:{{{2|}}}|{{Subtemplate|{{{2}}}}}}}
{{#if:{{{3|}}}|{{Subtemplate|{{{3}}}}}}}
{{#if:{{{4|}}}|{{Subtemplate|{{{4}}}}}}}
{{#if:{{{5|}}}|{{Subtemplate|{{{5}}}}}}}
{{#if:{{{6|}}}|{{Subtemplate|{{{6}}}}}}}
{{#if:{{{7|}}}|{{Subtemplate|{{{7}}}}}}}
{{#if:{{{8|}}}|{{Subtemplate|{{{8}}}}}}}
{{#if:{{{9|}}}|{{Subtemplate|{{{9}}}}}}}
{{#if:{{{10|}}}|{{Subtemplate|{{{10}}}}}}}
{{#if:{{{11|}}}|{{Subtemplate|{{{11}}}}}}}
{{#if:{{{12|}}}|{{Subtemplate|{{{12}}}}}}}
and it works perfectly well to be used as {{Template|first|second|third}}
but it keeps printing empty paragraphs for the parameters that are not present. How can I get rid of them?
Try removing the newlines between if-statements:
{{#if:{{{1|}}}|{{Subtemplate|{{{1}}}}}}}<!--
-->{{#if:{{{2|}}}|{{Subtemplate|{{{2}}}}}}}<!--
-->{{#if:{{{3|}}}|{{Subtemplate|{{{3}}}}}}}<!--
-->{{#if:{{{4|}}}|{{Subtemplate|{{{4}}}}}}}<!--
-->{{#if:{{{5|}}}|{{Subtemplate|{{{5}}}}}}}<!--
-->{{#if:{{{6|}}}|{{Subtemplate|{{{6}}}}}}}<!--
-->{{#if:{{{7|}}}|{{Subtemplate|{{{7}}}}}}}<!--
-->{{#if:{{{8|}}}|{{Subtemplate|{{{8}}}}}}}<!--
-->{{#if:{{{9|}}}|{{Subtemplate|{{{9}}}}}}}<!--
-->{{#if:{{{10|}}}|{{Subtemplate|{{{10}}}}}}}<!--
-->{{#if:{{{11|}}}|{{Subtemplate|{{{11}}}}}}}<!--
-->{{#if:{{{12|}}}|{{Subtemplate|{{{12}}}}}}}