Content deleted Content added
Ohconfucius (talk | contribs) multiple or zero spaces |
Ohconfucius (talk | contribs) line spacing |
||
(11 intermediate revisions by the same user not shown) | |||
Line 14:
importScript("User:Ohconfucius/test/Sources_subscript2.js"); //Correctly casing titles and apply or rem italicisation
importScript("User:Ohconfucius/test/Sources_subscript3.js"); //link-fixing, dabbing etc
// importScript("User:Ohconfucius/script/foreigndates.js"); //link-fixing, dabbing etc
}
function Ohc_add_ref_tags() {
var txt=document.editform.wpTextbox1;
Line 28 ⟶ 29:
regex(/\s?(<ref>(?:[^<>]*\|\s*url\s*=|\[?)https?:\/\/((?:\w+\.)*\w+(?:\.(?:com?|org|net|gov|ac|)(?:\.[a-z]{2}|)))\/[^<>{}]+\|publisher=)(?=}}<\/ref>)/gi, "$1$2"); //capture ___domain name to add to publisher
regex(/(\|\s*(?:publisher|website)\s*\=\s*)w{3}\.(\w+\.(?:com?|org|net|gov|ac|)(?:\.[a-z]{2}|))(?=\s*[|}])/gi, '$1$2');
regex(/(\|\s*publisher=)\s?\|\s
// regex(/\|\s
regex(/\s?[-–]\s?(?:The |)(\w+\.(?:com?|org|net|gov|ac|)(?:\.[a-z]{2}|))\s?(\|\s*publisher\s*\=\s*)\1(?=}})/gi, '$2$1');
regex(/\s?[-–]\s?([^|]+)\s?(\|\s*publisher\s*\=\s*)(The )\1(?=}})/gi, '$2$3$1');
regex(/\|\s
regex(/({{Navbox deaths}})(\n)/gi, '==References==$2{{Reflist}}$2$1$2');
regex(/(==References==\n{{Reflist}}\n)\n?\1/gi, '$1');
}
function Ohc_remove_urls() {
var txt=document.editform.wpTextbox1;
// warning-tagging template:Primary source inline
regex(/(<ref[^<>]*>[^<>]*\|[ ]*url ?= ?https?:\/\/(?:(?:www\.|mobile\.|)(?:blogger|blogspot|facebook|sites\.google|instagram|tiktok|twitter|wordpress|x)\.com|www\.formspring\.me)\/[^<>{]*
regex(/(<ref[^<>]*>[^<>]*\|[ ]*url ?= ?https?:\/\/(?:(?:www\.|)(?:myspace|findagrave)\.com)\/[^<>{]*
regex(/(<ref>\s*https?:\/\/(?:(?:www\.|)(?:blogger|blogspot|facebook|sites\.google|findagrave|instagram|myspace|tiktok|twitter|wordpress|x)\.com)\/[^\s\]<]*
regex(/(<ref>\s*\[https?:\/\/(?:(?:www\.|)(?:blogger|blogspot|facebook|sites\.google|findagrave|instagram|myspace|tiktok|twitter|wordpress|x)\.com)\/[^\s\]]*[ ]+[\w\d][^\]]*\]
// removing http links within publisher/journal/work fields
//
// regex(/(\|\s*(?:author|publisher|work) *= *)(?:https?:\/{2}|)(?:w{3}\.|)(\w+(?:\.(?:com?|net|org|gov|\w{2})|)(?:\.\w{2}|))(?:\/[^|}]*|)(?=\s*[\]|}])/gi, '$1$2'); //returns ___domain name
regex(/(\|\s*title\s*\=)\s*
regex(/(\|\s*title\s*\=)\s*
// regex(/(\|\s*title\s*\=)\s*Archived copy(?=\s?(?:[=|{]|\}\}))/gi, '$1 '); rem as creating CS1 errors
regex(/\s?<!--ACTUAL ARTICLE TITLE BELONGS HERE!(?: original text:|)[^>]*-->/gi, ' '); //rem error introduced by earlier version of this script; entirely strip title field
regex(/(\|\s*(?:author(?:link\d?|)|chapter|journal|magazine|newspaper|publisher|title|work|via)\s*\=\s*)https?:\/{2}(?:w{3}\.|)(?=\w)/gi, '$1'); //removes http:// and optionally www.
regex(/(\|\s*(?:author(?:link\d?|)|chapter|journal|magazine|newspaper|publisher|title|work|via)\s*\=\s*)(?:w{3}\.)(?=\w)/gi, '$1'); //removes www.
regex(/(\|\s*(?:author(?:link\d?|)|chapter|journal|magazine|newspaper|publisher|title|work|via)\s*\=\s*)(\w+(?:\.(?:com?|net|org|gov|\w{2}))(?:\.\w{2}|))(?:\/[^|}]*|)(?=\s*[\]|}])/gi, '$1$2'); //returns ___domain name
regex(/(>{{cit[^}]+\|\s
regex(/(>{{cit[^}]+\|\s
// removing hyperlinks within publisher/journal/website/work fields
regex(/(\|\s*(?:chapter|journal|magazine|newspaper|publisher|title|work|via)\s*\=\s*)\[https?:\/\/[^\s\]]*\s([\w][^\]]*)\]/gi, '$1$2'); //leave only linked text
regex(/(
regex(/(\|\s*title\s*=\s*)(?:\w+(?:\.(?:com?|net|org|gov|\w{2}))(?:\.\w{2}|))(?:\/[^|}]+)(?:\/[^|}]+)(?:\/[^|}]+)(?:\/[^|}]+)\/([^|}]+)\/?(?=\s*[\]|}])/gi, '$1$2'); //returns terminal part of url
Line 73 ⟶ 75:
// removing references to other WP articles and 'external' WP links
regex(/<ref[^<>]*>[^<>]*\|[ ]*url ?= ?https?:\/\/\w{2}\.wikipedia\.org\/w[^<>]*<\/ref>/gi, '{{cn}}<!-- WP:RS needed; removed link to WP-->');
regex(/<ref>\s*https?:\/\/\w{2}\.wikipedia\.org\/wiki\/[^\s\]<]*<\/ref>/gi, '{{cn}}<!-- WP:RS needed; removed link to WP-->');
regex(/<ref>\s*\[https?:\/\/\w{2}\.wikipedia\.org\/w[^\s\]]*[ ]+[\w\d][^\]]*\]<\/ref>/gi, '{{cn}}<!-- WP:RS needed; removed link to WP-->');
Line 80 ⟶ 82:
//deprecated sources
regex(/<ref[^<>]*>[^<>]*\|[ ]*url ?= ?https?:\/\/(?:(?:\w+\.|)((?:the|)epochtimes|ntdtv)\.com)\/[^<>{]*<\/ref>/gi, '<!--rem deprecated source \($1\)-->');
regex(/<ref[^<>]*>[^<>]*\|[ ]*url ?= ?https?:\/\/(?:(?:\w+\.|)(thesun|dailymail)\.co\.uk)\/[^<>{]*<\/ref>/gi, '<!--rem deprecated source \($1\)-->');
regex(/(\|\s*url\s*\=\s*|\[)(https?:[^|{}#\s]+)(?:#[A-Za-z0-9\.]{12,13}|\?CMP=fb_gu)(?=[\s\[\]|{}<>])/gi, '$1$2'); //rem link tracking
regex(/(\|\s*url\s*\=\s*)(https?:[^|{}#\s]+\.html?)\?[^|}]{1,5}(?=[\s\[\]|{}<>])/gi, '$1$2'); //rem link tracking
regex(/(\|\s*url\s*\=\s*|\[)(https?:\/\/books\.google\.[^\/]+\/books\?id=\w{12}&pg=PA\d{1,3})&dq[^\s|}]+(?=\s?[|}])/gi, '$1$2'); //rem browser optimisation
}
Line 108 ⟶ 109:
regex(/(\.\.\. |)\{\{!\}\} 立場(報道|新聞)/gi, '');
regex(/(\|\s*title\s*\=\s*)Login ?(?=[|}])/gi, '$1'); //creating deliberate error (blank title) per Trappist
regex(/(\|\s*)(?:publisher|website|work)=
regex(/(\|\s*)(?:publisher|website|work)=(Amazon)(?:\.com|)(?:\.\w{2}|)(?=\s*[|}])/gi, '$1via=$2');
regex(/(\|\s*)(?:publisher|website|work)=(
regex(/(\|\s*
//Remove COinS corrupting templates from CS1 citations
Line 123 ⟶ 122:
regex(/(\|\s*url\s*\=)(www\.)(?=[|}])/gi, '$1http//$2'); //common cs1 error
regex(/(\|\s*date\s*=\s*)(?:not? |non-|un)date[ds]?\s*(?=[|}])/gi, '$1n.d.'); //common cs1 error
regex(/(\|\s*dead-?url=no?)(?=\s*[|}])/gi, '|url-status=dead'); //common cs1 error (deprecated parameter)
regex(/(\*[ ]*|)\[\[n:[^\]\|]*\]\][\r\n]*/gi, '');
//citation template fixes
// regex(/(\|\s*)published\s?=/gi, '$1publisher=');
// rem copyright assertion
regex(/(\|\s*publisher\s*\=\s*)(?:\[\[copyright(?:\|©|)\]\])\s?/gi, '$1');
regex(/(\|\s*publisher\s*\=\s*)(?:©|copyright)\s?/gi, '$1');
regex(/(\|\s*title\s*\=\s*[^|}]+?)[-‒–—―]\s+([^|}]+?)(\|\s*(?:publisher|work)\s*\=\s*\2)/gi, '$1$3');
regex(/(\|\s*title\s*\=\s*([^|}]+?))[-‒–—―]\s+([^|}]+?\|\s
// misused 'date' parameter
regex(/(\{\{\s?cit[ae][^}]+)\|\s
// rem toggles and redundant quote marks
Line 145 ⟶ 142:
regex(/(\|\s*title\s*\=\s*)\''([^\|\{\}]+)\''/gi, '$1$2'); //rem ' in titles
regex(/(\|\s*publisher\s*\=\s*)\(([^\|\{\}]+)\)/gi, '$1$2'); //rem parenthetical publishers
regex(/(\|\s*publisher\s*\=\s*)\"([^\|\{\}]+)\"/gi, '$1$2'); //rem quote marks around publishers
// reordering 'work' and 'publisher' (first run - see second run in cleanup function)
Line 151 ⟶ 149:
/// removing identical/similar entries in 'work' and 'publisher', and in 'work' and 'website' (different default vs [post] cleanup rules)
regex(/\|\s
regex(/\|\s
regex(/\|\s
regex(/\|\s
regex(/\|\s
regex(/\|\s
// remove redundant parentheses and templates from dm and md dates (equivalents also exists in Mosnum script)
Line 175 ⟶ 173:
// adjust for possibly incorrectly input title
regex(/(\|\s*title\s*\=\s*)([^\|\}<>]*)(\s?\|[^}<>]*|)\|\s
// rem misplaced punctuation
Line 184 ⟶ 182:
regex(/(?:\|[ ]*(?:agency|arxiv|asin|at|author(-?link|-mask|-name-separator|-separator|\d|\d-link|link\d?|)|bibcode|chapter|chapter-url|coauthors?|contribution(?:-url|)|date|deadurl|display-authors|doi|doi-inactive|doibroken|edition|(?:editor|translator)(?:-first|-last|-link|\d|\d-first|\d-last|\d-link)|(?:first|last)\d?|format|id|is[bs]n|issue|jfm|journal|jstor|language|lay(?:date|source|summary)|lccn|___location|magazine|day|month|mr|newspaper|nopp|oclc|ol|origyear|osti|others|pages?|periodical|place|pm[cd]|pmid|postscript|publisher|quote|ref|rfc|separator|series|ssrn|trans_title|type|url|volume|via|work|year|zbl)[ ]*=[\s]*)(?=[}|])/gi, '');
// regex(/(?:\|[ ]*(began|ended)[ ]*=[^}|]*)(?=[}|])/gi, ''); //disabled 18/06/20: false positive removal of associated (Start date) templates
regex(/(\|\s*work\s?\=\s?)\[\[iTunes\]\] Archive\s/gi, '|publisher=[[iTunes
//rem underlining within certain fields
Line 255 ⟶ 253:
//linked publishing houses
// removing publishers less well-known than their titles
regex(/(\|\s*publisher\s?\=MTV\|\s
regex(/(?:\|publisher=Turner Sports Interactive, Inc)\.? ?\|publisher=(NBA)(?= ?\|)/gi, '$1');
Line 262 ⟶ 260:
// removing publishers for periodicals
regex(/\|publisher=\[\[(?:PMC \(company\)\||)(?:PMC|Penske Media Corporation)\]\](?=[\s\.]*[|}])/gi, '');
regex(/(?:\|\s
regex(/(?:\|\s
regex(/(?:\|\s
regex(/\| ?publisher ?= ?(?:Fandango Media|\[\[Fandango Media\]\]) ?/gi, '');
regex(/\|\s
// regex(/\|\s?publisher\s*\=\s*(?:\w+ )+(?:Media|Publishing|Publications)(?: Group(?:,? Inc\.)?| Berhad)(?=[\s\.]*[|}])/g, ''); //rem "Communications" - false positive for "Ministry of Economic Affairs and Communications" reported 28 May 2014
//duplicate above with links //("Corporation" excluded - false positive with Australian Broadcasting Corporation)
regex(/(?:\|\s
regex(/\|\s
regex(/\|\s
// regex(/\|\s
regex(/\| ?publisher ?= ?Star Publications \(Malaysia\)|\[\[Star Publications \(Malaysia\)\]\] ?/gi, '');
Line 284 ⟶ 283:
var txt=document.editform.wpTextbox1;
// The following regexes for dab-links are in sets of four. If changing, please ensure all sets are changed )note (unique regex line for Empire film magazineadded 20/6/2021)
regex(/(=[ ]*(?:The ?|)[A-Z]\w*(?: [A-Z]\w*|)) \((South Africa)(?:n newspaper|)\)([ ]*[|}])/g, '$1|___location=$2$3');
regex(/(''(?:The ?|)[A-Z]\w*(?: [A-Z]\w*|)) \((South Africa)(?:n newspaper|)\)(''[\.,;])/g, '$1$3$2');
Line 294 ⟶ 293:
regex(/(\|)(The Advertiser)(?: \((Adelaide)\))(\]\])/g, '$1$2$4|___location=$3');
regex(/(\[\[)(The Advertiser)( \((Adelaide)\))(\]\])/g, '$1$2$3|$2$5|___location=$4');
regex(/(=[ ]*)(Apollo|Billboard|Brick|Campaign|Clash|Coda|Ebony|Esquire|Essence|Fanfare|Fast Company|Fortune|Glamour|Hello!|Life|Limelight|Maxim|Mojo|Mother Jones|New York|Nuts|Paste|People|Poetry|Q|Reason|Shape|Slate|Spin|Time(?: Out|)|Variety|Wired) \((?:magazine)\)(?=\s*[|}])/g, '$1$2'); //non-standard code
regex(/('')(Apollo|Billboard|Brick|Campaign|Clash|Coda|Ebony|Esquire|Essence|Fanfare|Fast Company|Fortune|Glamour|Hello!|Life|Limelight|Maxim|Mojo|Mother Jones|New York|Nuts|Paste|People|Poetry|Q|Reason|Shape|Slate|Spin|Time(?: Out|)|Variety|Wired) \(magazine\)(?='')/g, '$1$2'); //non-standard code
regex(/(\[\[(Apollo|Billboard|Brick|Campaign|Clash|Coda|Ebony|Esquire|Essence|Fanfare|Fast Company|Fortune|Glamour|Hello!|Life|Limelight|Maxim|Mojo|Mother Jones|New York|Nuts|Paste|People|Poetry|Q|Reason|Shape|Slate|Spin|Time(?: Out|)|Variety|Wired) \(magazine\))(?=\]\])/g, '$1|$2'); //non-standard code - tweaked to insert title per pipe trick
regex(/(\|)(Apollo|Billboard|Brick|Campaign|Clash|Coda|Ebony|Esquire|Essence|Fanfare|Fast Company|Fortune|Glamour|Hello!|Life|Limelight|Maxim|Mojo|Mother Jones|New York|Nuts|Paste|People|Poetry|Q|Reason|Shape|Slate|Spin|Time(?: Out|)|Variety|Wired)(?: \(magazine\))(?=\]\])/g, '$1$2');
regex(/(=[ ]*)(Empire) \((?:film magazine)\)(?=\s*[|}])/g, '$1$2'); //non-standard code
regex(/('')(Empire) \(film magazine\)(?='')/g, '$1$2'); //non-standard code
regex(/(''\[\[(Empire) \(film magazine\))(?=\]\]'')/g, '$1$2'); //non-standard code
regex(/(=[ ]*\[\[(Empire) \(film magazine\))(?=\]\][ ]*\|)/g, '$1|$2'); //non-standard code (unique regex added 20/6/2021)
regex(/(\|)(Empire)(?: \(film magazine\))(?=\]\])/g, '$1$2');
//Journals
regex(/(=[ ]*)(Science|Nature) \((?:journal)\)(?=\s*[|}])/g, '$1$2'); //non-standard code
regex(/('')(Science|Nature) \(journal\)(?='')/g, '$1$2'); //non-standard code
regex(/(''\[\[(Science|Nature) \(journal\))(?=\]\]'')/g, '$1|$2'); //non-standard code
regex(/(\|)(Science|Nature)(?: \(journal\))(?=\]\])/g, '$1$2');
regex(/(=[ ]*)(Quartz) \((?:publication)\)(?=\s*[|}])/g, '$1$2'); //non-standard code
regex(/('')(Quartz) \(publication\)(?='')/g, '$1$2'); //non-standard code
regex(/(''\[\[(Quartz) \(publication\))(?=\]\]'')/g, '$1|$2'); //non-standard code
regex(/(\|)(Quartz)(?: \(publication\))(?=\]\])/g, '$1$2');
regex(/(=[ ]*)(Salon) \((?:website)\)(?=\s*[|}])/g, '$1$2'); //non-standard code
regex(/('')(Salon) \(website\)(?='')/g, '$1$2'); //non-standard code
regex(/(''\[\[(Salon) \(website\))(?=\]\]'')/g, '$1|$2'); //non-standard code
regex(/(\|)(Salon)(?: \(website\))(?=\]\])/g, '$1$2');
regex(/(=[ ]*)(Stuff) \((?:company)\)(?=\s*[|}])/g, '$1$2'); //non-standard code
regex(/('')(Stuff) \(company\)(?='')/g, '$1$2'); //non-standard code
regex(/(''\[\[(Stuff) \(company\))(?=\]\]'')/g, '$1|$2'); //non-standard code
regex(/(\|)(Stuff)(?: \(company\))(?=\]\])/g, '$1$2');
regex(/(=[ ]*Daily News) \((New York)\)([ ]*[|}])/g, '$1|___location=$2$3');
Line 325 ⟶ 340:
regex(/(''(?:Daily Star)) \((United Kingdom)\)('')/g, '$1$3 ($2)');
regex(/(\|)(Daily Star)(?: \(United Kingdom\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*El Comercio) \((Equador|Peru|Spain)\)(\s*[|}])/g, '$1|___location=$2$3');
regex(/(''El Comercio) \((Equador|Peru|Spain)\)('')/g, '$1$3 ($2)');
regex(/(\|)(El Comercio)(?: \((?:Equador|Peru|Spain)\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*El Mundo) \((Columbia|Spain)\)(\s*[|}])/g, '$1|___location=$2$3');
regex(/(''El Mundo) \((Columbia|Spain)\)('')/g, '$1$3 ($2)');
Line 337 ⟶ 355:
regex(/(''The Herald) \((Glasgow)\)('')/g, '$1$3 ($2)');
regex(/(\|)(The Herald)(?: \(Glasgow\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*The Mercury) \((Hobart)\)(\s*[|}])/g, '$1|___location=$2$3');
regex(/(''The Mercury) \((Hobart)\)('')/g, '$1$3 ($2)');
regex(/(\|)(The Mercury)(?: \(Hobart\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*Metro) \((British newspaper)\)(\s*[|}])/g, '$1|___location=UK$3');
regex(/(''Metro) \((British newspaper)\)('')/g, '$1$3 (UK)');
Line 368 ⟶ 389:
regex(/(\|)(Sporting Life)(?: \(British newspaper\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*The Standard) \((Hong Kong|Kenya)\)(\s*[|}])/g, '$1|___location=$2$3');
regex(/(=[ ]*Today) \((Singapore newspaper)\)(\s*[|}])/g, '$1|___location=Singapore$3');
regex(/(''Today) \((Singapore newspaper)\)('')/g, '$1$3 (Singapore)');
regex(/(\|)(Today)(?: \(Singapore newspaper\))(\]\])/g, '$1$2$3');
regex(/(''The Standard) \((Hong Kong|Kenya)\)('')/g, '$1$3 ($2)');
regex(/(\|)(The Standard)(?: \((?:Hong Kong|Kenya)\))(\]\])/g, '$1$2$3');
Line 404 ⟶ 428:
regex(/(= ?(?:RT)) \((TV network)\)([ ]*[|}])/g, '$1|___location=Russia$3');
regex(/(\|)(RT)(?: \(TV network\))(\]\])/g, '$1$2$3');
regex(/((?:agency|author|journal|magazine|newspaper|periodical|website|work)[ ]*=[ ]*\[\[[\w\s]+\w) ?(\|language=\w{2} ?(?:\|___location=(?=Hong Kong|Taiwan) ?|))(\]\])[ ]*(?=[|}])/g, '$1$3 $2'); //adjust misplaced brackets due to insertion
// regex(/(=[ ]*\[\[)([^\[\]\(\)\|:]*)( \([^\[\]\(\)\|]*\))(\]\])/gi, '$1$2$3|$2$4'); //adding piping to parentheticals inside parameters //disabled 7/3/2020 false positives (e.g. [[Communist Party of India (Marxist)]])
Line 420 ⟶ 446:
regex(/(.) at Discogs(\][\.,;]) Discogs\.com(\.| )/gi, '$1$2Discogs$3');
regex(/(\|\s*author\s?\=\s?)(?:posted|publishe[dr]|written)\s?(?:by|on):?\s/gi, '$1');
regex(/\|\s
// regex(/\|\s
// regex(/\|\s
// regex(/\|\s
regex(/\|\s
//rem duplicated publishers in separate fields (post); rem preceding nbsp
Line 443 ⟶ 469:
/// removing identical/similar entries in 'work' and 'publisher', and in 'work' and 'website'
regex(/\|\s
regex(/\|\s
regex(/\|\s
regex(/\|\s
regex(/\|\s
regex(/\|\s
regex(/(\|\s*(?:newspaper|website|work)\s*\=\s*(?:[^=|}\[<>]*)(?:\|[^}<>]*|))\|\s
regex(/(\|\s*(?:newspaper|website|work)\s*\=\s*\[\[([^<|\]]*)\]\](?:\|[^}<>]*|))\|\s
regex(/(\|\s*(?:newspaper|website|work)\s*\=\s*(?:\[\[(?:[^<|\]]*)\|(?:[^}<>]*)\]\])(?:\|[^}<>]*|))\|\s
regex(/(\|\s*(?:newspaper|website|work)\s*\=\s*(?:\[\[(?:[^<|\]]*)\|(?:[^}<>]*)\]\])(?:\|[^}<>]*|))\|\s?work\s*\=\s*(?:[^\[|}]*)(?=\s*[|}])/g, '$1'); //piped work x1
regex(/\|\s
regex(/(\|[ ]*?___location=[^\|<\}]*)([^<}]*|)\|[ ]*?___location=[^|}]*(?=[|}])/gi, '$1$2');
Line 463 ⟶ 490:
//remove redundant parameter ('website' is an alias of 'work')
// regex(/\|\s
// regex(/\|\s
// regex(/\|\s
regex(/(\|\s*(?:newspaper|website|work)\s*\=\s*[^=}<>]*(?:\|[^}<>]*|))\|\s
Line 479 ⟶ 506:
regex(/( | [\w, ]*?)(?=[ ]|)/gi, '');
regex(/( | Comment is free)/gi, '');
regex(/\|\s
regex(/\|\s
regex(/(?:Entertainment|Football|(?:inter|)national|Latest|local|Music|UK|world|) News |(?=[ ]?[&\|])/gi, '');
regex(/(?:[-–|]||)[ ]*(?:Entertainment|Football|(?:inter|)national|Latest|local|Music|UK|world|) News(?=[ ]?[&\|])/gi, '');
regex(/<!-- Bot generated title -->/gi, '');
regex(/(\|\s*title\s*\=\s*[^|}]+?)[-‒–—―]\s+([^|}]+?)(\|\s*(?:publisher|work)\s*\=\s*\2)/gi, '$1$3');
regex(/(\|\s*title\s*\=\s*([^|}]+?))[-‒–—―]\s+([^|}]+?\|\s
regex(/(\|\s*website\s*\=\s*Play Legit):\s+[^|}]+?(?=[\|}])/gi, '$1');
Line 520 ⟶ 547:
// regex(/(<ref name=[^/>"]*)>([\s\S]*)\1>/gi, '$1A>$2$1B>');
// regex(/(<ref name="[^/>]*)">([\s\S]*)\1>/gi, '$1A>$2$1B">');
}
Line 552 ⟶ 580:
// protect the rest (after purging urls inserted in ('website' or )'work' parameters)
regex(/((?:[\[=]\s*)(?:https?:|ftp:))([^\]\|\}]*)(\s*[\]|}])/gi, protect_function);
regex(/(
regex(/(\
regex(/(\|\s*(?:contribution|quote|title)\s*=)([^|}]+)([\|\}])/gi, protect_function);
//whitelisting -against changes made by generic regex in Ohc_sourcepub (e.g. Fast Company)
Line 559 ⟶ 588:
}
function ohc_unprotect_urls()
Line 598 ⟶ 626:
ohc_protect_urls();
Ohc_sources_prep();
Ohc_unpipe();
Ohc_dab_news_sources();
Line 609 ⟶ 637:
Ohc_sources_cleanup();
ohc_unprotect_urls();
Ohc_Source_edit_summary();
Line 618 ⟶ 645:
// removing references to other WP articles and 'external' WP links
regex(/<ref[^<>]*>[^<>]*\|[ ]*url ?= ?https?:\/\/(?:\w{2}\.wikipedia\.org\/wiki|(?:www\.|)(?:blogger|blogspot|facebook|
regex(/<ref>https?:\/\/(?:en\.wikipedia\.org\/wiki|(?:www\.|)(?:blogger|blogspot|facebook|
regex(/<ref>\[https?:\/\/(?:en\.wikipedia\.org\/wiki|(?:www\.|)(?:blogger|blogspot|facebook|
regex(/\|[ ]*url[ ]*=[ ]*https?:\/\/(?:\w{2}\.wikipedia\.org\/wiki|(?:www\.|)(?:blogger|blogspot|facebook|
regex(/[ ]\[https?:\/\/en\.wikipedia\.org\/wiki\/[^\s\]]*[ ]+([\w][^\]]*)\]/gi, ' [[$1]]');
Line 630 ⟶ 656:
function ohc_ref_names() {
// give names to citations in templates that are without names
regex(/<ref>((?:[
regex(/<ref>((?:[^<>]*\|\s*url\s*=|[\[\s]?)https?:\/\/(?:[^|</]+\.)*(
regex(/<ref>((?:[^<>]*\|\s*url\s*=|[\[\s]?)https?:\/\/(?:[^|</]+\.)*([-\w]+)(?:\.[a-z]{2})\/[^<>|{}\d]*(\d{6,12})[^<>]*)(?=<\/ref>)/gi, "<ref name=$2_$3>$1"); //urls with non-date serial numbers
regex(/<ref>((?:[^<>]*\|\s*url\s*=|[\[\s]?)https?:\/\/(?:[^|</]+\.)*(reuters)\.com\/[^<>|{}\d]*(id\w{11})[^<>]*)(?=<\/ref>)/gi, "<ref name=$2_$3>$1"); //reuters urls with non-date serial numbers
ohc_regex(/<ref>((?:[^<>]*\|\s*url\s*=|[\[\s]?)https?:\/\/(?:[^|</]+\.)*([-\w]+)(?:\.[a-z]{2,3})\/[^<>|{}\d]*@YYYY[-\/]@MM[-\/]@DD\/(\w+)[^<>]*)(?=<\/ref>)/gi, "<ref name=$2_@Year@ZM@
ohc_regex(/<ref>((?:[^<>]*\|\s*url\s*=|[\[\s]?)https?:\/\/(?:[^|</]+\.)*([-\w]+)(?:\.[a-z]{2,3})\/[^<>|{}\d]*@YYYY[-\/]@
ohc_regex(/<ref>([^<>]*\|\s*url\s*=https?:\/\/(?:[^|</]+\.)*(\w+)\.(?:(?:com?|org|net|gov|ac|)(?:\.[a-z]{2}|))\/[^<>]*\|\s*date\s*=\s*@Day @Month @YYYY\s*[|}][^<>]*)(?=<\/ref>)/gi, "<ref name=$2_@Year@ZM@ZD
ohc_regex(/<ref>([^<>]*\|\s*url\s*=https?:\/\/(?:[^|</]+\.)*(\w+)\.(?:(?:com?|org|net|gov|ac|)(?:\.[a-z]{2}|))\/[^<>]*\|\s*date\s*=\s*@Month @Day, @YYYY\s*[|}][^<>]*)(?=<\/ref>)/gi, "<ref name=$2_@Year@ZM@ZD
ohc_regex(/<ref>([^<>]*\|\s*url\s*=https?:\/\/(?:[^|</]+\.)*(\w+)\.(?:(?:com?|org|net|gov|ac|)(?:\.[a-z]{2}|))\/[^<>]*\|\s*date\s*=\s*=\s*@YYYY-@MM-@DD\s*[|}][^<>]*)(?=<\/ref>)/gi, "<ref name=$2_@Year@
ohc_regex(/<ref>((?:[^<>]*\|\s*url\s*=|\[?)https?:\/\/(?:[^|<]+\.)*(\w+)\.(?:(?:com?|org|net|gov|ac|[a-z]{2})(?:\.[a-z]{2}|))\/[^<>|{}]+@YYYY[\/-]?@Month[\/-]?@Day[^<>]*)(?=<\/ref>)/gi, "<ref name=$2_@
}
function prevDef ( e ) {
e.preventDefault();
}
function addLinks() {
|