Module:WikidataIB/sandbox1/doc: Difference between revisions

Content deleted Content added
Line 383:
 
=== Function emptyor ===
emptyor returns nil if its first unnamed argument is just punctuation, whitespace or html tags otherwise it returns the argument unchanged (including leading/trailing space).
 
If the argument could contain "=", then it must be called explicitly:
* <code><nowiki>| 1 = whatever-the-argument-is</nowiki></code>
In that case, leading and trailing spaces are trimmed.
 
It finds use in infoboxes where it can replace tests like:
* <code><nowiki>{{#if: {{#invoke:WikidataIB |getvalue |P99 |fwd=ALL}} | <span class="xxx">{{#invoke:WikidataIB |getvalue |P99 |fwd=ALL}}</span> | }}</nowiki></code>
with a form that uses just a single call to Wikidata:
* <code><nowiki>{{#invoke |WikidataIB |emptyor |1= <span class="xxx">{{#invoke:WikidataIB |getvalue |P99 |fwd=ALL}}</span> }}</nowiki></code>
 
=== Function labelorid ===