User:Shirik/guidebook patterns.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | Documentation for this user script can be added at User:Shirik/guidebook patterns. |
// <nowiki>
/**
* Policy/Guideline matching patterns for Guidebook
* See [[User:Shirik/guidebook.js]]
*
* Guideline match rules should be listed in the following form:
* {
* added_regex: 'someRegex',
* removed_regex: 'someRegex',
* summary_regex: 'someRegex',
* modifiers: 'i',
* text: 'WP:N',
* href: 'Wikipedia:Notability'
* }
*
* Field 'added_regex' is an optional perl-compatible regular expression associated with the text
* in the added lines that causes this rule to match. If not present, it is considered always a match.
*
* Field 'removed_regex' is an optional perl-compatible regular expression associated with the text
* in the added lines that causes this rule to match. If not present, it is considered always a match.
*
* Field 'summary_regex' is an optional perl-compatible regular expression associated with the text in
* the new edit summary that causes this rule to match. If not present, it is considered always a match.
*
* Field 'modifiers' is an optional field which specifies any regular expression modifiers
* to use. Because a rule only matches a single line, modifier 'm' is implied. See
* http://www.w3schools.com/jsref/jsref_obj_regexp.asp for more details. The default is to use
* a case-sensitive search.
*
* Field 'text' is the text to display next to the edit summary when this rule matches.
*
* Field 'href' is an optional field which specifies the page to go to when the text is clicked.
* If this field is not specified, no link will be provided, and the text will be presented plain.
*/
// *************************************************************************************
// ** WARNING: YOU MUST ESCAPE ANY BACKSLASHES AND QUOTES **
// ** This is a Javascript string, and therefore you must follow the rules for **
// ** creating Javascript strings. If you want a \ in your pattern, it must be written**
// ** as \\, and so forth **
// *************************************************************************************
var GUIDEBOOK_PATTERNS = [
// Neutrality
{
summary_regex: 'neutral',
modifiers: 'i',
text: 'Neutral Point of View',
href: 'Wikipedia:NPOV'
},
// Notability (deletion templates, problem templates, and edit summaries referencing "notable")
{
added_regex: '{{db\\-(a7|person|band|club|inc|web|animal|event|a9|song)}}',
modifiers: 'i',
text: 'Notability',
href: 'Wikipedia:Notability'
},
{
removed_regex: '{{db\\-(a7|person|band|club|inc|web|animal|event|a9|song)}}',
modifiers: 'i',
text: 'Notability',
href: 'Wikipedia:Notability'
},
{
summary_regex: '\\bnotab', // "notable" or "notability"; doubt this will match other things
modifiers: 'i',
text: 'Notability',
href: 'Wikipedia:Notability'
},
// Application and removal of CSD templates
{
added_regex: '{{db\\-',
modifiers: 'i',
text: 'Speedy Deletion Policy',
href: 'Wikipedia:CSD'
},
{
removed_regex: '{{db\\-',
modifiers: 'i',
text: 'Speedy Deletion Policy',
href: 'Wikipedia:CSD'
},
// Inappropriate ordinals ("June 9th" instead of "June 9")
{
added_regex: '(January|February|March|April|May|June|July|August|September|October|November|December) \\d+(st|nd|rd|th)',
modifiers: 'i',
text: 'Date Ordinals',
href: 'Wikipedia:DATESNO'
},
// Inappropriate abbreviations
{
added_regex: 'anno domini|acquired immunodeficiency syndrome|\ba\\.?k\\.?a\\.?\b|amplitude modulation|ante meridiem|Australian and New Zealand Army Corps|British Broadcasting Corporation|before Christ|Before Common Era|Compact Disc|Common Era|Digital Versatile Disc|exempli gratia|European Union|frequency modulation|human immunodeficiency virus|id est|light amplification by stimulated emission of radiation|\bN\\.?A\\.?\b|National Aeronautics and Space Administration|North Atlantic Treaty Organization|quasi-autonomous non-governmental organization|personal computer|post meridiem|People\'s Republic of China|radio detection and ranging|self-contained underwater breathing apparatus|sound navigation and ranging|television|United Arab Emirates|United Kingdom|United Nations Educational, Scientific and Cultural Organization|United Nations Children\'s Fund|United States|Universal Serial Bus|Union of Soviet Socialist Republics',
modifiers: 'i',
text: 'Approved Abbreviations',
href: 'Wikipedia:ACRO'
},
{
removed_regex: 'anno domini|acquired immunodeficiency syndrome|\ba\\.?k\\.?a\\.?\b|amplitude modulation|ante meridiem|Australian and New Zealand Army Corps|British Broadcasting Corporation|before Christ|Before Common Era|Compact Disc|Common Era|Digital Versatile Disc|exempli gratia|European Union|frequency modulation|human immunodeficiency virus|id est|light amplification by stimulated emission of radiation|\bN\\.?A\\.?\b|National Aeronautics and Space Administration|North Atlantic Treaty Organization|quasi-autonomous non-governmental organization|personal computer|post meridiem|People\'s Republic of China|radio detection and ranging|self-contained underwater breathing apparatus|sound navigation and ranging|television|United Arab Emirates|United Kingdom|United Nations Educational, Scientific and Cultural Organization|United Nations Children\'s Fund|United States|Universal Serial Bus|Union of Soviet Socialist Republics',
modifiers: 'i',
text: 'Approved Abbreviations',
href: 'Wikipedia:ACRO'
},
// Rollback policy
{
summary_regex: 'Reverted edits by',
text: 'Rollback Policy',
href: 'Wikipedia:RBK'
},
// Reverts due to rollback or vandalism
{
summary_regex: 'vandal',
modifiers: 'i',
text: 'Vandalism',
href: 'Wikipedia:VANDAL'
},
// "Undo" actions
{
summary_regex: 'Undid',
text: 'Three Revert Rule',
href: 'Wikipedia:3RR'
}
];
// </nowiki>