Content deleted Content added
Ohconfucius (talk | contribs) "adding piping to parentheticals inside parameters" per test script |
Ohconfucius (talk | contribs) align to test script |
||
Line 68:
txt.value=txt.value.replace(/(\|\s?(?:agency|author|newspaper|work|journal|publisher)\s*\=\s*)\'\'(\[\[(?:[^\|]+\||)[^\|\]]+\]\])\'\'(?=\s*[\}\|])/gi, '$1$2'); //with link
txt.value=txt.value.replace(/(\|\s?title\s*\=\s*)\''([^\|\{\}]+)\''/gi, '$1$2'); //rem ' in titles
txt.value=txt.value.replace(/(\|\s?publisher\s*\=\s*)\(([^\|\{\}]+)\)/gi, '$1$2'); //rem parenthetical publishers
// rem corporate designation
Line 89 ⟶ 90:
txt.value=txt.value.replace(/(\|\s?(?:journal|newspaper|periodical|publisher|work)\s*\=\s*)<u>([^\|\}]*)<\/u>/gi, '$1');
//rem redundant top-level domains (.com, .net, .org), strip "www"
txt.value=txt.value.replace(/(\|\s?(?:journal|newspaper|periodical|publisher|work)\s*\=\s*)(\[\[[^\[\]\}]*\]\])\.(?:biz|com|net|org|co\.uk)(?=\s*[\|\}])/gi, '$1$2');
regex(/([ ])www\.(.)/gi, '$1$2'); //strip superfluous "www."
//rem duplicated publishers in separate fields (pre)
Line 132 ⟶ 134:
// regex(/(\[\[)(?:foo|bar)(\|)/gi, '$1foo bar \(dab\)$2');
regex(/(\[\[)(?:(?:British|English|London) Sun|Sun on Sunday|The Scottish Sun|(?:The |)Sun (?:\((?:British |)newspaper\)|\(tabloid\)|\(UK newspaper\)|\(UK\)|Newspaper|on Sunday|Online)|Thesun\.co\.uk)(\|)/gi, '$1The Sun
regex(/(\[\[)Daily Star \((?:British|UK)\)(\|)/gi, '$1Daily Star
regex(/(\[\[Metro)(?: \(Associated Metro Limited\)| \(Associated Newspapers\)| \(London newspaper\)| \(free London newspaper\)| UK| newspaper London| newspaper UK)(\|)/gi, '$1
regex(/(\[\[)(?:Calcutta Telegraph|The Telegraph \((?:kolkatt?a|India)\)|(?:The |)Telegraph India|Telegraphindia\.com)(\|)/gi, '$1The Telegraph
regex(/(\[\[)Dawn(?:, Karachi| newspaper|\.com| \((?:Newspaper|Pakistan)\))(\|)/gi, '$1Dawn
regex(/(\[\[The Pioneer)(?:, Karachi| newspaper| \((?:indian newspaper)\))(\|)/gi, '$1
regex(/(\[\[)dailypioneer.com(\|)/gi, '$1The Pioneer
regex(/(\|)(Sport \()(newspaper\))(\]\])/g, '$1$2Spanish $3'); //dab moved December 2012
regex(/(=[ ]*\[\[)(?:[BE]SPN ?(?:USA|HD|Network|the ocho|\(United States\))|E.S.P.N.|(?:The |)Entertainment (?:and |)Sports Programming Network)(?:\|[\w, ]*)(\]\])/gi, '$1ESPN$2');
Line 177 ⟶ 179:
// removing publishers for periodicals
regex(/\|\s?publisher\s*\=\s*(?:The |)(?:Deseret News Publishing|Dispatch Printing|E. W. Scripps|Evening Post Publishing|Forbes Publishing|Gannett?|Irish Times Trust|(?:Jann Wenner|Wenner Media)|Johnson Publishing|Journal Communications|McClatchy|New York Times|Seattle Times|Star Tribune|Thomp?son(?:[- ]?Reuters)?(?: Corporation| Plc.?|)|Torstar|Times (?:Group|Publishing)|Tribune|Washington Post|World Publishing)(?: Co(?:mpany|\.)?)?(?=[\s\.]*[\|\}])/g, '');
regex(/\|\s?publisher\s*\=\s*(?:Cox|Halifax|North Jersey|Sun-Times|Tampa|Herald|Stephens|WEHCO) Media( Group(?:, Inc.)?)?(?=[\s\.]*[\|\}])/g, '');
//duplicate above with links
regex(/\|\s?publisher\s*\=\s*\[\[(?:The |)(?:Deseret News Publishing|Dispatch Printing|E. W. Scripps|Evening Post Publishing|Forbes Publishing|Gannett?|Irish Times Trust|(?:Jann Wenner|Wenner Media)|Johnson Publishing|Journal Communications|McClatchy|New York Times|Seattle Times|Star Tribune|Thomp?son(?:[- ]?Reuters)?(?: Corporation| Plc.?|)|Torstar|Times
regex(/\|\s?publisher\s*\=\s*\[\[(?:Cox|Halifax|North Jersey|Sun-Times|Tampa|Herald|Stephens|WEHCO) Media( Group(?:, Inc.)?)?\]\](?=[\s\.]*[\|\}])/g, '');
Line 195 ⟶ 197:
// relocating '___location' parameter outside citation templates
//sources without dab but with inserted locator
// regex(/(''Evening Standard) \|___location=(London)('')/gi, '$1$3
// regex(/(''\[\[Evening Standard) \|___location=(London)(\]\]'')/gi, '$1$3
// regex(/(=\s*\[\[|\|)(Evening Standard)( \|___location=London)(\]\])/gi, '$1$2$4$3');
// regex(/(\[\[|\|)(Evening Standard)( \|___location=London)(\]\])/gi, '$1$2$4 $3');
Line 213 ⟶ 215:
regex(/(\|)(Billboard|Fast Company|Q|Time Out)(?: \(magazine\))(?=\]\])/g, '$1$2');
regex(/(=[ ]*Daily News) \((New York)\)([ ]*[\|\}])/g, '$1|___location=$2$3');
regex(/(''Daily News) \((New York)\)('')/g, '$1$3
regex(/(\|)(Daily News)(?: \(New York\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*Daily Record|=[ ]*Sunday Mail) \((Scotland)\)(\s*[\|\}])/g, '$1|___location=$2$3');
regex(/(''Daily Record|''Sunday Mail) \((Scotland)\)('')/g, '$1$3
regex(/(\|)(Daily Record|Sunday Mail)(?: \(Scotland\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*Dawn) \((newspaper)\)(\s*[\|\}])/g, '$1|___location=Pakistan$3');
regex(/(''Dawn) \((newspaper)\)('')/g, '$1$3
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
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
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
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
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
regex(/(\|)(The Herald)(?: \(Glasgow\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*Metro) \((British newspaper)\)(\s*[\|\}])/g, '$1|___location=UK$3');
regex(/(''Metro) \((British newspaper)\)('')/g, '$1$3
regex(/(\|)(Metro)(?: \(British newspaper\))(\]\])/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
regex(/(\|)(The Nation)(?: \((?:Malawi|Nigeria|Pakistan|Thailand)\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*The National) \((Abu Dhabi)\)(\s*[\|\}])/g, '$1|___location=$2$3');
regex(/(''The National) \((Abu Dhabi)\)('')/g, '$1$3
regex(/(\|)(The National)(?: \(Abu Dhabi\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*La Presse) \((Canadian newspaper)\)(\s*[\|\}])/g, '$1|___location=Canada$3');
regex(/(''La Presse) \((Canadian newspaper)\)('')/g, '$1$3
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
regex(/(\|)(Les Échos)(?: \(France\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*Panorama) \((Gibraltar)\)(\s*[\|\}])/g, '$1|___location=$2$3');
regex(/(''Panorama) \((Gibraltar)\)('')/g, '$1$3
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
regex(/(\|)(The Pioneer)(?: \(Indian newspaper\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*Sporting Life) \((British newspaper)\)(\s*[\|\}])/g, '$1|___location=UK$3');
regex(/(''Sporting Life) \((British newspaper)\)('')/g, '$1$3
regex(/(\|)(Sporting Life)(?: \(British newspaper\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*The Standard) \((Hong Kong|Kenya)\)(\s*[\|\}])/g, '$1|___location=$2$3');
regex(/(''The Standard) \((Hong Kong|Kenya)\)('')/g, '$1$3
regex(/(\|)(The Standard)(?: \((?:Hong Kong|Kenya)\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*The Star) \((Malaysia)\)(\s*[\|\}])/g, '$1|___location=$2$3');
regex(/(''The Star) \((Malaysia)\)('')/g, '$1$3
regex(/(\|)(The Star)(?: \(Malaysia\))(\]\])/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
regex(/(\|)(The Sun)(?: \((?:Hong Kong|Malaysia|Nigeria|United Kingdom)\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*The Telegraph) \(Calcutta\)(?=\s*[\|\}])/g, '$1|___location=Kolkota');
regex(/(''The Telegraph) \((Calcutta)\)('')/g, '$1$3
regex(/(\|)(The Telegraph)(?: \(Calcutta\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*(?:The Times)) \((Malta)\)(\s*[\|\}])/g, '$1|___location=$2$3');
regex(/(''(?:The Times)) \((Malta)\)('')/g, '$1$3
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
regex(/(\|)(Vogue)(?: \(British magazine\))(\]\])/g, '$1$2$3');
regex(/(= ?(?:ABC|Marca)) \((newspaper)\)([ ]*[\|\}])/g, '$1|___location=Spain$3');
regex(/(''(?:ABC|Marca)) \((newspaper)\)('')/g, '$1$3
regex(/(\|)(ABC|Marca)(?: \(newspaper\))(\]\])/g, '$1$2$3');
regex(/(= ?(?:Il Giorno)) \((newspaper)\)([ ]*[\|\}])/g, '$1|___location=Italy$3');
regex(/(''(?:Il Giorno)) \((newspaper)\)('')/g, '$1$3
regex(/(\|)(Il Giorno)(?: \(newspaper\))(\]\])/g, '$1$2$3');
Line 293 ⟶ 295:
// 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');
// 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$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$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(/(?:author|agency|publisher)(\s*\=\s*\[\[[^()|]+ \((?:newspaper|magazine)\)\|[^\[\]|]+\]\])/gi, 'work$1');
// removing redundancies
Line 301 ⟶ 306:
regex(/(?: +[‒–—―] *Times Of India|)(\]. +''The Times of India''\.)indiatimes\.com/gi, '$1');
regex(/(\w''\.)indiatimes\.com/gi, '$1');
regex(/\|[ ]?language[ ]?\=[ ]?English[ ]*?(?=[\|\}])/gi, ''); //note: adjusted for false positive in infoboxes books
regex(/- [\w]*\.com[ ]*\|/gi, '|');
Line 313 ⟶ 318:
//rem duplicated publishers in separate fields (post); rem preceding nbsp
txt.value=txt.value.replace(/(?:[‒–—―]+||)\s*(?:The |)([^\|\}&]{3,})(?:\.com|)\s*(\|\s?(?:publisher|work)\s*\=\s*)\1(?=\s*[\|\}])/gi, '$2$1');
txt.value=txt.value.replace(/\s? \s?(\|\s?(?:publisher|work)\s*\=\s*)/gi, ' $1');
Line 332 ⟶ 337:
regex(/(\|[ ]*?publisher=[^=]*)(?:\|[ ]*?publisher=[^=\}]*)(?=[\|\}])+/gi, '$1');
regex(/(\|[ ]*?work=[^\|]*)(?:\|[ ]*?work=[^\|\}]*)(?=[\|\}])+/gi, '$1');
//'work' and its alias (pre)
regex(/(\|[ ]*?newspaper[ ]*=[^\|}]*(?:\|[^\{\}]*|))(?:\|[ ]*?work[ ]*=[^\|\}]*)(?=[\|\}])+/gi, '$1');
//unwinding of unnecessary pipes
Line 356 ⟶ 364:
//dynamic columns for reflists; remove scroll bar
}
function Ohc_sourceunlink() {
|