Content deleted Content added
Ohconfucius (talk | contribs) adjust so as not to touch magazine dates |
Ohconfucius (talk | contribs) protection for slash conversions |
||
Line 1,058:
}
/** ------------------------------------------------------------------------ **/
/// DATE PROTECTION FOR SLASH modules
var linkmap = [];
function ohc_protect_dates_slash()
{
// protects dates within links, quotes, etc
// the sensitive part is stored and replaced with a unique identifier,
// which is later replaced with the stored part.
var protect_function = function (s, begin, replace, end) {
linkmap.push(replace);
return begin + "⍌" + (linkmap.length - 1) + "⍍" + end;
};
regex(/(<ref\s?(?:>|name=[^>]+))([^<]+)(<\/ref>)/gi, protect_function);
regex(/(<timeline>)([\s\S]*?)(<\/timeline>)/gi, protect_function);
regex(/(<math>)([\s\S]*?)(<\/math>)/gi, protect_function);
regex(/((?:{(?:Wikimedia |)Commons ?|C ?))(Cat(?:egory|))\|[^{}*](})/gi, protect_function);
regex(/((?:Category|Image|File):)([^|\]]*)([|\]])/gi, protect_function);
regex(/(\{(?:See ?also|Main))(\|[^}]*)(\})/gi, protect_function);
regex(/(\{\{(?:double ?|external ?|wide ?)image\s?\|)([^}]+)(\})/gi, protect_function);
regex(/(\{\{(?:harvnb|wikisource)\|)([^}]+)(\})/gi, protect_function);
regex(/(\[(?:https?:|ftp:))([^\]]*)(\])/gi, protect_function);
regex(/(>[ ]*(?:https?:|ftp:))([^< >\]]*)([ ]*<)/gi, protect_function);
//regex(/(https?:|ftp:)([^\s\]]*)([\s\]])/gi, protect_function);
regex(/(<blockquote>)([\s\S]*?)(<\/blockquote>)/gi, protect_function);
regex(/(\{[^\{]{0,6}(?:quot[^|]{1,7}\s?|sic)\|)([^}]+)(\})/gi, protect_function);
regex(/((?:image\d?|image_skyline|image[ _]___location\d?|image[ _]name|image[ _]file|img|pic)\s*=)([^|}]*)([|}])/gi, protect_function);
regex(/([\|\{]\s*(?:file(?:name\d?|)|image\d?|image ___location\d?|img|pic|Cover|title|quote|chapter|journal|url|archiveurl|work|doi|club|at|volume|reporter)\s*=)([^|\}⍍]*)([|}])/gi, protect_function);
regex(/([\|\{]\s*(?:file(?:name\d?|)|image\d?|image ___location\d?|img|pic|Cover|title|quote|chapter|journal|url|archiveurl|work|doi|club|at|volume|reporter)\s*=)([^|\}⍍]*)([|}])/gi, protect_function);
regex(/([\|\{]\s*(?:season)\s*=)(\s*\[\[[^\]]*\]\]\s*)([|}])/gi, protect_function);
regex(/(\{\{navsource\|)([^}]+)(\})/gi, protect_function);
regex(/(\{\{singlechart\|)([^}]+)(\})/gi, protect_function);
regex(/(\{\{defaultsort:)([^}]+)(\})/gi, protect_function);
regex(/([\s\(>]")([^"\n]*)(")/gi, protect_function);
regex(/([\s\(>]“)([^”\n]*)(”)/gi, protect_function);
regex(/(.)(\(\{\{by\|[12]\d{3}\}\}[-–]\{\{by\|)([12]\d{3}[ ]*\}\}\))/gi, protect_function);
regex(/(.)(\(\{\{by\|[12]\d{3}\}\}(?:[-–]present|))(\))/gi, protect_function);
}
function ohc_unprotect_dates()
Line 1,279 ⟶ 1,322:
}
//function ohc_Bigendian_ref_dates_driver(e)
//{
// Add a tag to the summary box
//}
function ohc_expand_ref_dates_driver(e) {
Line 1,318 ⟶ 1,361:
e.preventDefault();
ohc_expand_ref_dates();
ohc_protect_dates_slash();
ohc_unprotect_dates();
ohc_slash_edit_summary();
}
Line 1,326 ⟶ 1,371:
e.preventDefault();
ohc_expand_ref_dates();
ohc_protect_dates_slash();
ohc_unprotect_dates();
ohc_expand_edit_summary();
}
|