All these methods and (static) class properties are used as public access
at the moment. So set them explicitly as such.
Change-Id: Ib3bab43a54ce295d4dbfcdaa95450d573699bfb2
Add mw.ext.ParserFunctions.expr, allowing #expr to be used without needing
to use frame:callParserFunction.
Change-Id: I64c78fafad7da503b141efb36da64c3e3d8501a5
In trying to fix bug 35866, I32c9eca6 changed the behavior of 'mod' to
no longer cast its arguments to integers, which conventiently also
solved bug 6068. However, this also broke many existing uses that
depended on that casting.
This change reverts 'mod' to its old behavior while still solving bug
35866, and at the same time adds a new 'fmod' operator with the new
behavior to keep bug 6068 fixed as well.
Change-Id: I6114c6e769119e6ced61b3b55b6f70b03b5b1ebe
The PHP modulo operator ('%') casts its operands to ints, causing
floating point values 0 < $right < 1 to raise a divide-by-zero error.
Explicitly casting both operands to float and using fnmod() resolves the
issue. This change also tidies up the check for zero values and adds
tests.
Change-Id: I32c9eca6552e4fec248eb4fa6419faa39c10df3b
* subclass ConvertError and ExprError from MWException
* invoking the parser for error messages clears state and exposes strip markers, and the error messages should be in the content language anyway
* clean up the magic word list
Reimplement, but better! Use BC Math library where possible, for fixed-point math operations. The tolerance aspect has been included by doing math internally at 16 digits, but discarding the last two digits for the purpose of comparison.
{{#expr:1 − 2}} and {{#expr:1 − 2}} now work, in the same vein as {{#ifexpr:3 < 4|...}} does. This allows human-formatted template values to work more reliably when fed to #expr. Patch by Doug Strain.
* remove some unneeded blackslashes in messages (caused malformed error message)
* put Magic in separate file
* delay message loading
* add version in extension credits, remove EOL whitespace
* update Translate extension
* No need for comment stripping in Expr.php anymore
* Updated srvus() to roughly account for these changes
* Gave comment handling its own preprocessor tag, and split off comment handling from extensionSubstitution(). This only applies for the non-HTML modes, since in HTML mode, comments are stripped early.
* Strip comments from template argument names (PPFrame::newChild).
** Move error messages to ParserFunctions.i18n.php
** Rename 'expr_...' to 'pfunc_expr_...' to be consistent with other messages which are localizable already
* Add CSS class 'error' to output of error messages