Difference between revisions of "PsyCrit:Code/lib/smw"
(copied from Issuepedia, with slight doc formatting update) |
(smw.let.echo() - not tested) |
||
Line 1: | Line 1: | ||
==smw.let.echo(key, val)== | ==smw.let.echo(key, val)== | ||
'''Action''': sets SMW | '''Action''': sets a SMW property and echoes the value This is useful as an alternative for the <nowiki>[[key::val]]</nowiki> syntax, which can't deal with brackets in the value. | ||
<func name="smw.let.echo" key val> | <func name="smw.let.echo" key val> | ||
<let name=out>{{#set:</let> | <let name=out>{{#set:</let> | ||
Line 9: | Line 9: | ||
<let name=out append copy=val /> | <let name=out append copy=val /> | ||
<echo><get name=out /></echo> | <echo><get name=out /></echo> | ||
</func> | |||
==smw.let.var(key, val)== | |||
'''Action''': sets a SMW property and a W3TPL variable. This allows the edited value to be used in a preview, rather than only looking up the last saved value. | |||
<func name="smw.let.var" key val> | |||
<let name=smw[$key] copy=val /> | |||
<let name=out>{{#set:</let> | |||
<let name=out append copy=key /> | |||
<let name=out append>=</let> | |||
<let name=out append copy=val /> | |||
<let name=out append>}}</let> | |||
</func> | </func> |
Revision as of 15:30, 7 August 2012
smw.let.echo(key, val)
Action: sets a SMW property and echoes the value This is useful as an alternative for the [[key::val]] syntax, which can't deal with brackets in the value. <func name="smw.let.echo" key val>
{{#set:=}}
</func>
smw.let.var(key, val)
Action: sets a SMW property and a W3TPL variable. This allows the edited value to be used in a preview, rather than only looking up the last saved value. <func name="smw.let.var" key val>
</func>