securemark 0.275.0 → 0.275.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.275.
|
|
1
|
+
/*! securemark v0.275.2 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
|
|
2
2
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
3
3
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
4
4
|
module.exports = factory(require("Prism"), require("DOMPurify"));
|
|
@@ -6185,14 +6185,14 @@ function identity(id, text, type = 'index') {
|
|
|
6185
6185
|
if (id === '') return undefined;
|
|
6186
6186
|
text &&= text.trim().replace(/\s+/g, '_');
|
|
6187
6187
|
if (text === '') return undefined;
|
|
6188
|
-
if (text.length <=
|
|
6188
|
+
if (text.length <= 120 || type === '') return `${type}:${id ?? ''}:${text}`;
|
|
6189
6189
|
const cs = [...text];
|
|
6190
|
-
if (cs.length <=
|
|
6190
|
+
if (cs.length <= 120) return `${type}:${id ?? ''}:${text}`;
|
|
6191
6191
|
switch (type) {
|
|
6192
6192
|
case 'index':
|
|
6193
|
-
return `${type}:${id ?? ''}:${cs.slice(0,
|
|
6193
|
+
return `${type}:${id ?? ''}:${cs.slice(0, 120 - 3).join('')}...`;
|
|
6194
6194
|
case 'mark':
|
|
6195
|
-
return `${type}:${id ?? ''}:${cs.slice(0,
|
|
6195
|
+
return `${type}:${id ?? ''}:${cs.slice(0, 38).join('')}...${cs.slice(cs.length / 2 - 38 / 2 | 0).slice(0, 38).join('')}...${cs.slice(-38).join('')}`;
|
|
6196
6196
|
}
|
|
6197
6197
|
}
|
|
6198
6198
|
exports.identity = identity;
|
|
@@ -6291,7 +6291,7 @@ exports.indexer = (0, combinator_1.creation)((0, combinator_1.fmap)((0, combinat
|
|
|
6291
6291
|
// Indexer is invisible but invalids must be visible.
|
|
6292
6292
|
([el]) => el.getElementsByClassName('invalid').length === 0), ([el]) => [(0, dom_1.html)('span', {
|
|
6293
6293
|
class: 'indexer',
|
|
6294
|
-
'data-index': el.getAttribute('href').slice(1).replace(
|
|
6294
|
+
'data-index': el.getAttribute('href').slice(1).replace(/^[^:]*:[^:]*:/, '')
|
|
6295
6295
|
})]));
|
|
6296
6296
|
|
|
6297
6297
|
/***/ }),
|
package/package.json
CHANGED
|
@@ -15,23 +15,23 @@ export function identity(id: string | undefined, text: string, type: 'index' | '
|
|
|
15
15
|
if (id === '') return undefined;
|
|
16
16
|
text &&= text.trim().replace(/\s+/g, '_');
|
|
17
17
|
if (text === '') return undefined;
|
|
18
|
-
if (text.length <=
|
|
18
|
+
if (text.length <= 120 || type === '') return `${type}:${id ?? ''}:${text}`;
|
|
19
19
|
const cs = [...text];
|
|
20
|
-
if (cs.length <=
|
|
20
|
+
if (cs.length <= 120) return `${type}:${id ?? ''}:${text}`;
|
|
21
21
|
switch (type) {
|
|
22
22
|
case 'index':
|
|
23
|
-
return `${type}:${id ?? ''}:${cs.slice(0,
|
|
23
|
+
return `${type}:${id ?? ''}:${cs.slice(0, 120 - 3).join('')}...`;
|
|
24
24
|
case 'mark':
|
|
25
|
-
return `${type}:${id ?? ''}:${cs.slice(0,
|
|
25
|
+
return `${type}:${id ?? ''}:${cs.slice(0, 38).join('')}...${cs.slice(cs.length / 2 - 38 / 2 | 0).slice(0, 38).join('')}...${cs.slice(-38).join('')}`;
|
|
26
26
|
}
|
|
27
27
|
assert(false);
|
|
28
28
|
}
|
|
29
|
-
assert(identity(undefined, '0'.repeat(
|
|
30
|
-
assert(identity(undefined, '0'.repeat(
|
|
31
|
-
assert(identity(undefined, '0'.repeat(200) + 1)!.slice(7) === '0'.repeat(
|
|
32
|
-
assert(identity(undefined, '0'.repeat(
|
|
33
|
-
assert(identity(undefined, '0'.repeat(
|
|
34
|
-
assert(identity(undefined, '0'.repeat(
|
|
29
|
+
assert(identity(undefined, '0'.repeat(120 - 1) + 1)!.slice(7) === '0'.repeat(120 - 1) + 1);
|
|
30
|
+
assert(identity(undefined, '0'.repeat(120) + 1)!.slice(7) === '0'.repeat(117) + '...');
|
|
31
|
+
assert(identity(undefined, '0'.repeat(200) + 1)!.slice(7) === '0'.repeat(117) + '...');
|
|
32
|
+
assert(identity(undefined, '0'.repeat(120 - 1) + 1, 'mark')!.slice(6) === '0'.repeat(120 - 1) + 1);
|
|
33
|
+
assert(identity(undefined, '0'.repeat(41) + '1'.repeat(38) + '2'.repeat(41) + 3, 'mark')!.slice(6) === '0'.repeat(38) + '...' + '1'.repeat(38) + '...' + '2'.repeat(38 - 1) + 3);
|
|
34
|
+
assert(identity(undefined, '0'.repeat(81) + '1'.repeat(38) + '2'.repeat(81) + 3, 'mark')!.slice(6) === '0'.repeat(38) + '...' + '1'.repeat(38) + '...' + '2'.repeat(38 - 1) + 3);
|
|
35
35
|
|
|
36
36
|
export function index(source: Element, optional = false): string {
|
|
37
37
|
assert(source instanceof DocumentFragment || !source.matches('.indexer'));
|
|
@@ -15,5 +15,8 @@ export const indexer: ExtensionParser.IndexerParser = creation(fmap(verify(surro
|
|
|
15
15
|
// Indexer is invisible but invalids must be visible.
|
|
16
16
|
([el]) => el.getElementsByClassName('invalid').length === 0),
|
|
17
17
|
([el]) => [
|
|
18
|
-
html('span', {
|
|
18
|
+
html('span', {
|
|
19
|
+
class: 'indexer',
|
|
20
|
+
'data-index': el.getAttribute('href')!.slice(1).replace(/^[^:]*:[^:]*:/, ''),
|
|
21
|
+
}),
|
|
19
22
|
]));
|