User:Ohconfucius/script/Sources.js: Difference between revisions

Content deleted Content added
incorporating 'Accessed' -> 'Retrieved' ejected from MOSNUM script
align to test
Line 52:
//citation template fixes
// rem copyright assertion
txt.value=txt.value.replaceregex(/(\|\s?publisher\s*\=\s*)(?:\[\[copyright(?:\|©|)\]\])\s?/gi, '$1');
txt.value=txt.value.replaceregex(/(\|\s?publisher\s*\=\s*)(?:©|copyright)\s?/gi, '$1');
// misused 'date' parameter
regex(/\|\s?date(\s?=\s?[12]\d{3}\s?[\|\}])/gi, '|year$1');
 
// rem toggles
txt.value=txt.value.replace(/(?:\|\s?publisher(\s*\=\s*)\'\'\[\[([^\]]{1,40})\]\]\'\')/gi, '|work$1[[$2]]');
txt.value=txt.value.replace(/(?:\|\s?publisher(?:agency|author|newspaper|work|journal|publisher)\s*\=\s*)\'\'([^\|\}]{1,40}+)\'\')(?=\s*[\}\|])/gi, '|work$1$2'); //without link
txt.value=txt.value.replace(/(?:\|\s?(?:agency|author|newspaper|work|journal|publisher)(\s*\=\s*)\'\'(\[\[(?:[^\|]]{1,40}+\||)[^\|\]]+\]\])\'\'(?=\s*[\}\|])/gi, '|publisher$1[[$2]]'); //with link
txt.value=txt.value.replace(/(?:\|\s?(?:newspaper|work)(\s*\=\s*)\'\'([^\|\}]{1,40})\'\')/gi, '|publisher$1$2');
 
// rem corporate designation
Line 70 ⟶ 71:
txt.value=txt.value.replace(/(\|\s?title\s*\=\s*[\w ]* )["“]((?:\w[\w]* )+(?:\w[\w]*))["”]([^\|]+|)(?=\s?[\|\}])/gi, '$1\'$2\'$3');
 
// rem misplaced punctuation
txt.value=txt.value.replace(/(<ref[^>]*>[^<]+?:[\|]\s?publisher(.\s*\=},;–]\s*)\'\'\[\[w-]*(?: [^\w-]]*){10,403})(\].com|)([;,\.])(\'\')([^<]*?<\/ref>)/gi, '|work$1[[$2]]$4$3$5');
// removing blank parameters
regex(/(?:\|[ ]*(?:first\d?accessdate|agency|archive(?:codate|url)authors?|arxiv|asin|at|author(-link|-mask|-name-separator|-separator|\d?|archive(\d-link|link\d?:url|date)|journalbibcode|publisherchapter|newspaperchapter-url|workcoauthors|contribution(?:access-url|)|date|deadurl|display-authors|doi|monthdoi-inactive|yeardoibroken|___locationedition|formateditor(?:-first|language-last|-link|\d|\d-first|\d-last|\d?-link|publisher)|authorlink(?:first|last)\d?|volumeformat|id|is[bs]n|issue|pagesjfm|journal|jstor|language|lay(?:date|firstnsource|lastnsummary)|authorn-linklccn|editor___location|editornmagazine|editorn-lastmonth|editorn-firstmr|editor-linknewspaper|editorn-linknopp|oclc|ol|origyear|osti|others|nopppages?|chapterperiodical|trans_chapterplace|chapterurlpm[cd]|pmid|postscript|publication(?:-date|-place)|publisher|quote|ref|laysummary|laydaterfc|separator|postscriptseries|lastauthorampssrn|issntrans_title|oclctype|pmidurl|pmdvolume|bibcodework|idyear|zbl)[ ]*=[\s]*)(?=[\}\|])/gi, '');
 
//rem underlining within certain fields
Line 83 ⟶ 86:
// eliminating time of day
ohc_regex(/(\|[ ]*author[ ]*=[ ]*)(?:posted|published)(?: by| on|)[\s:](?=\w)/gi, "$1");
regex(/(\|[ ]*(?:date|archivedate|accessdate|author)[ ]*=[ ]*)[0-2]?\d:[0-5]\d(?:[ ]|&nbsp;)(?:[ap]m ?|[ap]\.m\. |)([A-Z]{1,2}T|UTC)[\.,]?[ ]?/gi, "$1");
 
// eliminating days of the week
Line 90 ⟶ 93:
 
//'Accessed' -> 'Retrieved'
ohc_regex(/(?:[\.,;][ ]\*(?:url |link |last |)(?:Retrieved|Accessed) )(?: on(?:line|)|):? ((?:@month|@dd|@yyyy)[^)]{4,11}(?:@dd|@yyyy))=\D)/gi, '. Retrieved $1');
ohc_regex(/(?:[\.,;w|\])(?:[ ]*(?:url |link |last |)(?:Retrieved|Accessed))(?: on(?:line|)|):? (@month|@dd|@yyyy)(?=\D)/gi, '$1. Retrieved $12');
 
ohc_regex(/(?:\][ ]*(?:url |link |last |)(?:Retrieved|Accessed))(?: on(?:line|)|):? (@monthMonth\s@DD,?\s@YYYY|@ddDD\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');
// ohc_regex(/\((Retrieved (?:@Month\s@DD,\s@YYYY|@DD\s@Month\s@YYYY|@yyyy-@mm-@dd))\)/gi, '$1');
 
}
Line 109 ⟶ 115:
regex(/(\[\[)dailypioneer.com(\|)/gi, '$1The Pioneer \(Indian newspaper\)$2');
regex(/(=[ ]*\[\[)(?:[BE]SPN ?(?:USA|HD|Network|the ocho|\(United States\))|E.S.P.N.|(?:The |)Entertainment (?:and |)Sports Programming Network)(?:\|[\w, ]*)(\]\])/gi, '$1ESPN$2');
 
regex(/(?:agency|journal|newspaper|periodical|publisher|work)(\s?=\s?\[\[)(?:MTV (?:[A-Z]\w*|\([^\)\]]*\)))\|[^\)\]]*(\]\])/gi, 'publisher$1MTV$2');
 
//unwinding of unnecessary pipes
regex(/(\[\[)Public Broadcasting Service\|(PBS\]\])/gi, '$1$2');
 
//unlinking of piped sources to source and ___location
// regex(/(?:author|agency|publisher)(\s?=\s?\[\[(Evening Standard))\|[\w,]*(\]\])/gi, 'work$1$2$3|___location=London');
 
// regex(/((?:journal|newspaper|periodical|work)\s?=\s?\[\[(Daily News) \(New York\)\|)(?:[\w, ]*)(\]\])/gi, '$1$2$3 |___location=New York');
// regex(/(?:author|agency|publisher)(\s?=\s?\[\[(Daily News) \(New York\)\|)(?:[\w, ]*)(\]\])/gi, 'work$1$2$3 |___location=New York');
// regex(/((?:journal|newspaper|periodical|work)\s?=\s?\[\[(The Sun|Daily Star) \((United Kingdom)\)\|)(?:[\w, ]*)(\]\])/gi, '$1$2$4 |___location=$3');
// regex(/(?:author|agency|publisher)(\s?=\s?\[\[(The Sun|Daily Star) \((United Kingdom)\)\|)(?:[\w, ]*)(\]\])/gi, 'work$1$2$4 |___location=$3');
// regex(/((?:journal|newspaper|periodical|work)\s?=\s?\[\[(The Telegraph) \(Calcutta\)\|)(?:[\w, ]*)(\]\])/gi, '$1$2$4 |___location=$3');
// regex(/((?:author|agency|publisher)\s*\=\s*\[\[(The Telegraph) \(Calcutta\)\|)(?:[\w, ]*)(\]\])/gi, 'work$1$2$4 |___location=$3');
 
}
Line 116 ⟶ 137:
 
//linked publishing houses
// removing publishers less well-known than their titles
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s*\=\s*\[?\[?Hachette Filipacchi Médias\|(Hachette Filipacchi) \(UK\) Ltd\]?\]?)(?=[\s\.]*[\|\}])/gi, '');
txt.value=txt.value.replace regex(/(?:\|\s?(newspaper|work|publisher)\s*\=\s*\[?\[?(John Fairfax (and Sons Ltd\.?:Time|HoldingsPeople)|Fairfax\s*(?: Media( Limited)\| Digital[^}<>]*| newspapers))\]|\s?publisher\]s*\=\s*Time(?: Warner,?|,|) Inc.?(?=[\s\.]*[\|\}])/gig, '$1');
regex(/(\|\s?work\s*\=\s*(?:\[\[|)The New York Times(?:\]\]|)\s*)(\|[^}<>]*|)\|\s?publisher\s*\=\s*The New York Times Company(?=[\s\.]*[\|\}])/g, '$1');
txt.value=txt.value.replace(/(?:\|\s?publisher\s*\=\s*(\[\[|)(Associated Newspapers|Condé Nast Publications|Fairfax Media|Gannett Company|(Guardian|Telegraph) Media Group|(?:Guardian|Independent) News (?:and|&) Media|Imdb Inc\.?|IDG|IPC Media|MTV Networks|(The |)(?:Washington Post|(?:New York|Seattle) Times) Company|News (?:Corporation|International|Limited)|Prometheus Global Media|Tribune Company|Trinity Mirror|Times Newspapers (?:Limited|Ltd.?)|Nielsen (?: Media Research|Business Media(, Inc\.?|))|Rovi Corporation|Viacom|Time (?:Warner ?|)Inc\.?)(\]\]|))(?=[\s\.]*[\|\}])/gi, '');
regex(/(\|\s?work\s*\=\s*(?:\[\[|)The (?:Daily Telegraph|Guardian)(?:\]\]|)\s*(?:\|[^}<>]*|))\|\s?publisher\s*\=\s*(?:\[\[|)(?:Telegraph|Guardian) Media Group(?:\]\]|)(?=[\s\.]*[\|\}])/g, '$1');
regex(/(\|\s?publisher\s?\=MTV\|\s?)publisher\s*\=\s*(?:MTV Networks|Viacom)/gi, '$1=');
 
