General
editapply
edit(function, object, ...) → object
Evaluates the specified function with remaining parameters as arguments.
assign (:=)
edit(string, object) → object
Assigns a value to an identifier. Returns the value that was assigned.
boolean
editobject → boolean
Returns boolean representation of argument.
function
edit(args:object, ..., expression:object) → function
Returns a function. expression is expression to be evaluated, args are identifiers appearing in expression, which are substituted for argument values when the function is called.
if
edit(boolean, object, object) → object
(boolean, object) → object
If first argument is true, evaluates and returns second argument, otherwise evaluates and returns third argument, or false if no third argument is provided. Does not evaluate the argument that is not returned.
is
edit(object, string) → boolean
Returns true if argument 1 is of type given by argument 2, otherwise false.
number
editobject → number
Returns numeric representation of argument.
sequence (;)
edit(object, ...) → object
Evaluates arguments in order, returns value of last one.
string
editobject → string
Returns string representation of argument.
switch
edit(value:object, {test:object, expression:object}...) → object
Conditionally evaluates one or more expressions based on value. Arguments following first are in pairs; for each pair, if test is equal to value, expression is evaluated. Last expression evaluated is returned. test can be a list, in which case expression will be evaluated if any item in test is equal to value.
type
editobject → string
Returns type of argument.
wikitext
editobject → string
Return wikitext representation of argument.
Logical
editnot (!)
editboolean → boolean
Logical 'not' operator.
and (&)
edit(boolean, boolean) → boolean
Logical 'and' operator. Short-circuiting: evaluates from left to right, arguments following a false value not evaluated.
or (|)
edit(boolean, boolean) → boolean
Logical 'or' operator. Short-circuiting: evaluates from left to right, arguments following a true value not evaluated.
xor
edit(boolean, boolean) → boolean
Logical 'exclusive-or' operator.
Comparison
edit=
edit(object, object) → boolean
Returns true if string representations of objects are equal, otherwise false.
!=
edit(object, object) → boolean
Returns false if string representations of objects are equal, otherwise true.
>
edit(number, number) → boolean
Returns true if first argument greater than second, otherwise false.
<
edit(number, number) → boolean
Returns true if first argument less than second, otherwise false.
>=
edit(number, number) → boolean
Returns true if first argument greater than or equal to second, otherwise false.
<=
edit(number, number) → boolean
Returns true if first argument less than or equal to second, otherwise false.
Math
edit+=
edit(string, number) → number
Increments value of specified identifier by specified number and returns result.
-=
edit(string, number) → number
Decrements value of specified identifier by specified number and returns result.
sum (+)
edit(number, ...) → number
Returns sum of arguments.
sub (-)
edit(number, number) → number
Subtracts second argument from first.
*
edit(number, number) → number
Multiplies arguments.
/
edit(number, number) → number
Divides first argument by second.
div (\)
edit(number, number) → number
Divides first argument by second, returns integer part of result.
mod (%)
edit(number, number) → number
Divides first argument by second, returns integer remainder.
pow (^)
edit(number, number) → number
Returns first argument raised to power of second argument.
abs
editnumber → number
Returns absolute value of argument.
sign
editnumber → number
Returns sign of argument.
sqrt
editnumber → number
Returns square root of argument.
max
edit(number, ...) → number
Returns maximum of arguments.
min
edit(number, ...) → number
Returns minimum of arguments.
log
editnumber → number
Returns logarithm to base 10 of argument.
ln
editnumber → number
Returns natural logarithm of argument.
classify
edit(number, number) → string
Accepts value and interval size; returns string representation of interval of that size to which value belongs.
Strings
edit+
edit(string, string) → string
Concatenates two strings.
&=
edit(string, string) → string
Concatenates the value of identifier in first argument with second argument, assigns result to identifier and returns result.
contains
edit(string, string) → boolean
Returns true if first argument contains second, otherwise false.
lower
editstring → string
Returns argument transformed to lowercase.
upper
editstring → string
Returns argument transformed to uppercase.
lowerfirst
editstring → string
Returns argument with first character transformed to lowercase.
upperfirst
editstring → string
Returns argument with first character transformed to uppercase.
length
editstring → number
Returns length of argument.
empty
editstring → boolean
Returns true if argument is of length zero, otherwise false.
startswith
edit(string, string) → boolean
Returns true if first argument starts with second argument, otherwise false.
endswith
edit(string, string) → boolean
Returns true if first argument ends with second argument, otherwise false.
replace
edit(string, string, string) → string
Returns first argument with all instances of second argument replaced by third argument.
Regex
editlike
edit(string, string) → boolean
Returns true if regex pattern given by second argument matches whole of first argument, otherwise false.
match
edit(string, string) → string
(string, string, number) → string
With two arguments, returns first occurence of regex pattern given by second argument in first argument, or empty string if no match. With three arguments, occurence specified by third argument is returned, or empty string if there are insufficient matches.
replacepattern
edit(string, string, string) → string
Returns first argument with regex search pattern and replace pattern in second and third arguments applied.
Dates
editdate
editobject → date
Returns date representation of argument.
dayname
editdate → string
Returns name of day of week.
dayofmonth
editdate → number
Returns day of month.
dayofweek
editdate → number
Returns day of week.
dayofyear
editdate → number
Returns day of year.
fullday
editdate → string
Returns day, month name and year.
fullmonth
editdate → string
Returns month name and year.
fullweek
editdate → string
Returns week number and year.
hour
editdate → number
Returns hour component of argument.
minute
editdate → number
Returns minute component of argument.
month
editdate → number
Returns month number.
monthname
editdate → string
Returns name of month.
second
editdate → number
Returns second component of argument.
week
editdate → number
Returns week number.
year
editdate → number
Returns year number.
Lists
editlist
edit(object, ...) → list
Returns list constructed from arguments.
count
editlist → number
Returns number of items in list.
sort
editlist → list
Sorts argument, contents must all be of same type.
unique
editlist → list
Returns argument with any duplicate values removed.
group
editlist → table(object, number)
Returns a table listing each unique value in argument and the number of occurences.
groupby
edit(list, expression) → table(object, number)
Applies expression to each value in list, then applies group to results.
exclude
edit(list, list) → list
Returns first argument with any values that occur in second argument removed.
union
edit(list, list) → list
Returns list containing values from both arguments, including duplicates.
merge
edit(list, object) → list
Appends object in second argument to list given by first argument.
first
editlist → object
Returns first value in argument.
rest
editlist → list
Returns argument with first value removed.
last
editlist → object
Returns last value in argument.
item
edit(list, number) → object
Returns value in first argument at zero-based index given by second argument
limit
edit(list, number) → list
Returns number of items given by second argument from first argument, or entire list if shorter.
range
edit(list, number, number) → list
Returns subset of items from argument 1, of size given by argument 3 and beginning at index given by argument 2.
reverse
editlist → list
Returns argument with items reversed.
filter
edit(list, expression) → list
Evaluates expression in the context of each item in the list, returns list of items for which expression evaluates to true.
map (->)
edit(list, expression) → list
Evaluates expression in the context of each item in the list, returns list of results.
fold
edit(list, string) → object
(list, string, object) → object
Starts with third argument or default value as result and iteratively applies function given by string to next item in list. See fold (higher-order function).
movingavg
edit(list:list, size:number) → list
Returns list of averages of each set of size consecutive values in list. Length of resulting list is list count(list) - size + 1.
Tables
edittable
edit(list, expression, ...) → table
Evaluates each expression given in the context of each item in list and constructs a table of resulting values. Table contains one row for each item in list and one column for each expression. Parameter names given for expressions will be used as column names.
count
edittable → number
Returns number of rows in argument.
column
edit(table, number) → list
(table, string) → list
Returns list of values in table column given by column index or name.
columncount
edittable → number
Returns number of columns in argument.
sortby
edit(table, number) → table
(table, string) → table
Sorts table by column index or name.
Categories
editcategory
editstring → category
Returns category with name given by argument.
hidden
editcategory → boolean
Returns true if category is hidden, otherwise false.
count
editcategory → number
Returns number of items in category.
subcatcount
editcategory → number
Returns number of subcategories in category.
Pages
editpage
editstring → page
Returns page with name given by argument.
::
edit(page:page, param:string) → string
Infobox lookup. Returns value of parameter param in infobox on page, with reference to parameter normalization table. Returns <no infobox> if page has no infobox, <no param> if page has an infobox but it does not contain parameter param.
assessment
editpage → string
Returns assessment level of page.
basename
editpage → string
Returns page name without namespace prefix.
categories
editpage → list
Returns list of categories that current version of page is in.
creator
editpage → user
Returns creator of page.
firstedit
editpage → revision
Returns first revision of page.
hasinfobox
editpage → boolean
Returns true if current version of page has an infobox, otherwise false.
infobox
editpage → templateinstance
Returns infobox on current version of page, if any.
isarticle
editpage → boolean
Returns true if page is article, otherwise false.
isarticletalkpage
editpage → boolean
Returns true if page is article talk page, otherwise false.
isredirect
editpage → boolean
Returns true if current version of page is a redirect, otherwise false.
isrootpage
editpage → boolean
Returns true if page is not a subpage, otherwise false.
issubjectpage
editpage → boolean
Returns true if page is not a talk page, otherwise false.
issubpage
editpage → boolean
Returns true if page is a subpage, otherwise false.
istalkpage
editpage → booleam
Returns true if page is a talk page, otherwise false.
lastedit
editpage → revision
Returns most recent revision of page.
namespace
editpage → namespace
Returns page's namespace.
subjectpage
editpage → page
If page is talk page, returns equivalent subject page, otherwise returns page.
talkpage
editpage → page
If page is not talk page, returns equivalent talk page, otherwise returns page.
target
editpage → page
If page is a redirect, returns redirect target.
text
editpage → string
Returns text of current revision to page.
title
editpage → string
Returns page title.
Revisions
editrevision
editnumber → revision
Returns revision with id given by argument.
author
editrevision → user
Returns author of revision.
change
editrevision → number
Returns difference in size between revision and previous revision to page.
issection
editrevision → boolean
Returns true if revision is section edit, otherwise false.
minor
editrevision → boolean
Returns true if revision is marked as minor, otherwise false.
new
editrevision → boolean
Returns true if revision is first revision to page, otherwise false.
page
editrevision → page
Returns page to which revision was made.
section
editrevision → string
Returns section that was edited, if any.
size
editrevision → number
Returns size of revision.
summary
editrevision → string
Returns edit summary for revision.
time
editrevision → date
Returns revision date/time.
tool
editrevision → string
Returns tool used for revision, if identifiable from summary.
Users
edituser
editstring → user
Returns user with name given by argument.
anonymous
edituser → boolean
Returns true if user is anonymous, otherwise false.
created
edituser → date
Returns date/time of account creation.
editcount
edituser → number
Returns number of edits user has made.
ignored
edituser → boolean
Returns true if user is on ignored users list, otherwise false.
name
edituser → string
Returns user's name.
talkpage
edituser → page
Returns user's talk page.
userpage
edituser → page
Returns user's user page.
Namespaces
editnamespace
editnumber → namespace
Returns namespace with specified number.
issubjectspace
editnamespace → boolean
Returns true if namespace is not a talk namespace, otherwise false.
istalkspace
editnamespace → boolean
Returns true if namespace is a talk namespace, otherwise false.
name
editnamespace → string
Returns namespace name.
number
editnamespace → number
Returns namespace number.
subpages
editnamespace → boolean
Returns true if subpages are enabled in namespace, otherwise false.
List requests
editOptional parameters common to all requests:
- cache (boolean): Set to false to ignore any cached results.
- limit (number): Maximum number of results to return. Default 1000.
- namespaces (number): For requests that return pages or revisions, limit results to specified namespaces.
- type (string): For requests that return pages, specify "revisions" to return info on last revision to each page, and "content" to return full text of last revision to each page.
allpages
editvoid → list
Returns all pages.
backlinks
editpage → list
Returns pages that link to specified page.
category
editcategory → list
Returns contents of specified category.
contribs
edituser → list
Returns user's contributions.
deletedcontribs
edituser → list
Returns user's deleted contributions.
externallinkusage
editstring → list
Returns pages containing specified external link.
history
editpage → list
Returns revisions of specified page.
images
editpage → list
Returns images on specified page.
imageusage
editpage → list
Returns pages that use specified image.
links
editpage → list
Returns all internal links on specified page.
prefix
editstring → list
Returns pages with titles that begin with specified prefix.
subcats
editcategory → list
Returns subcategories of specified category.
search
editstring → list
Returns pages that appear in search results for specified search term.
templates
editpage → list
Returns templates used on specified page.
transclusions
editpage → list
Returns pages on which specified template is used.
Statistics
editpagecount
editvoid → number
Returns total number of pages.
articlecount
editvoid → number
Returns total number of articles.
usercount
editvoid → number
Returns total number of user accounts.
activeusercount
editvoid → number
Returns total number of active user accounts.
filecount
editvoid → number
Returns total number of files.
editscount
editvoid → number
Returns total number of revisions.
Wikitext
editexpand
editstring → string
Returns argument treated as wiki markup with any templates expanded.
strip
editstring → string
Returns argument with wiki links, tags and formatting removed.
paramnorm
editstring → string
Returns argument normalized according to parameter normalization table.
getparam
edit(wikitext:string, template:string, param:string) → string
Returns value of parameter param in first occurence of template in wikitext.
setparam
edit(wikitext:string, template:string, param:string, value:string) → boolean
Returns wikitext with parameter param in first occurence of template set to value. Treats any template that redirects to template as an instance of such. Replaces parameter value if it already exists, otherwise adds it. Does nothing if no instance of template is found. Returns true if parameter was set, otherwise false.
addcategory
edit(wikitext:string, category:string) → string
Returns wikitext with category added. Does not add category if already present.
removecategory
edit(wikitext:string, category:string) → string
Returns wikitext with category removed, or no change if category not present.
replacecategory
edit(wikitext:string, category:string, replacement:string) → string
Returns wikitext with category replaced with replacement, or no change if not present.
removetemplate
edit(wikitext:string, template:string) → string
Returns wikitext with first occurence of template removed, or no change if no instance of template present. Treats any template that redirects to template as an instance of such.
Actions
editedit
edit(page:page, wikitext:string, summary:string) → string
Edits page specified by page, using wikitext as text and summary as edit summary.
Optional arguments:
- section - string. Edit this section. Should be number or "new".
- minor - boolean. Whether to mark as minor edit. Defaults to true.
- bot - boolean. Whether to mark as bot edit. Defaults to true if account is in bot group, has no effect if not.
- create - boolean. Whether to create page if it does not exist. Defaults to true.
- conflict - string. Behaviour in event of edit conflict. One of the following values. Default is ignore.
- abort - Give up and move on.
- retry - Try again. When adding section or prepending/appending text, applies changes on top of conflicted edit. Will overwrite conflicted edit in other cases.
- prompt - Ask whether to save anyway.
- ignore - Don't bother checking for conflicts in the first place.