Content deleted Content added
Ohconfucius (talk | contribs) incorporating 'Accessed' -> 'Retrieved' ejected from MOSNUM script |
Ohconfucius (talk | contribs) align to test |
||
Line 52:
//citation template fixes
// rem copyright assertion
// 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(/(
txt.value=txt.value.replace(/(
// 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
▲
// removing blank parameters
regex(/(?:\|[ ]*(?:
//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(?:[ ]| )(?:[ap]m ?|[ap]\.m\. |
// eliminating days of the week
Line 90 ⟶ 93:
//'Accessed' -> 'Retrieved'
ohc_regex(/(?:[\.,;][ ]
ohc_regex(/(
ohc_regex(/
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, '');▼
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*(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*
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)\)(
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)\)(
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)\)(
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)\)(
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)\)(
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)\)(
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)\)(
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)\)(
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)\)(
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)\)(
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)\)(
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)\)(
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(/(=[ ]*
regex(/(
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)\)(
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(/(=[ ]*
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*(?:\[\[|)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*
regex(/\|\s?work\s*\=\s*(\[\[(?:[^<\|\
regex(/\|\s?publisher\s*\=\s*([^\|\}<>]*)(\s?\|[^}<>]*|)\|\s?(?:publisher|work)\s*\=\s*
regex(/\|\s?publisher\s*\=\s*(\[\[(?:[^\|\
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 | )+/gi, '');
regex(/(?:(?: | HighBeam Research – FREE trial |)\|publisher=Highbeam.com)/gi, '');
regex(/( | [\w, ]*?)(?=[ ]|)/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
doaction('diff');
Line 402 ⟶ 432:
Ohc_sourceagency();
Ohc_redo_pipe();
Ohc_publishers();
Ohc_sources_cleanup();
ohc_unprotect_urls();
|