regex(/(?:\|publisher=Turner Sports Interactive, Inc)\.? ?\|publisher=(NBA)(?= ?\|)/gi, '$1');
regex(/(\|publisher=NBA) ?\|publisher=(?:Turner Sports Interactive, Inc)\.?(?= ?\|)/gi, '$1');
 
// removing publishers for periodicals
// txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s*\=\s*\[?\[?Hachette Filipacchi Médias\|(Hachette Filipacchi) \(UK\) Ltd\]?\]?)(?=[\s\.]*[\|\}])/gi, '');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s*\=\s*(John Fairfax (and Sons Ltd\.?|Holdings)|Fairfax(?: Media( Limited)| Digital| newspapers)))(?=[\s\.]*[\|\}])/gi, '');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s*\=\s*\[\[(John Fairfax (and Sons Ltd\.?|Holdings)|Fairfax(?: Media( Limited)| Digital| newspapers))\]\])(?=[\s\.]*[\|\}])/gi, '');
txt.value=txt.value.replace(/(?:\|\s?publisher\s*\=\s*(\[\[|)(Associated Newspapers|CondéCond[eé] Nast Publications|FairfaxDaily MediaMail and General Trust|Gannett Company|(Guardian|Telegraph) Media Group|(?:Guardian|Independent) News (?:and|&) Media|Hearst (?:Corporation|Magazines)|Imdb Inc\.?|IDG|IPC Media|MTV Networks|(The |)(?:Washington Post|(?:New York|Seattle) Times) Company|News (?:Corporation|International|Limited)|Prometheus Global Media|Rovi Corporation|Tribune Company|Trinity Mirror|Times Newspapers (?:Limited|Ltd.?)|Nielsen (?: Media Research|Business Media(, Inc\.?|))|Rovi Corporation|Viacom|Time (?:Warner ?|)))(,? Inc\.?)(\]\]|) Ltd.?|)(?=[\s\.]*[\|\}])/gi, '');
txt.value=txt.value.replace(/(?:\|\s?publisher\s*\=\s*\[\[(Associated Newspapers|Cond[eé] Nast Publications|Daily Mail and General Trust|Gannett Company|(Guardian|Telegraph) Media Group|(?:Guardian|Independent) News (?:and|&) Media|Hearst (?:Corporation|Magazines)|Imdb Inc\.?|IDG|IPC Media|MTV Networks|(The |)(?:Washington Post|(?:New York|Seattle) Times) Company|News (?:Corporation|International|Limited)|Prometheus Global Media|Rovi Corporation|Tribune Company|Trinity Mirror|Times Newspapers (?:Limited|Ltd.?)|Nielsen (?: Media Research|Business Media)|Viacom|Time (?:Warner ?|)))(,? Inc\.?| Ltd.?|)(?:\|[^\]\}]*|)\]\](?=[\s\.]*[\|\}])/gi, '');
 
}
Line 144 ⟶ 177:
regex(/(\[\[)(Daily News)( \(New York\))(\]\][\.,;]?)/g, '$1$2$3|$2$4');
regex(/(\|)(Daily News)(?: \(New York\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*Daily Record) \((Scotland)\)([ ]\s*[\|\}])/g, '$1|___location=$2$3');
regex(/(''Daily Record) \((Scotland)\)('')/g, '$1$3 \($2\)');
regex(/(\[\[)(Daily Record)( \(Scotland\))(\]\][\.,;]?)/g, '$1$2$3|$2$4');
regex(/(\|)(Daily Record)(?: \(Scotland\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*Dawn) \((newspaper)\)([ ]\s*[\|\}])/g, '$1|___location=Pakistan$3');
regex(/(''Dawn) \((newspaper)\)('')/g, '$1$3 \(Pakistan\)');
regex(/(\[\[)(Dawn)( \(newspaper\))(\]\])/g, '$1$2$3|$2$4');
regex(/(\|)(Dawn)(?: \(newspaper\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*(?:Daily Star)) \((United Kingdom)\)([ ]\s*[\|\}])/g, '$1|___location=$2$3');
regex(/(''(?:Daily Star)) \((United Kingdom)\)('')/g, '$1$3 \($2\)');
regex(/(\[\[)(Daily Star)( \(United Kingdom\))(\]\][\.,;]?)/g, '$1$2$3|$2$4');
regex(/(\|)(Daily Star)(?: \(United Kingdom\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*El Mundo) \((Columbia|Spain)\)([ ]\s*[\|\}])/g, '$1|___location=$2$3');
regex(/(''El Mundo) \((Columbia|Spain)\)('')/g, '$1$3 \($2\)');
regex(/(\[\[)(El Mundo)( \(Columbia|Spain\))(\]\])/g, '$1$2$3|$2$4');
regex(/(\|)(El Mundo)(?: \((?:Columbia|Spain)\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*The Daily Star) \((Lebanon)\)([ ]\s*[\|\}])/g, '$1|___location=$2$3');
regex(/(''The Daily Star) \((Lebanon)\)('')/g, '$1$3 \($2\)');
regex(/(\[\[)(The Daily Star)( \(Lebanon\))(\]\])/g, '$1$2$3|$2$4');
regex(/(\|)(The Daily Star)(?: \(Lebanon\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*The Gazette) \((Montreal)\)([ ]\s*[\|\}])/g, '$1|___location=$2$3');
regex(/(''The Gazette) \((Montreal)\)('')/g, '$1$3 \($2\)');
regex(/(\[\[)(The Gazette)( \(Montreal\))(\]\])/g, '$1$2$3|$2$4');
regex(/(\|)(The Gazette)(?: \(Montreal\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*The Herald) \((Glasgow)\)([ ]\s*[\|\}])/g, '$1|___location=$2$3');
regex(/(''The Herald) \((Glasgow)\)('')/g, '$1$3 \($2\)');
regex(/(\[\[)(The Herald)( \(Glasgow\))(\]\])/g, '$1$2$3|$2$4');
regex(/(\|)(The Herald)(?: \(Glasgow\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*The Nation) \((Malawi|Nigeria|Pakistan|Thailand)\)([ ]\s*[\|\}])/g, '$1|___location=$2$3');
regex(/(''The Nation) \((Malawi|Nigeria|Pakistan|Thailand)\)('')/g, '$1$3 \($2\)');
regex(/(\[\[)(The Nation)( \((?:Malawi|Nigeria|Pakistan|Thailand)\))(\]\])/g, '$1$2$3|$2$4');
regex(/(\|)(The Nation)(?: \((?:Malawi|Nigeria|Pakistan|Thailand)\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*La Presse) \((Canadian newspaper)\)([ ]\s*[\|\}])/g, '$1|___location=Canada$3');
regex(/(''La Presse) \((Canadian newspaper)\)('')/g, '$1$3 \(Canada\)');
regex(/(\[\[)(La Presse)( \(Canadian newspaper\))(\]\])/g, '$1$2$3|$2$4');
regex(/(\|)(La Presse)(?: \(Canadian newspaper\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*Les Échos) \((France)\)([ ]\s*[\|\}])/g, '$1|___location=$2$3');
regex(/(''Les Échos) \((France)\)('')/g, '$1$3 \($2\)');
regex(/(\[\[)(Les Échos)( \(France\))(\]\])/g, '$1$2$3|$2$4');
regex(/(\|)(Les Échos)(?: \(France\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*Panorama) \((Gibraltar)\)([ ]\s*[\|\}])/g, '$1|___location=$2$3');
regex(/(''Panorama) \((Gibraltar)\)('')/g, '$1$3 \($2\)');
regex(/(\[\[)(Panorama)( \(Gibraltar\))(\]\])/g, '$1$2$3|$2$4');
regex(/(\|)(Panorama)(?: \(Gibraltar\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*The Pioneer) \((Indian newspaper)\)([ ]\s*[\|\}])/g, '$1|___location=India$3');
regex(/(''The Pioneer) \((Indian newspaper)\)('')/g, '$1$3 \(India\)');
regex(/(\[\[)(The Pioneer)( \(Indian newspaper\))(\]\])/g, '$1$2$3|$2$4');
regex(/(\|)(The Pioneer)(?: \(Indian newspaper\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*TheSporting SunLife) \((HongBritish Kong|Malaysia|Nigeria|United Kingdomnewspaper)\)([ ]\s*[\|\}])/g, '$1|___location=$2UK$3');
regex(/(''\[\[Sporting Life) \(Salon)(British newspaper)\]\])('')/g, '$1$23 \(websiteUK\)|$2$3');
regex(/(''\[\[)(Nature|ScienceSporting Life)( \(British newspaper\))(\]\]'')/g, '$1$2 \(journal\)$3|$2$34');
regex(/(\|)(Sporting Life)(?: \(British newspaper\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*The Sun) \((Hong Kong|Malaysia|Nigeria|United Kingdom)\)(\s*[\|\}])/g, '$1|___location=$2$3');
regex(/(''The Sun) \((Hong Kong|Malaysia|Nigeria|United Kingdom)\)('')/g, '$1$3 \($2\)');
regex(/(\[\[)(The Sun)( \((?:Hong Kong|Malaysia|Nigeria|United Kingdom)\))(\]\])/g, '$1$2$3|$2$4');
regex(/(\|)(The Sun)(?: \((?:Hong Kong|Malaysia|Nigeria|United Kingdom)\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*The Telegraph) \((Calcutta)\)([ ]\s*[\|\}])/g, '$1|___location=Calcutta$3');
regex(/(''The Telegraph) \((Calcutta)\)('')/g, '$1$3 \(Calcutta\)');
regex(/(\[\[)(The Telegraph)( \(Calcutta\))(\]\])/g, '$1$2$3|$2$4');
regex(/(\|)(The Telegraph)(?: \(Calcutta\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*Vogue(?:The Times)) \((British magazineMalta)\)([ ]\s*[\|\}])/g, '$1|___location=UK$2$3');
regex(/(''(?:The Times)) \((Malta)\)('')/g, '$1$3 \($2\)');
regex(/(\[\[)(The Times)( \(Malta\))(\]\][\.,;]?)/g, '$1$2$3|$2$4');
regex(/(\|)(The Times)(?: \(Malta\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*Vogue) \((British magazine)\)(\s*[\|\}])/g, '$1|___location=UK$3');
regex(/(''Vogue) \((British magazine)\)('')/g, '$1$3 \(UK\)');
regex(/(\[\[)(Vogue)( \(British magazine\))(\]\])/g, '$1$2$3|$2$4');
regex(/(\|)(Vogue)(?: \(British magazine\))(\]\])/g, '$1$2$3');
 
