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

Content deleted Content added
protect listen template
tweaks
Line 84:
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
 
/// removing identical/similar entries in 'work' and 'publisher'
regex(/\|\s?work\s*\=\s*([^|}\[<>]*)(\s?\|[^}<>]*|)\|\s?(?:publisher|work)\s*\=\s*(?:\1|\[\[\1\]\])(?=[\s\.]*[|}])/g, '|work=$1$2');
regex(/\|\s?work\s*\=\s*(\[\[(?:[^<|\]]*)\]\]|[^<|\]]*)(\s?\|[^}<>]*|)\|\s?(?:publisher|work)\s*\=\s*\1(?=[\s\.]*[|}])/g, '|work=$1$2');
 
regex(/\|\s?publisher\s*\=\s*([^|}\[<>]*)(\s?\|[^}<>]*|)\|\s?(?:publisher|work)\s*\=\s*(?:\1|\[\[\1\]\])(?=[\s\.]*[|}])/g, '|publisher=$1$2');
regex(/\|\s?publisher\s*\=\s*(\[\[(?:[^<|\]]*)\]\]|[^<|\]]*)(\s?\|[^}<>]*|)\|\s?(?:publisher|work)\s*\=\s*\1(?=[\s\.]*[|}])/g, '|publisher=$1$2');
 
// reordering 'work' and 'publisher' (first run - see second run in cleanup function)
regex(/(\|\s?publisher\s*\=\s*(?:\[\[[^<{}\]]*\]\]|[^{}\|\}<>]*))(\s?\|[^}<>]*|)(\|\s?(?: journal|newspaper|magazine|periodical|website|work)\s*\=\s*(?:\[\[[^<{}\]]*\]\]|[^{}\|\}<>]*))(?=[\s\.]*[|}])/g, '$3$1$2');
 
// remove redundant parentheses and templates from dm and md dates (equivalents also exists in Mosnum script)
Line 331 ⟶ 338:
 
// removing identical/similar entries in 'work' and 'publisher'
regex(/\|\s?work\s*\=\s*([^\|\}\[<>]*)(\s?\|[^}<>]*|)\|\s?(?:publisher|work)\s*\=\s*(?:\1|\[\[\1\]\])(?=[\s\.]*[|}])/g, '|work=$1$2');
regex(/\|\s?work\s*\=\s*(\[\[(?:[^<\|\]]*)\]\]|[^<\|\]]*)(\s?\|[^}<>]*|)\|\s?(?:publisher|work)\s*\=\s*\1(?=[\s\.]*[|}])/g, '|work=$1$2');
 
// regex(/\|\s?publisher\s*\=\s*([^\[\]|\}\[<>]*)(\s?\|[^}<>]*|)\|\s?(?:publisher|work)\s*\=\s*(?:\1|\[\[\1\]\])(?=[\s\.]*[|}])/g, '|workpublisher=$1$2');
// regex(/\|\s?publisher\s*\=\s*(\[\[(?:[^<\|\]]*)\]\]|[^<\|\]\}]*)(\s?\|[^}<>]*|)\|\s?(?:publisher|work)\s*\=\s*\1(?=[\s\.]*[|}])/g, '|workpublisher=$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');