@ephox/polaris
Advanced tools
Comparing version 4.0.7 to 4.0.8
@@ -27,16 +27,16 @@ /* | ||
- exclude trailing comma and period in URL path | ||
- allow up to 15 character schemes including all valid characters from the spec https://url.spec.whatwg.org/#url-scheme-string (TINY-5074) | ||
- changed instances of 0-9 to be \d (TINY-5074) | ||
- reduced duplication (TINY-5074) | ||
(?: | ||
(?:[A-Za-z]{3,9}:(?:\/\/)) | ||
(?:[-.~*+=!&;:'%@?^${}(),\w]+@)? | ||
[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)* | ||
| | ||
(?:www\. | ||
| | ||
[-;:&=+$,.\w]+@ | ||
) | ||
[A-Za-z0-9-]+ | ||
(?:\.[A-Za-z0-9-]+)* | ||
(?: | ||
[A-Za-z][A-Za-z\d.+-]{0,14}:\/\/(?:[-.~*+=!&;:'%@?^${}(),\w]+@)? | ||
| www\. | ||
| [-;:&=+$,.\w]+@ | ||
) | ||
[A-Za-z\d-]+ | ||
(?:\.[A-Za-z\d-]+)* | ||
) | ||
(?::[0-9]+)? | ||
(?::\d+)? | ||
(?: | ||
@@ -63,3 +63,3 @@ \/ | ||
// eslint-disable-next-line max-len | ||
return /(?:(?:[A-Za-z]{3,9}:(?:\/\/))(?:[-.~*+=!&;:'%@?^${}(),\w]+@)?[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*|(?:www\.|[-;:&=+$,.\w]+@)[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*)(?::[0-9]+)?(?:\/(?:[-+~=.,%()\/\w]*[-+~=%()\/\w])?)?(?:\?(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?(?:#(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?/g; | ||
return /(?:[A-Za-z][A-Za-z\d.+-]{0,14}:\/\/(?:[-.~*+=!&;:'%@?^${}(),\w]+@)?|www\.|[-;:&=+$,.\w]+@)[A-Za-z\d-]+(?:\.[A-Za-z\d-]+)*(?::\d+)?(?:\/(?:[-+~=.,%()\/\w]*[-+~=%()\/\w])?)?(?:\?(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?(?:#(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?/g; | ||
}; | ||
@@ -66,0 +66,0 @@ var autolink = function () { |
@@ -65,3 +65,12 @@ import { assert, UnitTest } from '@ephox/bedrock-client'; | ||
]; | ||
var trueCases = ephoxCases.concat(mathiasBynens); | ||
var validSchemes = [ | ||
'h://foo.com', | ||
'h1://foo.com', | ||
'h1+://foo.com', | ||
'h1+.://foo.com', | ||
'h1+.-://foo.com', | ||
'p72internal://foo.com', | ||
'but15characters://foo.com', | ||
]; | ||
var trueCases = ephoxCases.concat(mathiasBynens).concat(validSchemes); | ||
var ephoxFalseCases = [ | ||
@@ -89,3 +98,2 @@ 'I am not a link', | ||
'foo.com', | ||
'h://test', | ||
':// should fail', | ||
@@ -125,3 +133,13 @@ 'http://?', | ||
]; | ||
var falseCases = ephoxFalseCases.concat(mathiasBynensFalse); | ||
var invalidSchemes = [ | ||
'1h://foo.com', | ||
'+h://foo.com', | ||
'.h://foo.com', | ||
'-h://foo.com', | ||
'h!://foo.com', | ||
'h/://foo.com', | ||
'h_://foo.com', | ||
'morethanfifteencharacters://foo.com', | ||
]; | ||
var falseCases = ephoxFalseCases.concat(mathiasBynensFalse).concat(invalidSchemes); | ||
Arr.each(trueCases, function (cs) { | ||
@@ -128,0 +146,0 @@ var matched = Regexes.link().exec(cs); |
{ | ||
"name": "@ephox/polaris", | ||
"description": "This project does data manipulation on arrays and strings.", | ||
"version": "4.0.7", | ||
"version": "4.0.8", | ||
"repository": { | ||
@@ -38,3 +38,3 @@ "type": "git", | ||
"types": "./lib/main/ts/ephox/polaris/api/Main.d.ts", | ||
"gitHead": "17afb1a332b0093cbc017a0d40b1651b55b2a196" | ||
"gitHead": "01f0a215b11fc8780ec4db9eccb5f4072c7970fd" | ||
} |
@@ -28,16 +28,16 @@ | ||
- exclude trailing comma and period in URL path | ||
- allow up to 15 character schemes including all valid characters from the spec https://url.spec.whatwg.org/#url-scheme-string (TINY-5074) | ||
- changed instances of 0-9 to be \d (TINY-5074) | ||
- reduced duplication (TINY-5074) | ||
(?: | ||
(?:[A-Za-z]{3,9}:(?:\/\/)) | ||
(?:[-.~*+=!&;:'%@?^${}(),\w]+@)? | ||
[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)* | ||
| | ||
(?:www\. | ||
| | ||
[-;:&=+$,.\w]+@ | ||
) | ||
[A-Za-z0-9-]+ | ||
(?:\.[A-Za-z0-9-]+)* | ||
(?: | ||
[A-Za-z][A-Za-z\d.+-]{0,14}:\/\/(?:[-.~*+=!&;:'%@?^${}(),\w]+@)? | ||
| www\. | ||
| [-;:&=+$,.\w]+@ | ||
) | ||
[A-Za-z\d-]+ | ||
(?:\.[A-Za-z\d-]+)* | ||
) | ||
(?::[0-9]+)? | ||
(?::\d+)? | ||
(?: | ||
@@ -62,5 +62,6 @@ \/ | ||
*/ | ||
const link = (): RegExp => | ||
// eslint-disable-next-line max-len | ||
/(?:(?:[A-Za-z]{3,9}:(?:\/\/))(?:[-.~*+=!&;:'%@?^${}(),\w]+@)?[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*|(?:www\.|[-;:&=+$,.\w]+@)[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*)(?::[0-9]+)?(?:\/(?:[-+~=.,%()\/\w]*[-+~=%()\/\w])?)?(?:\?(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?(?:#(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?/g; | ||
/(?:[A-Za-z][A-Za-z\d.+-]{0,14}:\/\/(?:[-.~*+=!&;:'%@?^${}(),\w]+@)?|www\.|[-;:&=+$,.\w]+@)[A-Za-z\d-]+(?:\.[A-Za-z\d-]+)*(?::\d+)?(?:\/(?:[-+~=.,%()\/\w]*[-+~=%()\/\w])?)?(?:\?(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?(?:#(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?/g; | ||
@@ -67,0 +68,0 @@ const autolink = (): RegExp => { |
@@ -69,4 +69,14 @@ import { assert, UnitTest } from '@ephox/bedrock-client'; | ||
const trueCases = ephoxCases.concat(mathiasBynens); | ||
const validSchemes = [ | ||
'h://foo.com', | ||
'h1://foo.com', | ||
'h1+://foo.com', | ||
'h1+.://foo.com', | ||
'h1+.-://foo.com', | ||
'p72internal://foo.com', | ||
'but15characters://foo.com', | ||
]; | ||
const trueCases = ephoxCases.concat(mathiasBynens).concat(validSchemes); | ||
const ephoxFalseCases = [ | ||
@@ -95,3 +105,2 @@ 'I am not a link', | ||
'foo.com', | ||
'h://test', | ||
':// should fail', | ||
@@ -133,4 +142,15 @@ 'http://?', | ||
const falseCases = ephoxFalseCases.concat(mathiasBynensFalse); | ||
const invalidSchemes = [ | ||
'1h://foo.com', | ||
'+h://foo.com', | ||
'.h://foo.com', | ||
'-h://foo.com', | ||
'h!://foo.com', | ||
'h/://foo.com', | ||
'h_://foo.com', | ||
'morethanfifteencharacters://foo.com', | ||
]; | ||
const falseCases = ephoxFalseCases.concat(mathiasBynensFalse).concat(invalidSchemes); | ||
Arr.each(trueCases, (cs) => { | ||
@@ -137,0 +157,0 @@ const matched = Regexes.link().exec(cs); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
267059
240
3723