regex(/(=(?:ABC|Marca|Sport)) \((newspaper)\)([ ]*[\|\}])/g, '$1|___location=Spain$3');
regex(/(''(?:ABC|Marca|Sport)) \((newspaper)\)('')/g, '$1$3 \(Spain\)');
regex(/(\[\[)(ABC|Marca|Sport)( \(newspaper\))(\]\])/g, '$1$2$3|$2$4');
regex(/(\|)(ABC|Marca|Sport)(?: \(newspaper\))(\]\])/g, '$1$2$3');
 
// regex(/(=(?:Business Day|City Press|Daily News|Daily Voice|Independent Online|New Age|Post|Table Talk|The Citizen|The Mercury|The New Age|The Star|The Sunday Independent|The Sunday Times|The Times|The Witness|The World)) \((South Africa)(?:n newspaper|)\)([ ]*[\|\}])/g, '$1|___location=$2$3');
Line 214 ⟶ 255:
// regex(/(\[\[)(Business Day|City Press|Daily News|Daily Voice|Independent Online|New Age|Post|Table Talk|The Citizen|The Mercury|The New Age|The Star|The Sunday Independent|The Sunday Times|The Times|The Witness|The World)( \(South Africa(?:n newspaper|)\))(\]\])/g, '$1$2$3|$2$4');
// regex(/(\|)(Business Day|City Press|Daily News|Daily Voice|Independent Online|New Age|Post|Table Talk|The Citizen|The Mercury|The New Age|The Star|The Sunday Independent|The Sunday Times|The Times|The Witness|The World)(?: \(South Africa(?:n newspaper|)\))(\]\])/g, '$1$2$3');
 
