Extension:Eval

From MediaWiki.org

Jump to: navigation, search
Manual on MediaWiki Extensions
List of MediaWiki Extensions
Eval

Release status: unknown

Implementation Tag
Description Provides mathmatical functions for MediaWiki
Download Extension:Eval/eval.php
See also ParserFunctions.

The eval extension enables mathematical and logical operations in MediaWiki. This extension is available in WiKimia.

[edit] Installation

  1. Save the file Eval extension/eval.php in /extensions/eval.php.
  2. Add the following line to the end of your file /LocalSettings.php:
require("extensions/eval.php");

[edit] Use

Other languages
EspaƱol (Spanish)

You must write the code to evaluate into the <eval> and </eval> tags. So far only it supports the following functions, but extensions are anticipated.

Code Description
#+# Adds the numbers.
#-# .
#*# .
#/#
(...)
#.# Decimal point.
#e# Scientific notation (only positives).
{{Template}} Process the template or variable and replaces it with the returned value. Example: {{CURRENTYEAR}}
{{{Parameter}}} Process the parameter and replaces it with the returned value. Example: {{{1|0}}}.

NOTE: This parser does the operations beginning at the left. Here are a few examples:

2+3*4-5
2+3*4-5
  5*4-5
   20-5
     15
2+(3*4)-5
2+(3*4)-5
2+  12 -5
2+  12 -5
     14-5
      9

[edit] Extensions

The following extensions are anticipated, if you want to collaborate, your aid will be welcome.

  • Negative scientific notation (#e-#);
  • Logical functions:
    • And (&)
    • Or inclusive (|)
    • Or exclusive
    • Negation (!)
  • At the moment, it process all the text as wiki. I will process only the text between the { and }
  • To see the code, go to Extension:Eval/eval.php.
Personal tools