parsing - MediaWiki parser function #if for undefined template parameter -
i have mediawiki site semantic mediawiki extension installed. i'd test if string empty. do:
{{#if: {{{transcript.lncrna}}} | yes | no}}
apparently, {{{transcript.lncrna}}} empty, contains nothing. however, parser function #if
tells me yes answer.
what wrong?
a variable beingness empty, , variable beingness defined are 2 different things, when comes mediawiki parser functions. in case {{{transcript.lncrna}}}
isn't defined. mediawiki treat literally trying write out text “{{{transcript.lncrna}}}”, which, of course, create if statement homecoming true.
to check if parameter empty, need add together empty default value, writing {{{transcript.lncrna|}}}
(note horizontal bar):
{{#if: {{{transcript.lncrna|}}} | yes | no}}
here table different possibilities
value of {{{param}}}: undefined | nil | whitespace | -------------------------------------------------------------------------------- {{#if: {{{param|}}} | yes | no}} | no | no | no | yes {{#if: {{{param}}} | yes | no}} | yes | no | no | yes
parsing mediawiki
No comments:
Post a Comment