regex(/(''\[\[)(Nature|Science)(\]\]'')/g, '$1$2 \(journal\)|$2$3');
regex(/(''\[\[)(Salon)(\]\]'')/g, '$1$2 \(website\)|$2$3');
 
// removing redundancies
Line 228 ⟶ 266:
regex(/\|\s?(?:publisher|work)\s*\=\s*(?:BBC|BBC News(?: Online|))\s*(\|[^}<>]*|)\|\s?publisher\s*\=\s*(?:BBC|BBC News(?: Online|)|British Broadcasting Corporation)(?=[\s\.]*[\|\}])/g, '|publisher=BBC News $1');
regex(/\|\s?(?:publisher|work)\s*\=\s*(BBC Sports?)\s*(\|[^}<>]*|)\|\s?publisher\s*\=\s*(?:BBC|BBC News(?: Online|)|British Broadcasting Corporation)(?=[\s\.]*[\|\}])/g, '|publisher=$1$2');
 
// removing publishers less well-known than their titles
regex(/(\|\s?work\s*\=\s*(?:Time|People)\s*(?:\|[^}<>]*|))\|\s?publisher\s*\=\s*Time (?:Warner ?|)Inc.?(?=[\s\.]*[\|\}])/g, '$1');
regex(/(\|\s?work\s*\=\s*(?:\[\[|)The New York Times(?:\]\]|)\s*)(\|[^}<>]*|)\|\s?publisher\s*\=\s*The New York Times Company(?=[\s\.]*[\|\}])/g, '$1');
regex(/(\|\s?work\s*\=\s*(?:\[\[|)The (?:Daily Telegraph|Guardian)(?:\]\]|)\s*(?:\|[^}<>]*|))\|\s?publisher\s*\=\s*(?:\[\[|)(?:Telegraph|Guardian) Media Group(?:\]\]|)(?=[\s\.]*[\|\}])/g, '$1');
regex(/(\|\s?publisher\s?\=MTV\|\s?)publisher\s*\=\s*(?:MTV Networks|Viacom)/gi, '$1=');
 
