Page MenuHomePhabricator

Create short-hand function for {{#var:x|{{#vardefineecho:x| arg }}}}
Open, LowPublic5 Story PointsFeature


A common known use case of Variables is to accelerate parsing of pages, that transcluded the same template with the same arguments several hundred times before. Variables allow users to cache such data instead of reparsing the concerned code that often. However, to make templates using them work even if they are standalone, the first call of a variable often looks like this;


If this syntax is used nested, code becomes kind of hard to read and less clear, so I propose the introdunction of a new parser function (maybe called #varfallback), that behaves exactly like #var with the difference that it saves provided default values of variables if the variable isn't defined. It should probably produce an error detectable by #iferror if no value can be set, but this needs further consideration.

This additional parser function would allow this code:


to be written like this:


Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 21 2018, 7:13 PM
MGChecker triaged this task as Low priority.Oct 24 2018, 11:57 PM
MGChecker set the point value for this task to 5.Oct 25 2018, 12:07 AM
MGChecker changed the subtype of this task from "Task" to "Feature Request".Mar 1 2019, 11:35 PM