User:ThomasBot/Help:Bots

One robot is available and freely useable on the English Wikisource: ThomasBot. This bot follows regex requests placed on its talk pages; this page explains the request syntax.

Making a request
Requests must be made using the (French for 'request') template. The general syntax is  . You can make several requests simultaneously, but the bot will do one at a time. Thus, there should only be one on the page at any one time, unless you make a mistake. The bot updates the template to show the status of the request:
 * Request not yet begun:
 * Bot doesn't understand:
 * Request in progress:
 * request done:

If the bot does not respond, it is probably not enabled. To find out if it is currently enabled, see whether it is in the IRC channel #en.wikisource (Wikimedia). Alternately, it may simply be busy with another request, as it is used on several wikis. If that is the case, be patient.

Edit summary
The 'edit summary' field is the edit summary used by the bot. Please note your name (without a pipe '|' symbol) in this field as well. For example, "removed category (request by ThomasV)".

Destination
The 'destination' field tells the bot which pages to edit. There are three types of destinations you can specify:
 * A single page:  page name 
 * All pages linked from one page:  links:page name 
 * All pages in a category:  Category:category name 

Notes:
 * The commands NAVIGATEUR, SPLIT, and IMPORT will only work if a single page is specified.
 * The bot will ignore any page outside the articlespace.

Command
The 'command' field tells the bot what to do. Certain symbols must be escaped:

When using these symbols literally in regular expressions, they need to be double-escaped: \\[\\], \\{\\}, and \\|. In regex and replace commands, \L is replaced by the name of the link that was followed to access the page.

DELETE
Removes a given string from the page:  .

REPLACE
Replaces a given string:  .

REGEXP
Replaces a given regex pattern (python re.sub syntax):  .

TEXT, TEXTE
Put the content of a page in , unless the class already exists in the page:

 .

NAVIGATEUR
Adds a navigation template to subpages of a given page:  .

Note that after using this function, it may be necessary to make a DELETE request to eliminate redundant strings separating the title and the chapter number (for example, " - ").

SPLIT
Splits a page into subpages from second-level sections ( == foo == ). How it names pages depends on the syntax:

Notes:
 * If the request has no results, it's probably because the page is split into third-level sections ( === foo === ) instead of second-level sections ( == foo == ).
 * The last parameter (for example, "chapter") is optional. If it is omitted, the bot will use the section names to create the subpage names. If it is not omitted, the subpages are created based on it plus a number (ie, "Chapter 3"). If NOPREFIX is used, the bot creates the pages in their own name (not as subpages).
 * If a target page already exists, the bot will check whether it is the same as the content to split. If so, it skips the section; otherwise, it creates a new page with the same name followed by a number.
 * Sometimes page creation will fail, for example if the servers return an error. This will lead to redlinks on the main page; if this is the case, you can revert the changes to the main page and resubmit the SPLIT request. You should not change any of the subpages, otherwise the bot will create duplicates (see point above).
 * The bot will not create pages if the sections to split are empty, but will add a redlink to the main page.

Example uses:
 * Add chapter titles;
 * Add quality indicators:  .