பயனர்:Trengarasu.edit.autoReplace.default
new function() {
wloRE = "\\[\\["; wlcRE = "\\]\\]"; monthRE = "([J|j]anuary|[|F|f]ebruary|[|M|m]arch|[|A|a]pril|[|M|m]ay|[|J|j]une|[|J|j]uly|[|A|a]ugust|[|S|s]eptember|[|O|o]ctober|[|N|n]ovember|[|D|d]ecember)"; dayRE = "(\\d{1,2})(?:th)?"; yearRE = "(\\d{4})";
monthDayRE = monthRE + "\\s*" + dayRE; dayMonthRE = dayRE + "\\s*" + monthRE; wlMonthDayRE = wloRE + monthDayRE + wlcRE; wlDayMonthRE = wloRE + dayMonthRE + wlcRE; wlYearRE = wloRE + yearRE + wlcRE;
csRE1 = "\\s*(?:,\\s*|\\s+)"; csRE2 = "\\s*,?\\s*";
unitPRE = "([YZEPTGMkKhdcmµnpfazy]|da|)"; unitRE = "([gsmAKNJWCVΩFTHSM]|mol|cd|rad|sr|Hz|Pa|lm|lx|Wb|Bq|Gy|Sv|kat|°C)";
function fixCaps(a){ return a.slice(0,1) + a.slice(1).toLowerCase(); }
function monthDayYear(a, m, d, y){return "" + fixCaps(m) + " " + d + ", " + y + "";} function dayMonthYear(a, d, m, y){return "" + d + " " + fixCaps(m) + " " + y + "";}
function binPrefCap(p){ return p == "k" || p == "K" ? "k" : p.toUpperCase(); }
module("Gerbrant.edit.autoReplace.default", [
{re: " --(?!>) ?| —(?! )", hf: function(){return " — ";}}, {re: "(?!<!)([^ ]{2})--(?!>) ?", hf: function(a,s){return s + " — ";}}, {re: "([^ ])— ?", hf: function(a,l){return l + " — ";}}, {re: " -(?!->) ?| –(?! )", hf: function(){return " – ";}}, {re: "(?!<!-)([^ ]{3})- ", hf: function(a,s){return s + " – ";}}, {re: "([^ ])– ", hf: function(a,l){return l + " – ";}}, {re: "(€[0-9,]+\\.)--?", hf: function(a,v){return v + "—";}}, {re: "(\\d)-(?=\\d)", hf: function(a,l){return l + "–";}}, {re: "\\.\\.\\.", hf: function(){return "…";}}, // Convert the word ohm(s) or the html entity into the actual Ω symbol (Omega, not the actual ohm symbol Ω) and make sure it's spaced {re: "(\\d)\\s?" + unitPRE + "(?:\\s|-|)(?:Ω|ohm|Ohm)s?([\\s,.])", hf: function(a,d,p,t){return d + " " + p + "Ω" + t;}}, // Convert various micro symbols into the actual micro symbol, make sure it's spaced {re: "(\\d)\\s?(?:μ|μ|µ)" + unitRE + "([\\s,.])", hf: function(a,d,u,t){return d + " µ" + u + t;}}, // Convert capital K to lowercase k in units {re: "(\\d)\\s?K" + unitRE + "([\\s,.])", hf: function(a,d,u,t){return d + " k" + u + t;}}, // Capitalize units correctly (kHz is already covered) {re: "(\\d)\\s?(?!MHz)(?:[Mm][Hh][Zz])([\\s,.])", hf: function(a,d,t){return d + " MHz" + t;}}, {re: "(\\d)\\s?(?!GHz)(?:[Gg][Hh][Zz])([\\s,.])", hf: function(a,d,t){return d + " GHz" + t;}}, {re: "(\\d)\\s?" + unitPRE + "(?:hz|HZ)([\\s,.])", hf: function(a,d,p,t){return d + " " + p + "Hz" + t;}}, {re: "(\\d)\\s?" + unitPRE + "(?:pa|PA)([\\s,.])", hf: function(a,d,p,t){return d + " " + p + "Pa" + t;}}, // Add a space before dB or B {re: "(\\d)dB\\b", hf: function(a,d){return d + " dB";}}, {re: "(\\d)B\\b", hf: function(a,d){return d + " B";}}, // Add a space before any units that were missed before // Separate one for seconds since they give a lot of false positives like "1970s ". Only difference is mandatory prefix. // (changed the way that works – now uses a negative lookahead) {re: "((?:\\D|^)(?!\\d\\d(?:\\d\\d)?s)[0-9,.]*\\d)" + unitPRE + unitRE + "([\\s,.])", hf: function(a,d,p,u,t){return d + " " + p + u + t;}}, // bps or b/s or bits/s --> bit/s {re: "([KkMmGgTtPpEeYyZz]|)(?:bps|bits\\/s|b\\/s)", hf: function(a,p){return p + "bit/s";}}, // Bps or byte/s or bytes/s --> B/s {re: "([KkMmGgTtPpEeYyZz]|)(?:Bps|bytes?\\/s)", hf: function(a,p){return binPrefCap(p) + "B/s";}}, // (After that, – would req. multiple runs, so I integrated this in the above) make capitalization correct {re: "([Kmgtpeyz])(bit|B)\\/s", hf: function(a,p,u){return binPrefCap(p) + u + "/s";}}, // Common error {re: "\\bmibi(bit|byte)\\b", hf: function(a,u){return "mebi" + u;}}, // Convert hyphen next to a number into a minus sign character {re: "([^a-zA-Z0-9\\,\\_\\{])-(\\d)", hf: function(a,l,r){return l + "−" + r;}}, // Changes 2x3 to 2×3 {re: "((?:\\D|^)(?!0x[0-9A-Fa-f])[0-9,.]*\\d\\s?)x(\\s?\\d)", hf: function(a,l,r){return l + "×" + r;}}, // Changes 10^3 to 103 // Changes x^3 to x3 {re: "([0-9a-zA-Z])\\^(\\d+)(?!(?:(?!)", hf: function(a,l,r){return l + "" + r + "";}},
]);
}