Jump to content

Fyrimynd:Ifnotempty/doc

Frá Wikipedia, hin frælsa alfrøðin
Dokumentatión
Dokumentation
Dokumentation
Hetta er dokumentatiónssíðan fyri Fyrimynd:Ifnotempty.

Henda síðan er ikki neyðturviliga hugsað at skula vísast beinleiðis. Um hon nýtir variablar, so kunnu nøkur leinki sýnast sum brotin. Tú mást ikki útskifta variablarnir við beinleiðis tittlar ella URL.

Við hesari fyrimyndini kann #if verða nýtt soleiðis, at (restin er á enskum): that it does not strip spaces and newlines from the "then" and "else" part. For evaluating the condition spaces and newlines are stripped like with ParserFunctions.

  • {{ifnotempty| x | A | B }} gevur " A "
  • {{ifnotempty|x| A | B }} gevur " A "
  • {{ifnotempty| | A | B }} gevur " B "
  • {{ifnotempty|| A | B }} gevur " B "

Samanber:

  • {{#if:x| A | B }} gevur "A"
  • {{#if:| A | B }} gevur "B"

Expansion depth limit

[rætta wikitekst]

13 levels allowed:

{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|a}}}}}}}}}}}}}}}}}}}}}}}}}} gives a

{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|a}}}}}}}}}}}}}}}}}}}}}}}}}}}} gives a

Internal technical details

[rætta wikitekst]

For evaluating the condition the template uses the actual parser function; however, not directly with p and q, because this strips spaces and newlines from the result, but with index values 1 and 2. The result can be 1, 2. The template with the applicable name is called (Template:P1 or Template:P2), with as parameters p and q.

Conditions

[rætta wikitekst]

Condition: string not empty.

Sí eisini

[rætta wikitekst]