https://bugzilla.wikimedia.org/show_bug.cgi?id=30039
Web browser: ---
Bug #: 30039
Summary: ParserFunctions + Variables: tighter integration.
Product: MediaWiki extensions
Version: any
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: Unprioritized
Component: ParserFunctions
AssignedTo: [email protected]
ReportedBy: [email protected]
Classification: Unclassified
Created attachment 8822
--> https://bugzilla.wikimedia.org/attachment.cgi?id=8822
Patch for ParserFunctions.
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.
--
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l