Hi,
Currently ParserFunctions have no notion about variables, which resulting in lots of typing and lots of braces, for example:
{{ #ifexpr: {{ #var: a }} + {{ #var: a }} > 4 | ... }}
I always wanted #expr and #ifexpr functions recognize variables so I can write
{{ #ifexpr: a + a > 4 | ... }}
Attached patch implements this integration between ParserFunctions and Variables.
Changes summary:
1. When if a word is a not predefined expression word (like `pi' or `trunc'), it is checked whether Varaibles extension enabled and whether such a variable exists. If variable exists, its value used.
2. New error message introduced: "Unexpected variable".
3. Second parameter added to ExprParser::doExpression, parser — it is required by Variables (though it is not actually used). For compatibility with older code, parameter is optional.
4. Variables extension is not required, if Variables extension is not enabled, ParserFunctions does not recognize variables but does not issue errors.
I have access to SVN. If the patch is generally ok, I can commit it.
Thanks, Van.
On 24/07/11 09:38, Van de Bugger wrote:
Hi,
Currently ParserFunctions have no notion about variables, which resulting in lots of typing and lots of braces, for example:
<snip>
Attached patch implements this integration between ParserFunctions and Variables.
I don not have the patch here :) You might want to attach it in a bug report on bugzilla.
Ok, see: https://bugzilla.wikimedia.org/show_bug.cgi?id=30039
On Sun, 2011-07-24 at 11:25 +0200, Ashar Voultoiz wrote:
On 24/07/11 09:38, Van de Bugger wrote:
Hi,
Currently ParserFunctions have no notion about variables, which resulting in lots of typing and lots of braces, for example:
<snip> > Attached patch implements this integration between ParserFunctions and > Variables.
I don not have the patch here :) You might want to attach it in a bug report on bugzilla.
wikitech-l@lists.wikimedia.org