Content deleted Content added
Ohconfucius (talk | contribs) mirroring test script |
Ohconfucius (talk | contribs) replace up to but not including function Ohc_sourceunlink |
||
Line 42:
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)\/[^<>{]*<\/ref>)(?:\{\{Primary source inline\}\}|)/gi, '$1{{Primary source inline}}');
regex(/(<ref[^<>]*>[^<>]*\|[ ]*url ?= ?https?:\/\/(?:(?:www\.|)(?:myspace|findagrave)\.com)\/[^<>{]*<\/ref>)(?:\{\{Primary source inline\}\}|)/gi, '$1{{Primary source inline}}');
regex(/(<ref>\s*https?:\/\/(?:(?:www\.|)(?:blogger|blogspot|facebook|sites\.google|findagrave|instagram|myspace|tiktok|twitter|wordpress|x)\.com)\/[^\s\]<]*<\/ref>)(?:\{\{Primary source inline\}\}|)/gi, '$1{{Primary source inline}}');
regex(/(<ref>\s*\[https?:\/\/(?:(?:www\.|)(?:blogger|blogspot|facebook|sites\.google|findagrave|instagram|myspace|tiktok|twitter|wordpress|x)\.com)\/[^\s\]]*[ ]+[\w\d][^\]]*\]<\/ref>)(?:\{\{Primary source inline\}\}|)/gi, '$1{{Primary source inline}}');
// 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?<!--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.
Line 110:
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*publisher=)\|\s?via\s*\=\s*(\w+)(?=\s*[|}])/gi, '$1$2');
regex(/(?:-[ ]*Google Books[ ]*(?:\|[^}]*|)|)\|\s?publisher\s*\=\s*(Google Books)(?=[\s\.]*[|}])/g, '|via=$1');
//Remove COinS corrupting templates from CS1 citations
Line 127 ⟶ 125:
regex(/(\|\s*dead-?url=no?)(?=\s*[|}])/gi, '|url-status=dead'); //common cs1 error (deprecated parameter)
regex(/(\*[ ]*|)\[\[n:[^\]\|]*\]\][\r\n]*/gi, '');
//citation template fixes
Line 143 ⟶ 139:
// rem toggles and redundant quote marks
regex(/(\|\s*(?:agency|author|newspaper|work|journal|publisher|title)\s*\=\s*)\'\'([^|}]+)\'\'(?=\s*[\}\|])/gi, '$1$2'); //without link
regex(/(\|\s*(?:agency|author|newspaper|work|journal|publisher|title)\s*\=\s*)\'\'(\[\[(?:[^\|]+\||)[^\|\]]+\]\])\'\'(?=\s*[\}\|])/gi, '$1$2'); //with link
regex(/(\|\s*title\s*\=\s*)\''([^\|\{\}]+)\''/gi, '$1$2'); //rem ' in titles
regex(/(\|\s*publisher\s*\=\s*)\(([^\|\{\}]+)\)/gi, '$1$2'); //rem parenthetical publishers
Line 187 ⟶ 183:
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 225 ⟶ 221:
// (disabling for persistent errors) ohc_regex(/(?:Retrieved|Accessed)(?: on(?:line|)|):? (@Month\s@DD,?\s@YYYY|@DD\s@Month\s@YYYY|@yyyy-@mm-@dd)(?=\D)/gi, 'Retrieved $1');
ohc_regex(/(\w|\])[\.,;]?[ ]\((Retrieved (?:@Month\s@DD,\s@YYYY|@DD\s@Month\s@YYYY|@yyyy-@mm-@dd))\)/gi, '$1. $2');
}
Line 320 ⟶ 294:
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
Line 329 ⟶ 303:
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');
Line 376 ⟶ 356:
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)');
|