regex(/(?:\|publisher=Turner Sports Interactive, Inc)\.? ?\|publisher=(NBA)(?= ?\|)/gi, '$1');
regex(/(\|publisher=NBA) ?\|publisher=(?:Turner Sports Interactive, Inc)\.?(?= ?\|)/gi, '$1');
 
//per [[Help:Citation Style 1#Elements not included]]
regex(/(?:-[ ]*Google Books[ ]*(\|[^}]*|)|)\|\s?publisher\s*\=\s*Google Books(?=[\s\.]*[\|\}])/g, '');
regex(/\|\s?publisher\s*\=\s*(?:Project Gutenberg|Scribd|web(?:\.archive\|citation).org)(?=[\s\.]*[\|\}])/g, '');
 
// removing identical/similar entries in 'work' and 'publisher'
regex(/\|\s?work\s*\=\s*([^\|\}<>]*)(\s?\|[^}<>]*|)\|\s?(?:publisher|work)\s*\=\s*\1(?:\.com1|\[\[\1\]\])(?=[\s\.]*[\|\}])/g, '|work=$1$2');
regex(/\|\s?work\s*\=\s*(\[\[(?:[^<\|\}<>]]*)(?:\.com]\]|[^<\|\]]*)(\s?\|[^}<>]*|)\|\s?(?:publisher|work)\s*\=\s*\1(?=[\s\.]*[\|\}])/g, '|work=$1$2');
regex(/\|\s?work\s*\=\s*\[\[([^\|\}<>]*)\]\](\s?\|[^}<>]*|)\|\s?(?:publisher|work)\s*\=\s*\1(?:\.com|)(?=[\s\.]*[\|\}])/g, '|work=[[$1]]$2');
regex(/\|\s?work\s*\=\s*([^\|\}<>]*)(?:\.com|)(\s?\|[^}<>]*|)\|\s?(?:publisher|work)\s*\=\s*\[\[\1\]\](?=[\s\.]*[\|\}])/g, '|work=$1$2');
 
