Module:Rfx/doc

This is a library for getting information about individual requests for adminship (RfA) and requests for bureaucratship (RfB) pages on the English Wikipedia. It is not meant to be used directly from wiki pages, but rather to be used by other Lua modules.

Creating new objects
First of all, the library must be loaded, like this:

Once the library is loaded, you can make a new rfx object using. (see below).

is used like this:

The  variable should be the name of a valid RfA or RfB page, for example:

If  is not specified, or the page is not a subpage of Requests for adminship or Requests for bureaucratship, then   will return.

Methods and properties
Once you have created a new  object, there are a number of methods and properties that you can use. They are all read-only.


 * Properties


 * : the type of the rfx. This is either " " or " ".
 * : the number of supports in the RfX.  if the supports could not be processed.
 * : the number of opposes in the RfX.  if the opposes could not be processed.
 * : the number of neutrals in the RfX.  if the neutrals could not be processed.
 * : the support percentage. Calculated by $$\frac{\text{supports}}{\text{supports} + \text{opposes}} \times 100$$ and rounded to the nearest integer.  if it could not be processed.
 * : the end time of the RfX. This is a string value taken from the RfX page.  if it could not be found.
 * : the username of the RfX candidate.  if it could not be found.


 * Methods

Methods must be called with the colon syntax:


 * : gets the title object for the RfX page. See the reference manual for details on how to use title objects.
 * : gets an array containing the usernames that supported the RfX. If any usernames could not be processed, the text "Error parsing signature" is used instead, along with the text of the comment in question. N.b. this technique relies on the text of comment text being unique - if it is not unique then  will treat the identical comments as duplicate votes. If the page content could not be parsed at all, this method returns.
 * : gets an array containing the usernames that opposed the RfX. Functions similarly to.
 * : gets an array containing the usernames that were neutral at the RfX. Functions similarly to.
 * : returns a boolean indicating whether there were any duplicate votes at the RfX. Returns  if the vote tables couldn't be processed.
 * : returns the number of seconds left before the RfX is due to close. Once it is due to close, shows zero. If the ending time cannot be found, returns.
 * : returns a string showing the time left before the RfX is due to close. The string is in the format " ".
 * : returns a URI object for X!'s RfA Analysis tool at Wikimedia Labs, preloaded with the RfX page.
 * : returns a string showing the current status of the RfX. This can be "successful", "unsuccessful", "open", or "pending closure". Returns  if the status could not be determined.

You can compare  objects with the   operator. This will return true only if the two objects point to the same page. will return  from the RfX page's title object (see the reference manual).

Expensive functions
This module makes use of the title:getContent method to fetch RfX page sources. This method will be called for each RfX page being looked up, so each use of  will count as an expensive function call. Please be aware that the library may fail for scripts which create many different RfX objects. (The current limit for the English Wikipedia is 500 expensive function calls per page.) Also, each RfX page that is looked up will count as a transclusion in Special:WhatLinksHere.