Content deleted Content added
Lightmouse (talk | contribs) No edit summary |
Lightmouse (talk | contribs) No edit summary |
||
Line 1:
// Script from [[User:MarkS/extraeditbuttons.js]]
importScript('User:MarkS/extraeditbuttons.js'); //[[User:MarkS/extraeditbuttons.js]]
importScript('Wikipedia:WikiProject_User_scripts/Scripts/Add_purge_to_tabs');
importScript('User:AzaToth/twinkle.js');
TwinkleConfig = {
revertMaxRevisions : 50,
userTalkPageMode : 'window',
showSharedIPNotice : true,
openTalkPage : [ 'agf', 'norm', 'vand' ],
openTalkPageOnAutoRevert : false,
openAOLAnonTalkPage : false,
summaryAd : " using [[WP:TWINKLE|TW]]",
deletionSummaryAd : " using [[WP:TWINKLE|TW]]",
protectionSummaryAd : " using [[WP:TWINKLE|TW]]",
watchSpeedyPages : [ 'g3', 'g5', 'g10', 'g11', 'g12' ],
watchProdPages : true,
openUserTalkPageOnSpeedyDelete : [ 'g1', 'g2', 'g10', 'g11', 'g12', 'a1', 'a7', 'i3', 'i4', 'i5', 'i6', 'i7', 'u3', 't1' ],
watchRevertedPages : [ 'agf', 'norm', 'vand', 'torev' ],
markRevertedPagesAsMinor : [ 'agf', 'norm', 'vand', 'torev' ],
deleteTalkPageOnDelete : false,
watchWarnings : true,
markAIVReportAsMinor : true,
markSpeedyPagesAsMinor : true,
offerReasonOnNormalRevert : true,
orphanBacklinksOnSpeedyDelete : {orphan:true, exclude:['g6']}
};
//Create 'winc' function:
Line 9 ⟶ 39:
winc('User:Omegatron/monobook.js/addlink.js');
function dates() {
var txt = document.editform.wpTextbox1;
//Identify surprise or 'Easter egg' diversions linking years to 'year in something' articles. Turn them into year links to be dealt with below
txt.value=txt.value.replace(/\[\[\d{1,4}s?\sin\s[^\|]{1,30}\|(\d{1,4}s?)\]\]/gi, '\[\[$1\]\]');
// century
txt.value=txt.value.replace(/\[\[((?:first|second|third|fourth|fifth|sixth|seventh|eighth|ninth|tenth|eleventh|twelfth|thirteenth|fourteenth|fifteenth|sixteenth|seventeenth|eighteenth|nineteenth|twentieth|twenty(?:\s|-)first)(?:\s|-))century\]\]/gi, '$1century');
txt.value=txt.value.replace(/\[\[((?:first|second|third|fourth|fifth|sixth|seventh|eighth|ninth|tenth|eleventh|twelfth|thirteenth|fourteenth|fifteenth|sixteenth|seventeenth|eighteenth|nineteenth|twentieth|twenty(?:\s|-)first)(?:\s|-))century\s(AD|BC|CE|BCE)\]\]/gi, '$1century');
txt.value=txt.value.replace(/\[\[(\d{1,2}(?:st|nd|rd|th)(?:\s|-))century\]\]/gi, '$1century');
txt.value=txt.value.replace(/\[\[(\d{1,2}(?:st|nd|rd|th)(?:\s|-))centuries\]\]/gi, '$1centuries');
txt.value=txt.value.replace(/\[\[\d{1,2}(?:st|nd|rd|th)(?:\s|-)century\|(\d{1,2}(?:st|nd|rd|th))\]\]/gi, '$1');
txt.value=txt.value.replace(/\[\[\d{1,2}(?:st|nd|rd|th)(?:\s|-)century\|(\d{1,2}(?:st|nd|rd|th)(?:\s|-))century\]\]/gi, '$1century');
txt.value=txt.value.replace(/\[\[\d{1,2}(?:st|nd|rd|th)(?:\s|-)century\|(\d{1,2}(?:st|nd|rd|th)(?:\s|-))centuries\]\]/gi, '$1centuries');
txt.value=txt.value.replace(/\[\[(\d{1,2}(?:st|nd|rd|th)(?:\s|-))century\s(AD|BC|CE|BCE)\]\]/gi, '$1century $2');
txt.value=txt.value.replace(/\[\[\d{1,2}(?:st|nd|rd|th)(?:\s|-)century\|(\d{1,2}(?:st|nd|rd|th)(?:\s|-))century\s(AD|BC|CE|BCE)\]\]/gi, '$1century $2');
txt.value=txt.value.replace(/\[\[\d{1,2}(?:st|nd|rd|th)(?:\s|-)century\|(\d{1,2}(?:st|nd|rd|th)(?:\s|-))centuries\s(AD|BC|CE|BCE)\]\]/gi, '$1centuries $2');
//century - protect '20th Century Fox' and '20th Century Picture' - undone below
txt.value=txt.value.replace(/(20th)\s(Century)\s(Fox|Picture)/gi, '$1xx$2 $3');
//century - upper case 'C' to lower case
txt.value=txt.value.replace(/(\d(?:st|nd|rd|th)(?:\s|-))Century/gi, '$1century');
//century- unprotect '20th Century Fox' and '20th Century Picture'
txt.value=txt.value.replace(/(20th)xx(Century)/gi, '$1 $2');
// decades and years
txt.value=txt.value.replace(/\[\[(\d{1,4})\'?s\]\]/gi, '$1s');
txt.value=txt.value.replace(/\[\[(\d{1,4})\'?(s)?\s?(AD|BC|CE|BCE)\]\]/gi, '$1$2 $3');
txt.value=txt.value.replace(/\[\[\d{1,4}\'?s?\s?(?:AD|BC|CE|BCE)\|(\d{1,4})\'?(s)?\]\]/gi, '$1$2');
txt.value=txt.value.replace(/\[\[\d{1,4}\'?s?\s?(?:AD|BC|CE|BCE)\|(\d{1,4})\'?(s)?\s?(AD|BC|CE|BCE)\]\]/gi, '$1$2 $3');
txt.value=txt.value.replace(/\[\[\d{1,4}\'?s?\|(\d{1,4})\'?(s)?\s?(AD|BC|CE|BCE)\]\]/gi, '$1$2 $3');
txt.value=txt.value.replace(/\[\[\d{1,4}\'?s?\|(\d{1,4})\'?(s)?\]\]/gi, '$1$2');
txt.value=txt.value.replace(/\[\[\d\d?(?:st|nd|rd|th)\scentur(?:y|ies)\|(\d{1,4})\'?(s)?\]\]/gi, '$1$2');
txt.value=txt.value.replace(/\[\[\w{5,12}\scentur(?:y|ies)\|(\d{1,4})\'?(s)?\]\]/gi, '$1$2');
// solitary day_numbers
txt.value=txt.value.replace(/\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}\|(\d{1,2}(?:th|st|nd|rd))\]\]/gi, '$1');
txt.value=txt.value.replace(/\[\[\d{1,2} (?:January|February|March|April|May|June|July|August|September|October|November|December)\|(\d{1,2}(?:th|st|nd|rd))\]\]/gi, '$1');
txt.value=txt.value.replace(/\[\[(\d{1,2}(?:st|nd|rd|th))\]\]/gi, '$1');
//month+day: remove incorrect trailing space
txt.value=txt.value.replace(/(\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d\d?)\s(\]\])/gi,'$1$2');
//month+year
//Identify surprise or 'Easter egg' diversions linking month+years to year articles. Turn them into month+year links to be dealt with below
txt.value=txt.value.replace(/\[\[\d{1,4}#[^\|]{1,30}\|((?:January|February|March|April|May|June|July|August|September|October|November|December) \d{3,4})\]\]/gi, '\[\[$1\]\]');
txt.value=txt.value.replace(/\[\[((?:January|February|March|April|May|June|July|August|September|October|November|December) \d{3,4})\]\]/gi, '$1');
//year: temporary change to protect accessyear. Undone below at #1
txt.value=txt.value.replace(/(accessyear\s?=\s?)\[\[(\d{1,4})\]\]/gi, '$1xx$2xx');
//Year: temporary change to protext preference dates - y?y?y?. Needed to handle 'year in' piped links
txt.value=txt.value.replace(/(\[\[\d\d?\s(?:January|February|March|April|May|June|July|August|September|October|November|December)\]\],?\s?\s?)\[\[(\d{1,4})\]\]y?y?y?/gi,'$1xx$2xx');
txt.value=txt.value.replace(/(\[\[\d\d?\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\]\],?\s?\s?)\[\[(\d{1,4})\]\]y?y?y?/gi,'$1xx$2xx');
txt.value=txt.value.replace(/(\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d\d?\]\],?\s?\s?)\[\[(\d{1,4})\]\]y?y?y?/gi,'$1xx$2xx');
txt.value=txt.value.replace(/(\[\[(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d\d?\]\],?\s?\s?)\[\[(\d{1,4})\]\]y?y?y?/gi,'$1xx$2xx');
txt.value=txt.value.replace(/\[\[(\d{1,4})\]\]y?y?y?(,?\s?\-?\s?\[\[(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d\d?\]\])/gi,'xx$1xx$2');
txt.value=txt.value.replace(/\[\[(\d{1,4})\]\]y?y?y?(,?\s?\-?\s?\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d\d?\]\])/gi,'xx$1xx$2');
txt.value=txt.value.replace(/\[\[(\d{1,4})\]\]y?y?y?(,?\s?\-?\s?\[\[\d\d?\s(?:January|February|March|April|May|June|July|August|September|October|November|December)\]\])/gi,'xx$1xx$2');
txt.value=txt.value.replace(/\[\[(\d{1,4})\]\]y?y?y?(,?\s?\-?\s?\[\[\d\d\-\d\d\]\]y?y?y?)/gi,'xx$1xx$2');
//year: now remove unprotected linked years
txt.value=txt.value.replace(/\[\[(\d{1,4})\]\]/gi, '$1');
//year: #1. Undo temporary change to protect accessyear and date preference dates
txt.value=txt.value.replace(/xx(\d{1,4})xx/gi, '\[\[$1\]\]');
}
function formatgeneral() {
Line 38 ⟶ 127:
txt.value=txt.value.replace(/°/g, '°');
txt.value=txt.value.replace(/º/g, '°');
// Celsius spelling errors
Line 65 ⟶ 151:
txt.value=txt.value.replace(/(\d)(\[\[Celsius|°C\]\])/gi, '$1 $2');
txt.value=txt.value.replace(/(\d)(\[\[Fahrenheit|°F\]\])/gi, '$1 $2');
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(-?\d[\d,\.]{0,16})(?:\s|-|
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(-?\d[\d,\.]{0,16})(?:\s|-|
// Convert &sup to superscript
Line 74 ⟶ 160:
//metre
//delink this common unit
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-
//space before 'm' only when lower case. Check for dollars and pounds to avoid 'm' used for millions in money.
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|)m([:;,\.?!]?\s[^\d\(\)\/\\])/g, '$1$2 m$3');
//convert 'metres' to 'm' when in parentheses
txt.value=txt.value.replace(/(\(\d[\d,\.]{0,16})(?:\s|-
txt.value=txt.value.replace(/(\(\d[\d,\.]{0,16}) (?:metres|meters|metre|meter)(\))/g, '$1 m$2');
txt.value=txt.value.replace(/({convert\|\d{1,16}\|(?:m|ft)[^\}]{0,16})\|lk=(?:on|in|out)/g, '$1');
//metre per second
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|)(?:m\/second|m\/sec)([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1$2 m/s$3');
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16}) (?:m\/second|m\/sec)([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1$2 m/s$3');
txt.value=txt.value.replace(/({convert\|\d{1,16}\|(?:m\s|ft\s)[^\}]{0,16})\|lk=(?:on|in|out)/g, '$1');
//square metre
txt.value=txt.value.replace(/(\d)(?:\s|-|
//remove period when followed by close parenthesis character
txt.value=txt.value.replace(/m²\.\)/gi, 'm²)');
txt.value=txt.value.replace(/({convert\|\d{1,16}\|(?:sqm|sqft)[^\}]{0,16})\|lk=(?:on|in|out)/g, '$1');
// millimetre
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|)mm([:;,\.?!]?\s[^\d\(\)\/\\])/g, '$1$2 mm$3');
//Test
txt.value=txt.value.replace(/([^\d]\s)(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )mm([^\(\)]{3})/gi, '$1{{Auto mm|$2$3|1}}$4');
txt.value=txt.value.replace(/([^\d]\s)(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )mm([^\(\)]{3})/gi, '$1{{Auto mm|$2$3|1}}$4');
txt.value=txt.value.replace(/([^\d]\s)(\d{1,3})?,?(\d{1,3})(?:\s|-| )mm([^\(\)]{3})/gi, '$1{{Auto mm|$2$3|1}}$4');
txt.value=txt.value.replace(/([^\d]\s)(\d{1,3}\.\d\d)(?:\s|-| )mm([^\(\)]{3})/gi, '$1{{Auto mm|$2|1}}$3');
txt.value=txt.value.replace(/([^\d]\s)(\d{1,3}\.\d\d\d)(?:\s|-| )mm([^\(\)]{3})/gi, '$1{{Auto mm|$2|1}}$3');
// centimetre, cubic centimetre
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|)(cm|cc)([:;,\.?!]?\s[^\d\(\)\/\\])/g, '$1$2 $3$4');
// kilometre
//delink this common unit
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16}) \[\[(kilometres|kilometers|kilometre|kilometer)\]\]([:;,\.?!]?\s[^\d\(\)\/\\])/g, '$1$2 $3$4');
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16}) \[\[(kilometre|kilometer)\]\]s([:;,\.?!]?\s[^\d\(\)\/\\])/g, '$1$2 $3s$4');
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|)kms?([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1$2 km$3');
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16}) kms?([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1$2 km$3');
txt.value=txt.value.replace(/({convert\|\d{1,16}\|(?:mi|km)[^\}]{0,16})\|lk=(?:on|in|out)/g, '$1');
//square kilometre
txt.value=txt.value.replace(/(\d)(\s|-| )\[\[km²\]\]/gi, '$1$2km²');
txt.value=txt.value.replace(/(\d)\s?sq\.?(?:\s|-|
txt.value=txt.value.replace(/({convert\|\d{1,16})00\|ha/g, '$1|sqkm');
txt.value=txt.value.replace(/({convert\|\d{1,16})(\d)0\|ha/g, '$1.$2|sqkm');
Line 117 ⟶ 213:
txt.value=txt.value.replace(/({convert\|\d{1,16}\|(?:sqkm|sqmi)[^\}]{0,16})\|lk=(?:on|in|out)/g, '$1');
txt.value=txt.value.replace(/({convert\|\d{3,16}\|acre\|)ha/g, '$1sqkm');
// test
txt.value=txt.value.replace(/(\d)(?:\s|-|)kW(\W)/gi, '$1 kW$2');
txt.value=txt.value.replace(/(\d) kW(\W)/gi, '$1 kW$2');
txt.value=txt.value.replace(/(\d)(?:\s|-|)PS(\W)/gi, '$1 PS$2');
txt.value=txt.value.replace(/(\d) PS(\W)/gi, '$1 PS$2');
txt.value=txt.value.replace(/(\d)(?:\s|-|)kg(\W)/gi, '$1 kg$2');
txt.value=txt.value.replace(/(\d) kg(\W)/gi, '$1 kg$2');
txt.value=txt.value.replace(/(\d)(?:\s|-|)lb(\W)/gi, '$1 lb$2');
txt.value=txt.value.replace(/(\d) lb(\W)/gi, '$1 lb$2');
txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(000)(?:\s|-| )(lb|kW|PS|kg)([^\(\)]{2})/gi, '$1{{Auto $5|$2$3$4|0}}$6');
txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )(lb|kW|PS|kg)([^\(\)]{2})/gi, '$1{{Auto $5|$2$3$4|0}}$6');
txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )(lb|kW|PS|kg)([^\(\)]{2})/gi, '$1{{Auto $5|$2$3$4|0}}$6');
txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )(lb|kW|PS|kg)([^\(\)]{2})/gi, '$1{{Auto $5|$2$3$4|0}}$6');
//kilometre per second
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|)(?:km\/second|km\/sec)([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1$2 km/s$3');
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16}) (?:km\/second|km\/sec)([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1$2 km/s$3');
// kilometre per hour
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|)(?:km\/hr|km\/ph|kph|kmph|kmh)([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1$2 km/h$3');
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16}) (?:km\/hr|km\/ph|kph|kmph|kmh)([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1$2 km/h$3');
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|)\[\[(?:km\/hr|km\/ph|kph|kmph|kmh)\]\]([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1$2 km/h$3');
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16}) \[\[(?:km\/hr|km\/ph|kph|kmph|kmh)\]\]([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1$2 km/h$3');
//millilitre
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|)(ml)([:;,\.?!]?\s[^\d\(\)\/\\])/g, '$1$2 $3$4');
// ensure spaces and correct case in kilowatt
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|)kW([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1$2 kW$3');
// ensure spaces and correct case in hertz
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|)Hz([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1$2 Hz$3');
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|)kHz([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1$2 kHz$3');
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|)GHz([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1$2 GHz$3');
// ensure spaces in megahertz. Must be upper case to avoid clashing with millihertz
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|)MHz([:;,\.?!]?\s[^\d\(\)\/\\])/g, '$1$2 MHz$3');
// frames per second
Line 147 ⟶ 261:
txt.value=txt.value.replace(/kilogrammes/gi, 'kilograms');
txt.value=txt.value.replace(/kilogramme/gi, 'kilogram');
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16}) \[\[(kilograms?)\]\]([:;,\.?!]?\s[^\d\(\)\/\\])/g, '$1$2 $3$4');
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|)grammes([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1$2 grams$3');
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|)gramme([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1$2 gram$3');
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|)(?:kgs?|\[\[kg\]\])([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1$2 kg$3');
txt.value=txt.value.replace(/({convert\|\d{1,16}\|(?:kg|lb)[^\}]{0,16})\|lk=(?:on|in|out)/g, '$1');
//foot
//convert 'foot' to 'ft' when in parentheses
txt.value=txt.value.replace(/(\(\d[\d,\.]{0,16})(?:\s|-
txt.value=txt.value.replace(/(\(\d[\d,\.]{0,16}) (?:feet|foot)(\))/g, '$1 ft$2');
//remove trailing period when in parentheses
txt.value=txt.value.replace(/(\(\d[\d,\.]{0,16})(?:\s|-
txt.value=txt.value.replace(/(\(\d[\d,\.]{0,16}) ft\.(\))/g, '$1 ft$2');
Line 170 ⟶ 284:
txt.value=txt.value.replace(/(\d)(\s|-)square(\s|-)ft/gi, '$1 sq ft');
txt.value=txt.value.replace(/(\d) square ft/gi, '$1 sq ft');
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)([\d,]{1,16})(?:\s|-|
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)([\d,]{1,16})(?:\s|-|
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)([\d,]{1,16})(?:\s|-|
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)([\d,]{1,16})(?:\s|-|
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)([\d,]{1,16})(?:\s|-|
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)([\d,]{1,16})(?:\s|-|
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)([\d,]{1,16})\.(\d)(?:\s|-|
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)([\d,]{1,16})\.(\d)(?:\s|-|
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)([\d,]{1,16})\.(\d)(?:\s|-|
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)([\d,]{1,16})\.(\d\d)(?:\s|-|
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)([\d,]{1,16})\.(\d\d)(?:\s|-|
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)([\d,]{1,16})\.(\d\d)(?:\s|-|
//feet per second
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|)(?:ft\/second|ft\/sec)([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1$2 ft/s$3');
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16}) (?:ft\/second|ft\/sec)([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1$2 ft/s$3');
//feet per second:plural
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
//feet per second:singular
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
//feet per second:abbreviated
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
// foot and inch
Line 208 ⟶ 322:
txt.value=txt.value.replace(/yd\.\)/gi, 'yd)');
//yards: plural
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
//yards: singular
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
//yards: abbreviated
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
//yards: in full
txt.value=txt.value.replace(/([^y]\sone(?:\s|-|
txt.value=txt.value.replace(/([^y]\stwo(?:\s|-|
txt.value=txt.value.replace(/([^y]\sthree(?:\s|-|
txt.value=txt.value.replace(/([^y]\sfour(?:\s|-|
txt.value=txt.value.replace(/([^y]\sfive(?:\s|-|
txt.value=txt.value.replace(/([^y]\ssix(?:\s|-|
txt.value=txt.value.replace(/([^y]\sseven(?:\s|-|
txt.value=txt.value.replace(/([^y]\seight(?:\s|-|
txt.value=txt.value.replace(/([^y]\snine(?:\s|-|
txt.value=txt.value.replace(/([^y]\sten(?:\s|-|
txt.value=txt.value.replace(/([^y]\seleven(?:\s|-|
txt.value=txt.value.replace(/([^y]\stwelve(?:\s|-|
txt.value=txt.value.replace(/([^y]\sthirteen(?:\s|-|
txt.value=txt.value.replace(/([^y]\sfourteen(?:\s|-|
txt.value=txt.value.replace(/([^y]\sfifteen(?:\s|-|
txt.value=txt.value.replace(/([^y]\ssixteen(?:\s|-|
txt.value=txt.value.replace(/([^y]\sseventeen(?:\s|-|
txt.value=txt.value.replace(/([^y]\seighteen(?:\s|-|
txt.value=txt.value.replace(/([^y]\snineteen(?:\s|-|
txt.value=txt.value.replace(/([^y]\stwenty(?:\s|-|
// knot
Line 242 ⟶ 356:
//nautical mile - rename 'miles' as 'nautical miles' when followed by knots or conversion code
txt.value=txt.value.replace(/(\d)(?:\s|-|
txt.value=txt.value.replace(/(\d)(\s|-| )(?:mi|nm|nmi)\s(?:at|@)\s([\d\.]{1,9}(?:\s|-|
//nautical mile: plural unlinked
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
//nautical mile: plural linked with 's' inside link
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
//nautical mile: plural linked with 's' outside link
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
//nautical mile: singular unlinked
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
//nautical mile: singular linked
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
//nautical mile: abbreviated
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
//nautical mile: in full
txt.value=txt.value.replace(/([^y]\sone(?:\s|-|
txt.value=txt.value.replace(/([^y]\stwo(?:\s|-|
txt.value=txt.value.replace(/([^y]\sthree(?:\s|-|
txt.value=txt.value.replace(/([^y]\sfour(?:\s|-|
txt.value=txt.value.replace(/([^y]\sfive(?:\s|-|
txt.value=txt.value.replace(/([^y]\ssix(?:\s|-|
txt.value=txt.value.replace(/([^y]\sseven(?:\s|-|
txt.value=txt.value.replace(/([^y]\seight(?:\s|-|
txt.value=txt.value.replace(/([^y]\snine(?:\s|-|
txt.value=txt.value.replace(/([^y]\sten(?:\s|-|
txt.value=txt.value.replace(/([^y]\seleven(?:\s|-|
txt.value=txt.value.replace(/([^y]\stwelve(?:\s|-|
txt.value=txt.value.replace(/([^y]\sthirteen(?:\s|-|
txt.value=txt.value.replace(/([^y]\sfourteen(?:\s|-|
txt.value=txt.value.replace(/([^y]\sfifteen(?:\s|-|
txt.value=txt.value.replace(/([^y]\ssixteen(?:\s|-|
txt.value=txt.value.replace(/([^y]\sseventeen(?:\s|-|
txt.value=txt.value.replace(/([^y]\seighteen(?:\s|-|
txt.value=txt.value.replace(/([^y]\snineteen(?:\s|-|
txt.value=txt.value.replace(/([^y]\stwenty(?:\s|-|
//knot - plural
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-| |)(?:knots|\[\[knot\s\(speed\)\|(?:knots\]\]|knot\]\]s))([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1{{convert|$2|knot|km/h}}$3');
//knot - singular
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
//knot - abbreviation
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
//mile - lower case to avoid proper names like 'Five Mile Road'
Line 289 ⟶ 403:
txt.value=txt.value.replace(/(miles?)\s(per)/gi, '$1xx$2');
//miles: plural
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
//miles: singular
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
//miles: abbreviated
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
//miles: in full
txt.value=txt.value.replace(/([^y]\sone(?:\s|-|
txt.value=txt.value.replace(/([^y]\stwo(?:\s|-|
txt.value=txt.value.replace(/([^y]\sthree(?:\s|-|
txt.value=txt.value.replace(/([^y]\sfour(?:\s|-|
txt.value=txt.value.replace(/([^y]\sfive(?:\s|-|
txt.value=txt.value.replace(/([^y]\ssix(?:\s|-|
txt.value=txt.value.replace(/([^y]\sseven(?:\s|-|
txt.value=txt.value.replace(/([^y]\seight(?:\s|-|
txt.value=txt.value.replace(/([^y]\snine(?:\s|-|
txt.value=txt.value.replace(/([^y]\sten(?:\s|-|
txt.value=txt.value.replace(/([^y]\seleven(?:\s|-|
txt.value=txt.value.replace(/([^y]\stwelve(?:\s|-|
txt.value=txt.value.replace(/([^y]\sthirteen(?:\s|-|
txt.value=txt.value.replace(/([^y]\sfourteen(?:\s|-|
txt.value=txt.value.replace(/([^y]\sfifteen(?:\s|-|
txt.value=txt.value.replace(/([^y]\sixteen(?:\s|-|
txt.value=txt.value.replace(/([^y]\sseventeen(?:\s|-|
txt.value=txt.value.replace(/([^y]\seighteen(?:\s|-|
txt.value=txt.value.replace(/([^y]\snineteen(?:\s|-|
txt.value=txt.value.replace(/([^y]\stwenty(?:\s|-|
//mile - unprotect 'miles per hour'
Line 320 ⟶ 434:
//mile per hour
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
// square mile
Line 326 ⟶ 440:
txt.value=txt.value.replace(/\[\[(square\smile)\]\]/gi, '$1');
txt.value=txt.value.replace(/\[\[square\smile\|(sq\smi)\]\]/gi, '$1');
txt.value=txt.value.replace(/(sq)(?:\s|-|
// square mile:plural
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
// square mile:singular
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
// square mile:abbreviated
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
//acre foot:plural
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)([\d,]{3,16}[\d,\.]{0,16})(?:\s|-|
//acre foot:singular
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)([\d,]{3,16}[\d,\.]{0,16})(?:\s|-|
//acre foot:abbreviation
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)([\d,]{3,16}[\d,\.]{0,16})(?:\s|-|
Line 346 ⟶ 460:
txt.value=txt.value.replace(/(acre.feet)/gi, 'xtempx$1ytempy');
txt.value=txt.value.replace(/(\d)-(acre)/gi, '$1 $2');
txt.value=txt.value.replace(/(\d)(?:\s|-|
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)([\d,]{1,16})(?:\s|-|
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)([\d,]{1,16})(?:\s|-|
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)([\d,]{1,16})(?:\s|-|
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)([\d,]{1,16})(?:\s|-|
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)([\d,]{1,16})\.(\d)(?:\s|-|
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)([\d,]{1,16})\.(\d)(?:\s|-|
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)([\d,]{1,16})\.(\d\d)(?:\s|-|
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)([\d,]{1,16})\.(\d\d)(?:\s|-|
txt.value=txt.value.replace(/([^y]\sone(?:\s|-|
txt.value=txt.value.replace(/(\sa(?:\s|-|
txt.value=txt.value.replace(/([^y]\stwo(?:\s|-|
txt.value=txt.value.replace(/([^y]\sthree(?:\s|-|
txt.value=txt.value.replace(/([^y]\sfour(?:\s|-|
txt.value=txt.value.replace(/([^y]\sfive(?:\s|-|
txt.value=txt.value.replace(/([^y]\ssix(?:\s|-|
txt.value=txt.value.replace(/([^y]\sseven(?:\s|-|
txt.value=txt.value.replace(/([^y]\seight(?:\s|-|
txt.value=txt.value.replace(/([^y]\snine(?:\s|-|
txt.value=txt.value.replace(/([^y]\sten(?:\s|-|
//acre:plural
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)([\d,]{3,16}[\d,\.]{0,16})(?:\s|-|
//acre:singular
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)([\d,]{3,16}[\d,\.]{0,16})(?:\s|-|
//undo protection for acre feet
Line 383 ⟶ 497:
txt.value=txt.value.replace(/ft[\s-.·•\/]{1,2}lbf([^\|])/gi, 'ft·lbf$1');
txt.value=txt.value.replace(/ft[\s-.·•\/]{1,2}lbff/gi, 'ft·lbf');
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
// pound force
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(\s|-| |)lbs?.?\s(thrust|of\sthrust|force|of\sforce)([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1$2$3lbf $4$5');
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16}000)(?:\s|-| |)
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-| |)
// pound weight. Parsed after foot pound and pound force
Line 400 ⟶ 510:
txt.value=txt.value.replace(/(\d\+?)\s?lbs?([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1 lb$2');
txt.value=txt.value.replace(/(\d) lbs?([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1 lb$2');
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
//foot and inch: plural
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
//foot and inch: singular
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
//foot and inch: abbreviated
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
//foot (again). Parsed after 'foot per second' and 'foot pound'
//foot: plural
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
//foot: singular
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
//foot: abbreviated
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
//inch: plural
txt.value=txt.value.replace(/([^\Wt'’]\s)(\d[\d,\.]{0,16})(?:\s|-|
// inch: plural with number in words
txt.value=txt.value.replace(/([^ty]\sthree(?:\s|-|
txt.value=txt.value.replace(/([^ty]\sfour(?:\s|-|
txt.value=txt.value.replace(/([^ty]\sfive(?:\s|-|
txt.value=txt.value.replace(/([^ty]\ssix(?:\s|-|
txt.value=txt.value.replace(/([^ty]\sseven(?:\s|-|
txt.value=txt.value.replace(/([^ty]\seight(?:\s|-|
txt.value=txt.value.replace(/([^ty]\snine(?:\s|-|
txt.value=txt.value.replace(/([^ty]\sten(?:\s|-|
txt.value=txt.value.replace(/([^ty]\seleven(?:\s|-|
txt.value=txt.value.replace(/([^ty]\stwelve(?:\s|-|
txt.value=txt.value.replace(/([^ty]\sthirteen(?:\s|-|
txt.value=txt.value.replace(/([^ty]\sfourteen(?:\s|-|
txt.value=txt.value.replace(/([^ty]\sfifteen(?:\s|-|
txt.value=txt.value.replace(/([^ty]\ssixteen(?:\s|-|
//inch: singular
txt.value=txt.value.replace(/([^\Wt'’]\s)(\d[\d,\.]{0,16})(?:\s|-|
txt.value=txt.value.replace(/({convert\|\d{1,16}\|(?:in|mm|cm)[^\}]{0,16})\|lk=(?:on|in|out)/g, '$1');
txt.value=txt.value.replace(/([^\d]\s)(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )in([^²³ches\(\)]{3})/gi, '$1{{Auto in|$2$3|1}}$4');
txt.value=txt.value.replace(/([^\d]\s)(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )in([^²³ches\(\)]{3})/gi, '$1{{Auto in|$2$3|1}}$4');
txt.value=txt.value.replace(/([^\d]\s)(\d{1,3})?,?(\d{1,3})(?:\s|-| )in([^²³ches\(\)]{3})/gi, '$1{{Auto in|$2$3|1}}$4');
txt.value=txt.value.replace(/([^\d]\s)(\d{1,3}\.\d)(?:\s|-| )in([^²³ches\(\)]{3})/gi, '$1{{Auto in|$2|0}}$3');
txt.value=txt.value.replace(/([^\d]\s)(\d{1,3}\.\d\d)(?:\s|-| )in([^²³ches\(\)]{3})/gi, '$1{{Auto in|$2|0}}$3');
txt.value=txt.value.replace(/([^\d]\s)(\d{1,3}\.\d\d\d)(?:\s|-| )in([^²³ches\(\)]{3})/gi, '$1{{Auto in|$2|0}}$3');
// inch: singular with number in words
txt.value=txt.value.replace(/([^ty]\sthree(?:\s|-|
txt.value=txt.value.replace(/([^ty]\sfour(?:\s|-|
txt.value=txt.value.replace(/([^ty]\sfive(?:\s|-|
txt.value=txt.value.replace(/([^ty]\ssix(?:\s|-|
txt.value=txt.value.replace(/([^ty]\sseven(?:\s|-|
txt.value=txt.value.replace(/([^ty]\seight(?:\s|-|
txt.value=txt.value.replace(/([^ty]\snine(?:\s|-|
txt.value=txt.value.replace(/([^ty]\sten(?:\s|-|
txt.value=txt.value.replace(/([^ty]\seleven(?:\s|-|
txt.value=txt.value.replace(/([^ty]\stwelve(?:\s|-|
txt.value=txt.value.replace(/([^ty]\sthirteen(?:\s|-|
txt.value=txt.value.replace(/([^ty]\sfourteen(?:\s|-|
txt.value=txt.value.replace(/([^ty]\sfifteen(?:\s|-|
txt.value=txt.value.replace(/([^ty]\ssixteen(?:\s|-|
// horsepower
Line 464 ⟶ 579:
txt.value=txt.value.replace(/(\d) (horsepower|hp|bhp|ihp|shp)([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1 $2$3');
txt.value=txt.value.replace(/(\d)(?:\s|-|)horse(?:\s|-|)power([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1 horsepower$2');
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
txt.value=txt.value.replace(/([^\d\(\)\/\\=]\s)(\d[\d,\.]{0,16})(?:\s|-|
// Newton metre
txt.value=txt.value.replace(/(\d)\s?Nm/gi, '$1 Nm');
txt.value=txt.value.replace(/(\d) Nm/gi, '$1 Nm');
txt.value=txt.value.replace(/([^\d]\s)(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )Nm([^\(\)]{3})/gi, '$1{{Auto Nm|$2$3|0}}$4');
txt.value=txt.value.replace(/([^\d]\s)(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )Nm([^\(\)]{3})/gi, '$1{{Auto Nm|$2$3|0}}$4');
txt.value=txt.value.replace(/([^\d]\s)(\d{1,3})?,?(\d{1,3})(?:\s|-| )Nm([^\(\)]{3})/gi, '$1{{Auto Nm|$2$3|0}}$4');
txt.value=txt.value.replace(/([^\d]\s)(\d{1,3}\.\d\d)(?:\s|-| )Nm([^\(\)]{3})/gi, '$1{{Auto Nm|$2|0}}$3');
txt.value=txt.value.replace(/([^\d]\s)(\d{1,3}\.\d\d\d)(?:\s|-| )Nm([^\(\)]{3})/gi, '$1{{Auto Nm|$2|0}}$3');
txt.value=txt.value.replace(/([^\d]\s)(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )N·m([^\(\)]{3})/gi, '$1{{Auto Nm|$2$3|0}}$4');
txt.value=txt.value.replace(/([^\d]\s)(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )N·m([^\(\)]{3})/gi, '$1{{Auto Nm|$2$3|0}}$4');
txt.value=txt.value.replace(/([^\d]\s)(\d{1,3})?,?(\d{1,3})(?:\s|-| )N·m([^\(\)]{3})/gi, '$1{{Auto Nm|$2$3|0}}$4');
txt.value=txt.value.replace(/([^\d]\s)(\d{1,3}\.\d\d)(?:\s|-| )N·m([^\(\)]{3})/gi, '$1{{Auto Nm|$2|0}}$3');
txt.value=txt.value.replace(/([^\d]\s)(\d{1,3}\.\d\d\d)(?:\s|-| )N·m([^\(\)]{3})/gi, '$1{{Auto Nm|$2|0}}$3');
txt.value=txt.value.replace(/([^\d]\s)(\d{1,3})?,?(\d{1,3})(?:\s|-| )N·m([^\(\)]{3})/gi, '$1{{Auto Nm|$2$3|0}}$4');
// kilometre per hour
txt.value=txt.value.replace(/km\/hr(\W)/gi, 'km/h$1');
txt.value=txt.value.replace(/km\/ph(\W)/gi, 'km/h$1');
txt.value=txt.value.replace(/kph(\W)/gi, 'km/h$1');
txt.value=txt.value.replace(/kmph(\W)/gi, 'km/h$1');
txt.value=txt.value.replace(/(\d)\s?kmh/gi, '$1 km/h');
txt.value=txt.value.replace(/(\d) kmh/gi, '$1 km/h');
txt.value=txt.value.replace(/\[\[kmh\]\]/gi, '\[\[km/h\]\]');
txt.value=txt.value.replace(/km\/h/gi, 'km/h');
txt.value=txt.value.replace(/(\d)\s?km\/h/gi, '$1 km/h');
txt.value=txt.value.replace(/(\d)\-km\/h/gi, '$1 km/h');
txt.value=txt.value.replace(/(\d) km\/h/gi, '$1 km/h');
//Test
txt.value=txt.value.replace(/([^\d]\s)(\d{1,3}00),?(000)(?:\s|-| )km\/h([^\(\)]{3})/gi, '$1{{Auto km/h|$2$3|0}}$4');
txt.value=txt.value.replace(/([^\d]\s)(\d{1,3}0),?(000)(?:\s|-| )km\/h([^\(\)]{3})/gi, '$1{{Auto km/h|$2$3|0}}$4');
txt.value=txt.value.replace(/([^\d]\s)(\d{1,3}),?(000)(?:\s|-| )km\/h([^\(\)]{3})/gi, '$1{{Auto km/h|$2$3|0}}$4');
txt.value=txt.value.replace(/([^\d]\s)(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )km\/h([^\(\)]{3})/gi, '$1{{Auto km/h|$2$3|0}}$4');
txt.value=txt.value.replace(/([^\d]\s)(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )km\/h([^\(\)]{3})/gi, '$1{{Auto km/h|$2$3|0}}$4');
txt.value=txt.value.replace(/([^\d]\s)(\d{1,3})?,?(\d{1,3})(?:\s|-| )km\/h([^\(\)]{3})/gi, '$1{{Auto km/h|$2$3|0}}$4');
txt.value=txt.value.replace(/([^\d]\s)(\d{1,3}\.\d\d)(?:\s|-| )km\/h([^\(\)]{3})/gi, '$1{{Auto km/h|$2|0}}$3');
txt.value=txt.value.replace(/([^\d]\s)(\d{1,3}\.\d\d\d)(?:\s|-| )km\/h([^\(\)]{3})/gi, '$1{{Auto km/h|$2|0}}$3');
// rpm
Line 495 ⟶ 658:
// space with bits and bytes
txt.value=txt.value.replace(/([^\w]\d)\s?(k|M|G|T)(bit|B)/g, '$1 $2$3');
//change format of convert template variables
Line 622 ⟶ 782:
// Add a tag to the summary box
var txt = document.editform.wpSummary;
var summary = "
if (txt.value.indexOf(summary) == -1) {
if (txt.value.match(/[^\*\/\s][^\/\s]?\s*$/)) {
Line 645 ⟶ 805:
// Add a tag to the summary box
var txt = document.editform.wpSummary;
var summary = "
if (txt.value.indexOf(summary) == -1) {
if (txt.value.match(/[^\*\/\s][^\/\s]?\s*$/)) {
Line 669 ⟶ 829:
// Add a tag to the summary box
var txt = document.editform.wpSummary;
var summary = "
if (txt.value.indexOf(summary) == -1) {
if (txt.value.match(/[^\*\/\s][^\/\s]?\s*$/)) {
|