regex(/\|\s?publisher\s*\=\s*([^\|\}<>]*)(\s?\|[^}<>]*|)\|\s?(?:publisher|work)\s*\=\s*\1(?:\.com1|\[\[\1\]\])(?=[\s\.]*[\|\}])/g, '|publisherwork=$1$2');
regex(/\|\s?publisher\s*\=\s*(\[\[(?:[^\|\}<>]]*)(?:\.com]\]|[^<\|\]]*)(\s?\|[^}<>]*|)\|\s?(?:publisher|work)\s*\=\s*\1(?=[\s\.]*[\|\}])/g, '|publisherwork=$1$2');
regex(/\|\s?publisher\s*\=\s*\[\[([^\|\}<>]*)\]\](\s?\|[^}<>]*|)\|\s?(?:publisher|work)\s*\=\s*\1(?:\.com|)(?=[\s\.]*[\|\}])/g, '|publisher=[[$1]]$2');
regex(/\|\s?publisher\s*\=\s*([^\|\}<>]*)(?:\.com|)(\s?\|[^}<>]*|)\|\s?(?:publisher|work)\s*\=\s*\[\[\1\]\](?=[\s\.]*[\|\}])/g, '|publisher=$1$2');
 
regex(/\|\s?___location\s*\=\s*New York(?: City|)\s*(\|[^}<>]*|)\|\s?___location\s*\=\s*(New York(?: City|)|USA)(?=[\s\.]*[\|\}])/g, '|___location=New York $1');
Line 259 ⟶ 284:
regex(/(\|[ ]*?work=[^\[\]\|]*)(?:\|[ ]*?work=[^\[\]\|\}]*)(?=[\|\}])+/gi, '$1');
 
