W3TPL/tag/let: Difference between revisions
Jump to navigation
Jump to search
m (→unsupported) |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 2: | Line 2: | ||
'''Action''': Assigns a value to a variable. | '''Action''': Assigns a value to a variable. | ||
This | This tag has many operations in common with {{l/w3tpl/tag|get}}; a comparison is [[../get-let|here]]. | ||
==Tag Attributes== | ==Tag Attributes== | ||
===core=== | ===core=== | ||
Support for this attribute is required in order for the tag to fulfill its basic purpose. | Support for this attribute is required in order for the tag to fulfill its basic purpose. | ||
* '''name=''': name of variable to receive the calculated value | * '''name=''': name of variable to receive the calculated value | ||
===supported=== | ===supported=== | ||
All {{l/same|get-let}} common attributes are supported, as well as these: | |||
* '''echo''' (output): display the resulting value (at the tag's location in the page) | * '''echo''' (output): display the resulting value (at the tag's location in the page) | ||
* '''self''' (input): takes starting value from same variable, to allow unary operations (e.g. increment, append) | |||
* '''self''' (input): takes starting value from same variable, to allow unary operations | |||
===unsupported=== | ===unsupported=== | ||
These are currently not enabled. Code to support some of them exists, though it may not be working. | These are currently not enabled. Code to support some of them exists, though it may not be working. | ||
Line 44: | Line 16: | ||
* '''load''' (should probably be "fetch"): retrieve starting value from the current page's properties | * '''load''' (should probably be "fetch"): retrieve starting value from the current page's properties | ||
** opposite of "save" | ** opposite of "save" | ||
* '''null''' (input): use NULL as the input | * '''null''' (input): use NULL as the input | ||
* '''oparse''' is now just "parse" | * '''oparse''' is now just "parse" | ||
Line 78: | Line 49: | ||
*** STAGE 2 now replaced by UseTagInput() (operations are done on the input) | *** STAGE 2 now replaced by UseTagInput() (operations are done on the input) | ||
** removed DoFromScalar() | ** removed DoFromScalar() | ||
* '''2022-04-20''' moved common attributes into the caTag_Var, so {{l/w3tpl/tag|get}} and {{l/w3tpl/tag|let}} can share the same processing code. | |||
** Have not yet updated <code>get</code> to use this, though. |
Latest revision as of 00:19, 21 April 2022
About
Action: Assigns a value to a variable.
This tag has many operations in common with <get>; a comparison is here.
Tag Attributes
core
Support for this attribute is required in order for the tag to fulfill its basic purpose.
- name=: name of variable to receive the calculated value
supported
All get-let common attributes are supported, as well as these:
- echo (output): display the resulting value (at the tag's location in the page)
- self (input): takes starting value from same variable, to allow unary operations (e.g. increment, append)
unsupported
These are currently not enabled. Code to support some of them exists, though it may not be working.
- index=: treats the target variable (specified by <name>) as an array, and specifies the element to use
- load (should probably be "fetch"): retrieve starting value from the current page's properties
- opposite of "save"
- null (input): use NULL as the input
- oparse is now just "parse"
- page= (input): name of wiki page to use as input (instead of tag contents)
- raw: if present, "save" will store the value as an unserialized string
- The default is to serialize it, preserving variable type.
- I think this only applied to <save>.
- save (should probably be "store"): store the result in the properties for the current page
- opposite of "load"
History
- 2011-05-31 MainProcess()/DoFromScalar(): added "tag" attribute
- 2016-09-22 MainProcess()/DoFromScalar(): adapting as method of LET tag object
- 2017-10-30 MainProcess()/DoFromScalar(): major rewrite of everything
- changing from static to dynamic
- using internal properties
- 2017-11-01 rewrite
- Removing support for "load" attribute until we have a usage case.
- It doesn't make sense to load a value you'd have to save anyway.
- (Different page, perhaps? But when would we need that? Need usage case.)
- (MainProcess()) copied code from DoFromScalar() to MainProcess(), which will replace it
- replacing DoFromScalar() with MainProcess()
- 2018-06-04 This currently saves the property values in RAW format (i.e. not serialized).
- To change this, replace SaveValueRaw() with SaveValue().
- 2020-08-17 (MainProcess()) upgrades and fixes
- Somehow, Var::GetValue_fromExpression() wasn't being called to interpret "val=" expressions. I've reinstated it. Not sure if there are other attributes where it should be applied. If they come up, document them.
- 2020-09-24 introducing the 'raw' attribute, which saves in non-serialized format
- Now saving serialized by default.
- 2022-04-08 Belatedly saving the figured value into the variable. Where was that being done before?
- 2022-04-09
- MainProcess() is, uh, no longer being called...
- STAGE 1 was replaced by GetTagInput() (input is retrieved from somewhere)
- STAGE 2 now replaced by UseTagInput() (operations are done on the input)
- removed DoFromScalar()
- MainProcess() is, uh, no longer being called...
- 2022-04-20 moved common attributes into the caTag_Var, so <get> and <let> can share the same processing code.
- Have not yet updated
get
to use this, though.
- Have not yet updated