Jump to content

User:Shirik/guidebook patterns.js

From Wikipedia, the free encyclopedia
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// <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>