//unwinding of unnecessary pipes
regex(/\[\[([^\]\|]*)\|\1(?=\]\])/gi, '[[$1');
 
// removing artefacts (within citation templates)
regex(/(\|[ ]*?author=)(?:(?:Mon|Tues|Wednes|Thurs|Fri|Satur|Sun)day,? ?)(?=[^\]\|\}]*\|)/gi, '$1');
regex(/(?:News &#124; )+/gi, '');
 
regex(/(?:(?: &#124; HighBeam Research – FREE trial |)\|publisher=Highbeam.com)/gi, '');
regex(/( &#124; [\w, ]*?)(?=[ ]&#124)/gi, '');
// regex(/( \| [^=\|\{\}\]]*?)(?=[ ]\|)/gi, ''); //disabled 3 October 2012 - false positive removal of elements in wikitable
Line 345 ⟶ 375:
};
 
regex(/((?:[\[=]\s*)(?:https?:|ftp:))([^\]\|\}]*)(\s*[\]\|\}])/gi, protect_function);
regex(/(\{\{cite ?book\s?\|)([^\}]+)(\})/gi, protect_function);
 
Line 376 ⟶ 406:
//Add a tag to the summary box
setoptions(minor='true');
setreason('per [[Help:Citation Style 1]] by [[User:Ohconfucius/script/Sources|script]]', 'append');
doaction('diff');
 
Line 402 ⟶ 432:
Ohc_sourceagency();
Ohc_redo_pipe();
Ohc_publishers();
Ohc_sources_cleanup();
ohc_unprotect_urls();