Help talk:Extension:ParserFunctions

From MediaWiki.org
Jump to: navigation, search
An archive box
Archives


replacing #ifexist with #dpl[edit | edit source]

The behaviour of #ifexist can be reproduced with DPL using the following syntax:

{{#dpl:title= page title |oneresultheader= value if exists |noresultsheader= value if doesn't exist }}

which is equivalent to:

{{#ifexist: page title | value if exists | value if doesn't exist }}

DPL has the advantage that it does not create a link between the target page (page title) and the page containing the query. Using #ifexist would cause your page to be listed in Special:WhatLinksHere/page_title.

Capmo (talk) 06:42, 18 August 2012 (UTC)

#ifexist is faster. Avoid calling DPL wherever you can. --Subfader (talk) 13:23, 19 August 2012 (UTC)
DPL makes direct queries to the database, what can be faster than this? And there must be a reason for #ifexist to be labeled as an "expensive parser function". The wiki I administer uses DPL extensively for all sorts of things, and we don't feel any perceivable degradation in server performance. Capmo (talk) 21:53, 21 August 2012 (UTC)
Initializing DPL on page load takes longer than ParserFunctions.
"#ifexist to be labeled as an "expensive parser function"" that's because the DB load gets expensive on calling it X times, but the same counts for calling DPL X times on a page... --Subfader (talk) 11:50, 22 August 2012 (UTC)

If A or B or C (resolved)[edit | edit source]

I am trying to use the if statement to test for multiple different values.

For example: {{#if: {{{a|}}}{{{b|}}}{{{c|}}}| YES | NO}} would display "YES" if any of the three (a,b,c) variables were defined. If, and only if, all 3 were NOT defined, it would display "NO".

I simply cannot get this to work! Any help would be most appreciated.

--Zackmann08 (talk) 01:09, 10 September 2012 (UTC)

Try it like this {{#if:{{{a|}}}|YES|{{#if:{{{b|}}}|YES|{{#if:{{{c|}}}|YES|NO}}}}}}. If one of the parameters has a value it will display YES, only when non of the parameters has a value it will display NO. In this way you can make any combination you want and make it as complicated as you want. --Jongfeli (talk) 09:03, 10 September 2012 (UTC)
The issue is that I am attempting to use this to do something much more complex than just displaying "YES" and "NO". I am using it to create a rather large table. Is there no way to do "If A or B or C"? --Zackmann08 (talk) 13:50, 10 September 2012 (UTC)
If I understand you correctly you would like to fill a (calculated) column in a table and the value depends on other values in the same row? I tried this in combination with Extension:External Data but {{#if: does not work because it probably always gets a value back from the Query. It does not matter if there is a database NULL in the table or an empty string. Just to see if it can work I tried {{#ifeq: (see example below) but it only works on the first row it displays, if in the first row a = 1 it will display Yes and it will repeat the result on the rest of the rows even if a is not 1.
  {{#for_external_table:expression}}
  {| class = "wikitable" 
  ! Column 1
  ! Column 2
  ! Column 3
  ! Test{{#for_external_table:<nowiki/>
  {{!}}-
  !{{{a}}}
  {{!}}{{{b}}}
  {{!}}{{{c}}}
  {{!}}{{#ifeq:{{{a}}}|1|Yes|No}}
  }}
Maybe I am doing something wrong but it seems that in combination with External Data the ParserFunctions does not handle each row individually. --Jongfeli (talk) 15:19, 10 September 2012 (UTC)
This is part of an infobox. I am trying to copy the technique used on wikipedia (For example: http://en.wikipedia.org/w/index.php?title=Template:Infobox_weapon&action=edit)
In the example below, the heading for the "Service History" only displays if "service", "used_by" or "wars" is defined. For some reason, this exact syntax is not working for me.
<!------------------------------Service history------------------------------>
{{#if:{{{service|}}}{{{used_by|}}}{{{wars|}}} |
! colspan="2" {{WPMILHIST Infobox style|header_bar}} {{!}} Service history
}}
|-
{{#if:{{{service|}}} |
! style="padding-right: 1em;" {{!}} In service
{{!}} {{{service|}}}
}}
|-
{{#if:{{{used_by|}}} |
! style="padding-right: 1em;" {{!}} Used by
{{!}} {{{used_by|}}}
}}
|-
{{#if:{{{wars|}}} |
! style="padding-right: 1em;" {{!}} Wars
{{!}} {{{wars|}}}
}}
|-
--Zackmann08 (talk) 15:47, 10 September 2012 (UTC)
So its now working. Not sure what i was doing wrong... Oh well! --Zackmann08 (talk) 16:26, 10 September 2012 (UTC)

If number check (resolved)[edit | edit source]

I am attempting to write an error checking function that checks to see whether a user has supplied either a year (####) or the word "Present". (This is for an infobox for a vehicle. I want to display the production years.) I am 99% of the way there with the following:

{{#iferror:{{#expr: 0 + {{{1}}}}}|{{#ifeq:{{{1}}}|Present|<!--DO NOTHING-->|<!--Display some error message-->}}}}

The issue that I am having is that if a valid date is supplied, then the expression ({{#expr: 0 + {{{1}}}}}) evaluates and is displayed. Is there an easy way to suppress that expression? I seem to remember seeing a "span display=none" type thing somewhere...

Any advice will be greatly appreciated.

--Zackmann08 (talk) 14:35, 19 September 2012 (UTC)

I love solving my own problems. :-) <span Style="display: None"> was my solution. --Zackmann08 (talk) 14:40, 19 September 2012 (UTC)
I also had a similar question because the parser functions give script errors in some cases. I had do this. --Rical (talk) 22:50, 19 September 2012 (UTC)

How to use tag function within parser function?[edit | edit source]

I'm trying to build an if-clause that automatically inserts

== References == <references />

into the article if there are some <ref>s entered in the wikitext. If there's no <ref> no heading and no references/ should be inserted.

I tried different things but none of them work - that means I always get "Heading and stuff" even if there's no ref tag entered in the article:

{{#if: <references /> | Heading and stuff | }}
{{#if: {{#tag:references|}} | Heading and stuff | }}

The docu says "Content inside parser tags (such as nowiki) is temporarily replaced by a unique code" and shows that tags won't work.
Is there a workaround to let <references /> be parsed inside the #if?
--Stefahn (talk) 17:38, 9 November 2012 (UTC)

Just for the record: Found a solution/workaround now :) Stefahn (talk) 17:59, 3 April 2013 (UTC)

#time: and Daylight Savings[edit | edit source]

Is there any flag for DST? Is there any intent to add a flag for this in the future if it currently doesn't exist? Thank you. -- ShoeMaker   ( Contributions Message )   18:30, 9 November 2012 (UTC)

Square root and other questions[edit | edit source]

Hello,
I had 2 questions about the {{#expr:}} and the {{#ifexpr:}} parser functions:

  1. Is it possible to add a square root to those functions? using the sign √ in a formula doesnt work to me.
  2. Also, what do the != and the <> logic keys do?

80.230.37.167 14:38, 26 November 2012 (UTC)

Oh, i see that != make negative solutions possitive, but i still need the square root thing.
80.230.37.167 14:49, 26 November 2012 (UTC)
 ! in front of any conditional punctuation means NOT, so != is NOT EQUAL. As far as your question about sqr roots, you could build a (set of) template(s) like http://meta.wikimedia.org/wiki/Template:Root -- 141.114.97.70 15:08, 26 November 2012 (UTC)
tHANK YOU 80.230.37.167 15:59, 26 November 2012 (UTC)

#time and full month names[edit | edit source]

Hi, I am apparently not seeing any indication of what any underlying support files are called.
The F operator returns a full month name, so 12 produces "December".
Which file houses the actual "December" string?
At my home wiki, it is returning the wrong string.
Thanks, Varlaam (talk) 05:41, 30 November 2012 (UTC)

On "my" wiki, I believe it uses MediaWiki:December and/or MediaWiki:December-gen, but I'm not entirely sure. If you would like to link your an example on your home wiki so I can see what it is returning, I would be happy to take a look and try to help you fix it. -- ShoeMaker   ( Contributions Message )   22:42, 2 January 2013 (UTC)

Test for existence of Month or Day in Date string?[edit | edit source]

Is there some way to test if a day or month was part of a date string?

For example, {{#time r|2003}} only contains a year, but returns a string formatted with the current month and day. I'd like to be able to return empty if passed on month or day (e.g. like {{#time n|2003}}, but returning empty if there is no month part of the date). Curly Turkey (talk) 23:57, 31 December 2012 (UTC)

I want to help you, but I'm not entirely sure what you are asking for.
{{#time:r|2003}} returns Sun, 06 Apr 2003 00:00:00 +0000
{{#time:n|2003}} returns 4
I'm assuming you are hoping to use this as part of a template that will have values passed in to it, is that correct? If so, what is your list of arguments, what do you hope the template can do, and do you have a link to the template creation sandbox or wherever that you have started to make this so I can take a peek and hopefully understand what you want. -- ShoeMaker   ( Contributions Message )   22:52, 2 January 2013 (UTC)

Expression error: Unexpected < operator.[edit | edit source]

I'm trying to add Extension:DPL Page Name S/N Maker (using SemanticForms) (which is really just a complex template combining multiple other extensions) to a corporate wiki, but for any result higher than "00001" it keeps kicking out the error message Expression error: Unexpected < operator. This error isn't covered on the help page here, but based on the documentation I assumed that it must be a stray < character or possibly a tag inside a function where tags aren't allowed. However, even when I remove all instances of the < character from the template (by eliminating the comments, the <strong> tags, and the <noinclude> tags), the error message persists.

Here is the text of the template:

[removed]

Any idea what the problem is and/or how I can correct it? Thanks! ~ Michael Chidester (Contact) 15:07, 22 March 2013 (UTC)

Solution[edit | edit source]

Ultimately I determined that this was a DPL conflict, possibly due to the {{expr:}} function refusing to parse the standard output format of DPL. To help anyone having this problem in the future, here is my modified code, changing out the deprecated string functions for their replacements and modifying the DPL output to produce a regular string rather than a link:

{{#if: {{{form|}}}
  |  {{#ifexist: Form:{{{form|}}} 
       |
       | <strong class="error">Warning! The form "{{{form|}}}" may not be a valid form name!</strong>
     }}
  |
}}<!---
-->{{#if: {{{form|}}}
     | {{#ifeq: {{lc:{{NS:{{{namespace|}}} }} }} 
         | {{lc:{{{namespace|}}} }}
         | 
         | <strong class="error">Warning! "{{{namespace}}}" may not be a valid namespace name!</strong>
       }}
     |
   }}<!---
-->The next document number is '''<!--
-->{{#if: {{{namespace|}}} | {{{namespace|}}}: }}{{{prefix|}}}<!--
   -->{{padleft:<!----------- (X+1)                         =>  0000(X+1) 
      -->{{#expr:<!---------- 0000X+1                       =>  (X+1)
         -->{{replace|<!----- "Namespace:prefix0000X"       =>  "0000X" 
            -->{{replace|<!-- "*[[Namespace:prefix0000X]]"  =>  "Namespace:prefix0000X"
               -->{{#dpl:<!-- return pages named "*[[Namespace:prefix0000X]]"
                  -->titleregexp =^{{{prefix|}}}[0-9]{{{{pad|5}}}}$<!--
                  -->| namespace = {{{namespace|}}}<!--
                  -->| order = descending<!--
                  -->| mode = userformat<!--
                  -->| format = ,%PAGE%<!--
                  -->| noresultsheader = {{padleft:0|{{{pad|5}}}|0}}<!--
                  -->| count = 1
                  }}
               |/^([^{{!}}]+\{{!}}){1}([^\]]+).*/  
               |\2
               }}
            | {{#if: {{{namespace|}}} | {{{namespace|}}}:}}{{{prefix|}}}
            |
            }}
         +1
         }}
     | {{{pad|5}}}
     | 0
     }}'''
----
{{#if: {{{form|}}}
  | {{#forminput: {{{form|}}}
      | {{{width|20}}}
      | {{{prefix|}}}<!--
      -->{{padleft:<!----------- (X+1)                         =>  0000(X+1) 
         -->{{#expr:<!---------- 0000X+1                       =>  (X+1)
            -->{{replace|<!----- "Namespace:prefix0000X"       =>  "0000X" 
               -->{{replace|<!-- "*[[Namespace:prefix0000X]]"  =>  "Namespace:prefix0000X"
                  -->{{#dpl:<!-- return pages named "*[[Namespace:prefix0000X]]"
                     -->titleregexp =^{{{prefix|}}}[0-9]{{{{pad|5}}}}$<!--
                     -->| namespace = {{{namespace|}}}<!--
                     -->| order = descending<!--
                     -->| mode = userformat<!--
                     -->| format = ,%PAGE%<!--
                     -->| noresultsheader = {{padleft:0|{{{pad|5}}}|0}}<!--
                     -->| count = 1
                     }}
                  |/^([^{{!}}]+\{{!}}){1}([^\]]+).*/  
                  |\2
                  }}
               |{{#if: {{{namespace|}}} | {{{namespace|}}}:}}{{{prefix|}}}
               |
               }}
            +1
            }}
        | {{{pad|5}}}
        | 0
        }}
     | {{{buttonlabel|Add}}}
     | {{#if: {{{namespace|}}} | namespace = {{{namespace|}}} }}  
     }}
  | <includeonly><strong class="error">Warning! You haven't specified a SemanticForm for page creation! Please specify a SemanticForm name.</strong></includeonly>
}}<noinclude>
{{documentation}}
</noinclude>

Cheers. ~ Michael Chidester (Contact) 15:40, 26 March 2013 (UTC)

See also Scribunto ?[edit | edit source]

Now, we have modules in scribunto/Lua and the syntax to call them is " {{#invoke| ". Then users will try to search them here and we could add Extension:Scribunto to "See also" paragraph ? --Rical (talk) 18:13, 11 May 2013 (UTC)

I think you should create a section Extension:Scribunto/Lua reference manual#invoke on the extension page, since that should bring this section to the top of the search results when people search "invoke". --Theaitetos (talk) 22:11, 12 May 2013 (UTC)

How can we do a sum ?

Cat Fruit
A
B
C
D
E
Total sum

Hello ! Is there a function to do the sum of A+B+C+D+E ? Historymating (talk) 11:42, 8 June 2013 (UTC)

  1. expr can calculate sums. But it's not possible for any function to process things, that are not in the input area of the function itself. --Theaitetos (talk) 13:58, 28 June 2013 (UTC)

Unwanted whitespace in article from #switch

I'm using a template whose entirety is just a switch statement to transclude one of two possible subtemplates. However, ParserFunctions seems to be adding an extra line of whitespace before the result of the switch statement when I use it this way. Is there a way to remove this whitespace?--Idran (talk) 01:46, 28 June 2013 (UTC)

Hello Idran. You should first check if the template adds the white space (line break). If you want to be strict on what gets transcluded via the template make sure you put everything that needs to be transcluded between <includeonly> tags. Below an example.
[[category:test]]<noinclude>
== Any Template documentation ==
* Bla bla 1
* Bla bla 2
* Bla bla 3</noinclude><includeonly>{{#switch:baz|foo=Foo|baz=Baz|Bar}}</includeonly>
If you don't do that you could easily transclude a line break to a page. --Jongfeli (talk) 08:34, 28 June 2013 (UTC)
  • I disagree with Jongfeli. en:Help:Transclusion#Markup has an informative section on how transclusion and the various include tags work. Idran if you could post the markup from your template here, I would be happy to help you make it work as you expect. I'm thinking the #switch might not be needed if there are only two outcomes and maybe an #ifeq would work better. Technical 13 (talk) 12:13, 28 June 2013 (UTC)
    • Actually while I was copying the code of the templates here, I noticed exactly what the problem was; I had an includeonly section in the subtemplates that I hadn't realized was adding an unwanted linebreak, and I didn't notice it because I was focusing my attention on the template itself. Apologies for the unnecessary responses!--66.254.228.224 19:26, 28 June 2013 (UTC)
    • Whoops, didn't notice I wasn't logged in; that was me above.--Idran (talk) 19:59, 28 June 2013 (UTC)

Hebrew calendar (Jewish calendar) date as date/time object

Is there a way to enter a Hebrew calendar date as a date/time object in the #time: function? In other words, I know how to get a Hebrew calendar date out by entering a Gregorian date/time object in the function. Can I do it the other way around? Thanks. StevenJ81 (talk) 01:34, 24 July 2013 (UTC)

HTML and Parser functions

I have tried to use Parser functions with HTML(More accurately CSS), but there is some conflict made by the ">" operator. What can I do in order to solve the problem? Thanks. 219.78.217.178 22:40, 9 August 2013 (UTC)

  • Without you showing us the code in question that you are getting errors for, the first suggestion I may offer is to use &lt; and &gt; to achieve < and > respectively. Technical 13 (talk) 23:37, 9 August 2013 (UTC)
For example, using a style tag...
<div style='/*abunchofrandomstuff*/;transform:rotate({{#expr: 360 - 180 + {{#ifexpr: {{{degree|180})} > 180 | 180 | {{{degree|180}}}}}}}deg);'></div>

The > makes the tag closed and caused errors, so what should I do? 219.78.217.178 10:00, 14 August 2013 (UTC)

First, there is a significant typo when closing the parameter degree with })} instead of }}}: <{{#ifexpr: {{{degree|180})} > 180
If that doesn't fix the problem, try turning the ifexpr around: {{#ifexpr: 180 < {{{degree|180}}}. --Theaitetos (talk) 18:29, 19 August 2013 (UTC)

Bug in time code?

"Feb" is getting reported as 3 for format letter "n" (see below) Esjs (talk) 16:03, 30 August 2013 (UTC)

{{#time:n|Jan}} {{#time:n|Feb}} {{#time:n|Mar}} {{#time:n|Apr}} {{#time:n|May}} {{#time:n|Jun}}
1 2 3 4 5 6
{{#time:n|Jul}} {{#time:n|Aug}} {{#time:n|Sep}} {{#time:n|Oct}} {{#time:n|Nov}} {{#time:n|Dec}}
7 8 9 10 11 12

handling of incomplete dates

"Full or partial absolute dates can be specified; the function will "fill in" parts of the date that are not specified using the current values:"

I think this is not acceptable behaviour, unless it can be switched on or off. I am parsing incomeplete dates, and if you have a historical Person in a wiki with a birth date "May 1875" than the #time function should return nothing for a day and not the current day!! — Preceding unsigned comment added by Krabina (talkcontribs) 07:05, September 19, 2013

  • You have full control over how you format the output of the #time function. If you only want month, year, then {{#time:F Y|{{{month|}}} {{{year|}}}}} produces May 1875 when you pass |month=may |year=1875. If you want to make it more complicated, then try playing with:
{{#time:{{#if:{{{day|}}}|d}} {{#if:{{{month|}}}|F}} {{#if:{{{year|}}}|Y}}|{{{month|1}}}/{{{day|1}}}/{{{year|100}}}}}
  • |day= |month= |year=
  • |day=5 |month= |year=
  • 05
  • |day=5 |month=5 |year=
  • 05 May
  • |day=5 |month= |year=1875
  • 05 1875
  • |day=5 |month=5 |year=1875
  • 05 May 1875
  • |day= |month=5 |year=1875
  • May 1875
  • |day= |month= |year=1875
  • 1875
  • |day= |month=5 |year=
  • May
You can also change the layout so that it looks like any of these:
  • May 5, 1875
  • 5/05/1875
  • 1875, 5 05
If you want to make it really complex:
{{#time:{{#if:{{{year|}}}|{{#if:{{{month|}}}|{{#if:{{{day|}}}|F j, Y|F Y}}|Y}}|{{#if:{{{month|}}}|F|"<small>(Date unknown)</small>"}}}}|{{{month|1}}}/{{{day|1}}}/{{{year|100}}}}}
  • |day= |month= |year=
  • (Date unknown)
  • |day=5 |month= |year=
  • (Date unknown)
  • |day= |month=5 |year=
  • May
  • |day= |month= |year=1875
  • 1875
  • |day=5 |month=5 |year=
  • May 5
  • |day=5 |month= |year=1875
  • 1875
  • |day= |month=5 |year=1875
  • May 1875
  • |day=5 |month=5 |year=1875
  • May 5, 1875
I hope this satisfies your need... Technical 13 (talk) 14:12, 19 September 2013 (UTC)
Thank you for these great examples, but it's not quite what I need. I have dates and some of them are incomplete. Say "24 April 1875" or "Mai 1920". If I use {{#time:j|24 April 1875}} I get "24" which is fine, but with {{#time:j|April 1986}} I recieve "1". But it rather should return an error, because if there is no day present I don't want to get a day... --Krabina (talk) 06:39, 24 September 2013 (UTC)
The problem is that {{#time:j|April 2013}} returns the same result as {{#time:j|1 April}}. Both are 1 but in case of April 2013 it is an assumption. Depending what users are doing with the result things could take a wrong turn on there wiki's. The desired result should be something that can not be a day, like 0 so users can "catch" it. Regards, --Jongfeli (talk) 10:00, 24 September 2013 (UTC)

using #ifexist to check for files in templates

{{#if:{{{image|}}}
  |[[File:{{{image}}}]]
  |{{#ifexist:File:{{PAGENAME}}.png
     |[[File:{{PAGENAME}}.png]]
     |[[File:defaultimage.png]]
   }}
}}

I'm using something like the above in a template to check for files. It works fine, but if files corresponding to {{PAGENAME}}.png are added after the pages transcluding this template is edited, the files show up in Unused Files list and the File:{{PAGENAME}}.png links show up in Wanted Pages list, not Wanted Files list. Purging any of the relevant pages doesn't fix it. Only editing the pages which have the template transluded updates the link lists. the Is there a way around this bug? - 91.156.198.247 04:56, 8 October 2013 (UTC)

Cleanup number with thousands separator[edit | edit source]

When calculating with a number like {{PAGESIZE}}, a number with thousands separator (comma in enwiki) is returned like 28,123. Is there a cleanup function, and shouldn't we add that to this helppage? -DePiep (talk) 11:46, 7 November 2013 (UTC)

Undocumented feature of #time[edit | edit source]

Hello, I was just trying something that I thought might work, and it did, despite it not being listed here. it might be useful to add such a note to the page. (if it is noted, then my apologies, but it wasn't obvious)

{{#time: U | second Sunday of March 10:00 }}

Which displays the second sunday in march at 10:00. -90.217.231.103 09:34, 16 November 2013 (UTC)

This is documented. Go to Help:Extension:ParserFunctions#.23time and scroll down until you see "Minutes and seconds" in the table to the right. Allen4names (talk) 15:17, 5 February 2014 (UTC)

help[edit | edit source]

How can I test if a parameter starts with a parenthesis? I wish to add parentheses to a number template when the uncertainty is input as ±x, but not when it's formatted as (x). So I'd like to test if the first character of the string is a parenthesis, or if the string contains a parenthesis, and only add parentheses when this is false. Kwamikagami (talk) 07:43, 7 February 2014 (UTC)

Thanks. I'm working on WP, which has them installed, doesn't it? Kwamikagami (talk) 08:20, 7 February 2014 (UTC)
  • The English Wikipedia has Extension:Scribunto installed. There is also already a string functions module written which you can see on en:Module:String. What you'll want to use to see if "(" is the first character is {{#invoke:String|sub|{{{1|whatever you are passing in to test}}}|1|1}} Technical 13 (talk) 10:24, 7 February 2014 (UTC)
Thanks! I didn't even know that was there. I've always come here. But what they have isn't enough for me to follow: If param A begins with / contains (, I want to do X, otherwise Y. What I have is (for param 2):
{{#ifeq: {{#invoke:String|sub|{{{2|}}}|1|1}}|"("|| [thing to do if no "("] }}
but it has no effect. Kwamikagami (talk) 11:22, 7 February 2014 (UTC)
  • {{#ifeq: {{#invoke:String|sub|(x)|1|1}}|(|There is a "("| There is no "(" }}
There is no "("
  • {{#ifeq: {{#invoke:String|sub|±x|1|1}}|(|There is a "("| There is no "(" }}
There is no "("
I don't understand: It's false whether there's a parenthesis or not. But someone else found a way of doing this with just {{#if:{{#ifexpr:0{{{2}}}}}|, so I won't need this after all. (I was trying to do it on my own so someone else wouldn't have to.) Thanks, though. Kwamikagami (talk) 18:47, 7 February 2014 (UTC)
  • Yeah, it wasn't earlier. Using the English Wikipedia version of the module, it works, however, using that version broke multiple templates on this wiki that will need to be updated before I can update the module. You'll have to take my word for it that it will work properly on the English Wikipedia. :/ Technical 13 (talk) 21:48, 7 February 2014 (UTC)

tags[edit | edit source]

how can i add tags to my template so if i have only 1 tag it will not display empty spaces or tag icons without words? (sometimes i have a few tags)

Unwanted line breaks in if statements[edit | edit source]

Hi.

I have the following in a table:

{{#if:{{{Website|}}}|{{#!:
|-
! Website Address
| [[Webpage::{{{Website|}}}]]}}}}
{{#if:{{{Facebook ID|}}}|{{#!:
|-
! Facebook
| [[Facebook ID::{{{Facebook ID|}}}]]}}}}
{{#if:{{{Twitter ID|}}}|{{#!:
|-
! Twitter hashtag
| [[Twitter ID::{{{Twitter ID|}}}]]}}}}

At the end of each #if block I get a

<p><br></p>

in the HTML leading to ugly line breaks if one or more if the fields is hidden.

Any ideas?

Thanks.