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

Content deleted Content added
No edit summary
Tag: Reverted
version of 15:57, 15 June 2025
Line 16:
importScript("User:Ohconfucius/test/Sources_subscript2.js"); //Correctly casing titles and apply or rem italicisation
importScript("User:Ohconfucius/test/Sources_subscript3.js"); //link-fixing, dabbing etc
//importScript("User:Ohconfucius/script/foreigndates.js"); //link-fixing, dabbing etc not needed: disabled 18/6/25
 
function Ohc_add_ref_tags() {
Line 55:
regex(/(\|\s*title\s*\=)\s*https?:\/{2}(?:w{3}\.|)\w+\.com(?=\s?(?:[=|{]|\}\}))/gi, '$1 ');
regex(/(\|\s*title\s*\=)\s*https?:\/{2}[^|\s]+(?=\s?(?:[=|{]|\}\}))/gi, '$1 ');
// regex(/(\|\s*title\s*\=)\s*Archived copy(?=\s?(?:[=|{]|\}\}))/gi, '$1 '); rem as creating CS1 errors
regex(/\s?<!--ACTUAL ARTICLE TITLE BELONGS HERE!(?: original text:|)[^>]*-->/gi, ' '); //rem error introduced by earlier version of this script; entirely strip title field
Line 223:
// (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');
 
// equivalence for French language cite web template
regex(/(\|)\s*auteur1\s*(?=\=)/gi, '$1author1');
regex(/(\|)\s*auteur2\s*(?=\=)/gi, '$1author2');
regex(/(\|)\s*citation\s*(?=\=)/gi, '$1quote');
regex(/(\|)\s*consulté le\s*(?=\=)/gi, '$1accessdate');
regex(/(\|)\s*éditeur\s*(?=\=)/gi, '$1publisher');
regex(/(\|)\s*langue\s*(?=\=)/gi, '$1language=fr');
regex(/(\|)\s*lienauteur1\s*(?=\=)/gi, '$1authorlink1');
regex(/(\|)\s*lieu\s*(?=\=)/gi, '$1place');
regex(/(\|)\s*lire en ligne\s*(?=\=)/gi, '$1place');
regex(/(\|)\s*nom1\s*(?=\=)/gi, '$1last1');
regex(/(\|)\s*nom2\s*(?=\=)/gi, '$1last2');
regex(/(\|)\s*périodique\s*(?=\=)/gi, '$1newspaper');
regex(/(\|)\s*prénom1\s*(?=\=)/gi, '$1first1');
regex(/(\|)\s*prénom2\s*(?=\=)/gi, '$1first2');
regex(/(\|)\s*site\s*(?=\=)/gi, '$1website');
regex(/(\|)\s*titre\s*(?=\=)/gi, '$1title');
 
regex(/(\{\{)\s*Lien web\s*(?=\|)/gi, '$1cite web');
regex(/(>)\{\{[,\.]\}\}(?=<)/gi, '$1');
regex(/\{\{date-\|([^\|]+)\|(\d{4})\-\}\}/gi, '$1 $2');
 
}
Line 309 ⟶ 331:
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 713 ⟶ 735:
// test buttons
 
// mw.util.addPortletLink('p-tb', 'javascript:Ohc_remove_urls()', 'Remove certain urls', 's-removeurl', '0.Improper urls', '', '');
// mw.util.addPortletLink('p-tb', 'javascript:Ohc_sources_prep()', 'Prepare sources', 's-prepsource', '1.Prepares sources', '', '');
// mw.util.addPortletLink('p-tb', 'javascript:Ohc_unpipe()', 'Unpipe sources', 's-unpipe', '2.Unpipe linked sources', '', '');
// mw.util.addPortletLink('p-tb', 'javascript:Ohc_dab_news_sources()', 'Applies DAB', 's-dab', '3.Applies disambiguation', '', '');
// mw.util.addPortletLink('p-tb', 'javascript:Ohc_sourcename()', 'Align source name', 's-align', '4.Corrects source name – subscript1', '', '');
// mw.util.addPortletLink('p-tb', 'javascript:Ohc_sourcework()', 'Cleanup WORK', 's-work', '5.Cleanup and reclassifies as WORK – subscript2', '', '');
// mw.util.addPortletLink('p-tb', 'javascript:Ohc_sourcepub()', 'Cleanup publisher', 's-publish', '6.Cleanup and reclassifies as PUBLISHER – subscript2', '', '');
// mw.util.addPortletLink('p-tb', 'javascript:Ohc_sourceagency()', 'Cleanup agency', 's-agency', '7.Cleanup and reclassifies as AGENCY – subscript2', '', '');
// mw.util.addPortletLink('p-tb', 'javascript:Ohc_redo_pipe()', 'Repipe sources', 's-repipe', '8.Repipe ambiguous links', '', '');
// mw.util.addPortletLink('p-tb', 'javascript:Ohc_publishers()', 'Rem publishers', 's-rempublish', '9.Removing certain publishers fields', '', '');
// mw.util.addPortletLink('p-tb', 'javascript:Ohc_sources_cleanup()', 'Final cleanup', 's-cleanup', '10.Cleanup after script actions', '', '');
}
});