securemark 0.262.2 → 0.263.0
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
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.263.0
|
|
4
|
+
|
|
5
|
+
- Extend fig syntax to set the caption only for inline syntax such as media syntax.
|
|
6
|
+
|
|
3
7
|
## 0.262.2
|
|
4
8
|
|
|
5
9
|
- Refactoring.
|
|
@@ -1676,7 +1680,7 @@
|
|
|
1676
1680
|
|
|
1677
1681
|
## 0.99.2
|
|
1678
1682
|
|
|
1679
|
-
- Fix figure syntax to disallow to set
|
|
1683
|
+
- Fix figure syntax to disallow to set the caption with formula number.
|
|
1680
1684
|
|
|
1681
1685
|
## 0.99.1
|
|
1682
1686
|
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.
|
|
1
|
+
/*! securemark v0.263.0 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("DOMPurify"), require("Prism"));
|
|
@@ -180,7 +180,7 @@ function splice(as, index, count, ...values) {
|
|
|
180
180
|
|
|
181
181
|
switch (values.length) {
|
|
182
182
|
case 0:
|
|
183
|
-
return
|
|
183
|
+
return arguments.length > 2 ? as.splice(index, count) : as.splice(index);
|
|
184
184
|
|
|
185
185
|
case 1:
|
|
186
186
|
return as.splice(index, count, values[0]);
|
|
@@ -198,7 +198,7 @@ function splice(as, index, count, ...values) {
|
|
|
198
198
|
return as.splice(index, count, values[0], values[1], values[2], values[3], values[4]);
|
|
199
199
|
|
|
200
200
|
default:
|
|
201
|
-
return
|
|
201
|
+
return as.splice(index, count, ...values);
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
|
|
@@ -388,18 +388,19 @@ class Cache {
|
|
|
388
388
|
constructor(capacity, opts = {}) {
|
|
389
389
|
this.settings = {
|
|
390
390
|
capacity: 0,
|
|
391
|
+
window: 100,
|
|
391
392
|
age: global_1.Infinity,
|
|
392
393
|
earlyExpiring: false,
|
|
393
394
|
capture: {
|
|
394
395
|
delete: true,
|
|
395
396
|
clear: true
|
|
396
397
|
},
|
|
397
|
-
window: 0,
|
|
398
398
|
resolution: 1,
|
|
399
399
|
offset: 0,
|
|
400
|
-
|
|
400
|
+
entrance: 50,
|
|
401
|
+
threshold: 20,
|
|
401
402
|
sweep: 10,
|
|
402
|
-
|
|
403
|
+
test: false
|
|
403
404
|
};
|
|
404
405
|
this.overlap = 0;
|
|
405
406
|
this.SIZE = 0;
|
|
@@ -423,14 +424,15 @@ class Cache {
|
|
|
423
424
|
});
|
|
424
425
|
this.capacity = settings.capacity;
|
|
425
426
|
if (this.capacity >= 1 === false) throw new Error(`Spica: Cache: Capacity must be 1 or more.`);
|
|
426
|
-
this.window = settings.window || this.capacity;
|
|
427
|
+
this.window = settings.window * this.capacity / 100 >>> 0 || this.capacity;
|
|
427
428
|
if (this.window * 1000 >= this.capacity === false) throw new Error(`Spica: Cache: Window must be 0.1% of capacity or more.`);
|
|
428
|
-
this.
|
|
429
|
-
this.limit = settings.
|
|
429
|
+
this.threshold = settings.threshold;
|
|
430
|
+
this.limit = 1000 - settings.entrance;
|
|
430
431
|
this.age = settings.age;
|
|
431
432
|
this.earlyExpiring = settings.earlyExpiring;
|
|
432
433
|
this.disposer = settings.disposer;
|
|
433
|
-
this.stats = new
|
|
434
|
+
this.stats = opts.resolution || opts.offset ? new StatsExperimental(this.window, settings.resolution, settings.offset) : new Stats(this.window);
|
|
435
|
+
this.test = settings.test;
|
|
434
436
|
}
|
|
435
437
|
|
|
436
438
|
get length() {
|
|
@@ -488,8 +490,8 @@ class Cache {
|
|
|
488
490
|
// fallthrough
|
|
489
491
|
|
|
490
492
|
default:
|
|
491
|
-
if (this.misses * 100 > LRU.length * this.
|
|
492
|
-
this.sweep ||= LRU.length * this.settings.sweep / 100 + 1
|
|
493
|
+
if (this.misses * 100 > LRU.length * this.threshold) {
|
|
494
|
+
this.sweep ||= LRU.length * this.settings.sweep / 100 + 1 >>> 0;
|
|
493
495
|
|
|
494
496
|
if (this.sweep > 0) {
|
|
495
497
|
LRU.head = LRU.head.next.next;
|
|
@@ -590,7 +592,7 @@ class Cache {
|
|
|
590
592
|
this.misses &&= 0;
|
|
591
593
|
this.sweep &&= 0; // Optimization for memoize.
|
|
592
594
|
|
|
593
|
-
if (this.
|
|
595
|
+
if (!this.test && node === node.list.head) return node.value.value;
|
|
594
596
|
this.access(node);
|
|
595
597
|
this.adjust();
|
|
596
598
|
return node.value.value;
|
|
@@ -675,13 +677,15 @@ class Cache {
|
|
|
675
677
|
stats,
|
|
676
678
|
indexes
|
|
677
679
|
} = this;
|
|
678
|
-
if (stats.subtotal() * 1000 % capacity || !stats.
|
|
680
|
+
if (stats.subtotal() * 1000 % capacity || !stats.isFull()) return;
|
|
679
681
|
const lenR = indexes.LRU.length;
|
|
680
682
|
const lenF = indexes.LFU.length;
|
|
681
683
|
const lenO = this.overlap;
|
|
682
684
|
const leverage = (lenF + lenO) * 1000 / (lenR + lenF) | 0;
|
|
683
|
-
const
|
|
684
|
-
const
|
|
685
|
+
const rateR = stats.rateLRU();
|
|
686
|
+
const rateF = 10000 - rateR;
|
|
687
|
+
const rateR0 = rateR * leverage;
|
|
688
|
+
const rateF0 = rateF * (1000 - leverage);
|
|
685
689
|
const rateF1 = stats.offset && stats.rateLFU(true) * (1000 - leverage); // 操作頻度を超えてキャッシュ比率を増減させても余剰比率の消化が追いつかず無駄
|
|
686
690
|
// LRUの下限設定ではLRU拡大の要否を迅速に判定できないためLFUのヒット率低下の検出で代替する
|
|
687
691
|
|
|
@@ -725,53 +729,51 @@ class Cache {
|
|
|
725
729
|
exports.Cache = Cache;
|
|
726
730
|
|
|
727
731
|
class Stats {
|
|
728
|
-
constructor(window
|
|
732
|
+
constructor(window) {
|
|
729
733
|
this.window = window;
|
|
730
|
-
this.
|
|
731
|
-
this.
|
|
732
|
-
this.max = (0, alias_1.ceil)(this.resolution * (100 + this.offset) / 100) + 1;
|
|
734
|
+
this.offset = 0;
|
|
735
|
+
this.max = 2;
|
|
733
736
|
this.LRU = [0];
|
|
734
737
|
this.LFU = [0];
|
|
735
738
|
}
|
|
736
739
|
|
|
740
|
+
static rate(window, hits1, hits2, offset) {
|
|
741
|
+
const currTotal = hits1[0] + hits2[0];
|
|
742
|
+
const prevTotal = hits1[1] + hits2[1];
|
|
743
|
+
const currHits = hits1[0];
|
|
744
|
+
const prevHits = hits1[1];
|
|
745
|
+
const prevRate = prevHits * 100 / (prevTotal || 1);
|
|
746
|
+
const currRatio = currTotal * 100 / window - offset;
|
|
747
|
+
if (currRatio <= 0) return prevRate * 100 | 0;
|
|
748
|
+
const currRate = currHits * 100 / (currTotal || 1);
|
|
749
|
+
const prevRatio = 100 - currRatio;
|
|
750
|
+
return currRate * currRatio + prevRate * prevRatio | 0;
|
|
751
|
+
}
|
|
752
|
+
|
|
737
753
|
get length() {
|
|
738
754
|
return this.LRU.length;
|
|
739
755
|
}
|
|
740
756
|
|
|
741
|
-
|
|
757
|
+
isFull() {
|
|
742
758
|
return this.length === this.max;
|
|
743
759
|
}
|
|
744
760
|
|
|
745
761
|
rateLRU(offset = false) {
|
|
746
|
-
return rate(this.window, this.LRU, this.LFU, +offset
|
|
762
|
+
return Stats.rate(this.window, this.LRU, this.LFU, +offset & 0);
|
|
747
763
|
}
|
|
748
764
|
|
|
749
765
|
rateLFU(offset = false) {
|
|
750
|
-
return rate(this.window, this.LFU, this.LRU, +offset
|
|
766
|
+
return Stats.rate(this.window, this.LFU, this.LRU, +offset & 0);
|
|
751
767
|
}
|
|
752
768
|
|
|
753
769
|
subtotal() {
|
|
754
770
|
const {
|
|
755
771
|
LRU,
|
|
756
772
|
LFU,
|
|
757
|
-
window
|
|
758
|
-
resolution,
|
|
759
|
-
offset
|
|
773
|
+
window
|
|
760
774
|
} = this;
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
if (this.length === 1) {
|
|
764
|
-
this.slide();
|
|
765
|
-
} else {
|
|
766
|
-
LRU[1] += LRU[0];
|
|
767
|
-
LFU[1] += LFU[0];
|
|
768
|
-
LRU[0] = 0;
|
|
769
|
-
LFU[0] = 0;
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
const subtotal = LRU[+offset && 1] + LFU[+offset && 1] || 0;
|
|
774
|
-
subtotal >= window / resolution && this.slide();
|
|
775
|
+
const subtotal = LRU[0] + LFU[0];
|
|
776
|
+
subtotal >= window && this.slide();
|
|
775
777
|
return LRU[0] + LFU[0];
|
|
776
778
|
}
|
|
777
779
|
|
|
@@ -798,26 +800,69 @@ class Stats {
|
|
|
798
800
|
|
|
799
801
|
}
|
|
800
802
|
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
803
|
+
class StatsExperimental extends Stats {
|
|
804
|
+
constructor(window, resolution, offset) {
|
|
805
|
+
super(window);
|
|
806
|
+
this.resolution = resolution;
|
|
807
|
+
this.offset = offset;
|
|
808
|
+
this.max = (0, alias_1.ceil)(this.resolution * (100 + this.offset) / 100) + 1;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
static rate(window, hits1, hits2, offset) {
|
|
812
|
+
let total = 0;
|
|
813
|
+
let hits = 0;
|
|
814
|
+
let ratio = 100;
|
|
815
|
+
|
|
816
|
+
for (let len = hits1.length, i = 0; i < len; ++i) {
|
|
817
|
+
const subtotal = hits1[i] + hits2[i];
|
|
818
|
+
if (subtotal === 0) continue;
|
|
819
|
+
offset = i + 1 === len ? 0 : offset;
|
|
820
|
+
const subratio = (0, alias_1.min)(subtotal * 100 / window, ratio) - offset;
|
|
821
|
+
offset = offset && subratio < 0 ? -subratio : 0;
|
|
822
|
+
if (subratio <= 0) continue;
|
|
823
|
+
const rate = window * subratio / subtotal;
|
|
824
|
+
total += subtotal * rate;
|
|
825
|
+
hits += hits1[i] * rate;
|
|
826
|
+
ratio -= subratio;
|
|
827
|
+
if (ratio <= 0) break;
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
return hits * 10000 / total | 0;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
rateLRU(offset = false) {
|
|
834
|
+
return StatsExperimental.rate(this.window, this.LRU, this.LFU, +offset && this.offset);
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
rateLFU(offset = false) {
|
|
838
|
+
return StatsExperimental.rate(this.window, this.LFU, this.LRU, +offset && this.offset);
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
subtotal() {
|
|
842
|
+
const {
|
|
843
|
+
LRU,
|
|
844
|
+
LFU,
|
|
845
|
+
window,
|
|
846
|
+
resolution,
|
|
847
|
+
offset
|
|
848
|
+
} = this;
|
|
849
|
+
|
|
850
|
+
if (offset && LRU[0] + LFU[0] >= window * offset / 100) {
|
|
851
|
+
if (this.length === 1) {
|
|
852
|
+
this.slide();
|
|
853
|
+
} else {
|
|
854
|
+
LRU[1] += LRU[0];
|
|
855
|
+
LFU[1] += LFU[0];
|
|
856
|
+
LRU[0] = 0;
|
|
857
|
+
LFU[0] = 0;
|
|
858
|
+
}
|
|
859
|
+
}
|
|
805
860
|
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
offset = i + 1 === len ? 0 : offset;
|
|
810
|
-
const subratio = (0, alias_1.min)(subtotal * 100 / window, ratio) - offset;
|
|
811
|
-
offset = offset && subratio < 0 ? -subratio : 0;
|
|
812
|
-
if (subratio <= 0) continue;
|
|
813
|
-
const rate = window * subratio / subtotal;
|
|
814
|
-
total += subtotal * rate;
|
|
815
|
-
hits += hits1[i] * rate;
|
|
816
|
-
ratio -= subratio;
|
|
817
|
-
if (ratio <= 0) break;
|
|
861
|
+
const subtotal = LRU[offset && 1] + LFU[offset && 1] || 0;
|
|
862
|
+
subtotal >= window / resolution && this.slide();
|
|
863
|
+
return LRU[0] + LFU[0];
|
|
818
864
|
}
|
|
819
865
|
|
|
820
|
-
return hits * 10000 / total | 0;
|
|
821
866
|
}
|
|
822
867
|
|
|
823
868
|
/***/ }),
|
|
@@ -831,7 +876,7 @@ function rate(window, hits1, hits2, offset) {
|
|
|
831
876
|
Object.defineProperty(exports, "__esModule", ({
|
|
832
877
|
value: true
|
|
833
878
|
}));
|
|
834
|
-
exports.
|
|
879
|
+
exports.clock = exports.now = void 0;
|
|
835
880
|
|
|
836
881
|
const global_1 = __webpack_require__(4128);
|
|
837
882
|
|
|
@@ -845,7 +890,7 @@ let count = 0;
|
|
|
845
890
|
|
|
846
891
|
function now(nocache) {
|
|
847
892
|
if (time === undefined) {
|
|
848
|
-
|
|
893
|
+
exports.clock.now(() => time = undefined);
|
|
849
894
|
} else if (!nocache && count++ !== 20) {
|
|
850
895
|
return time;
|
|
851
896
|
}
|
|
@@ -855,32 +900,45 @@ function now(nocache) {
|
|
|
855
900
|
}
|
|
856
901
|
|
|
857
902
|
exports.now = now;
|
|
858
|
-
exports.clock = global_1.Promise
|
|
903
|
+
exports.clock = new class Clock extends global_1.Promise {
|
|
904
|
+
constructor() {
|
|
905
|
+
super(resolve => resolve(undefined)); // Promise subclass is slow.
|
|
859
906
|
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
907
|
+
const clock = global_1.Promise.resolve();
|
|
908
|
+
clock.next = this.next;
|
|
909
|
+
clock.now = this.now;
|
|
910
|
+
return clock;
|
|
911
|
+
}
|
|
863
912
|
|
|
864
|
-
|
|
913
|
+
next(callback) {
|
|
914
|
+
scheduled || schedule();
|
|
915
|
+
exports.clock.then(callback);
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
now(callback) {
|
|
919
|
+
scheduled || schedule();
|
|
920
|
+
queue.push(callback);
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
}();
|
|
865
924
|
const queue = new queue_1.Queue();
|
|
866
|
-
|
|
925
|
+
let scheduled = false;
|
|
867
926
|
|
|
868
|
-
function
|
|
869
|
-
|
|
870
|
-
|
|
927
|
+
function schedule() {
|
|
928
|
+
scheduled = true;
|
|
929
|
+
exports.clock.then(run);
|
|
871
930
|
}
|
|
872
931
|
|
|
873
|
-
exports.tick = tick;
|
|
874
|
-
|
|
875
932
|
function run() {
|
|
876
|
-
for (let
|
|
933
|
+
for (let cb; cb = queue.pop();) {
|
|
877
934
|
try {
|
|
878
|
-
|
|
879
|
-
(0, queue.pop())();
|
|
935
|
+
cb();
|
|
880
936
|
} catch (reason) {
|
|
881
937
|
(0, exception_1.causeAsyncException)(reason);
|
|
882
938
|
}
|
|
883
939
|
}
|
|
940
|
+
|
|
941
|
+
scheduled = false;
|
|
884
942
|
}
|
|
885
943
|
|
|
886
944
|
/***/ }),
|
|
@@ -1072,16 +1130,36 @@ exports.duffReduce = duffReduce;
|
|
|
1072
1130
|
Object.defineProperty(exports, "__esModule", ({
|
|
1073
1131
|
value: true
|
|
1074
1132
|
}));
|
|
1075
|
-
exports.causeAsyncException = void 0;
|
|
1133
|
+
exports.suppressAsyncException = exports.causeAsyncException = void 0;
|
|
1076
1134
|
|
|
1077
1135
|
const global_1 = __webpack_require__(4128);
|
|
1078
1136
|
|
|
1137
|
+
const stack_1 = __webpack_require__(5352);
|
|
1138
|
+
|
|
1139
|
+
const stack = new stack_1.Stack();
|
|
1140
|
+
|
|
1079
1141
|
function causeAsyncException(reason) {
|
|
1080
|
-
|
|
1142
|
+
if (stack.isEmpty()) {
|
|
1143
|
+
global_1.Promise.reject(reason);
|
|
1144
|
+
} else {
|
|
1145
|
+
stack.peek().push(reason);
|
|
1146
|
+
}
|
|
1081
1147
|
}
|
|
1082
1148
|
|
|
1083
1149
|
exports.causeAsyncException = causeAsyncException;
|
|
1084
1150
|
|
|
1151
|
+
function suppressAsyncException(test) {
|
|
1152
|
+
return done => {
|
|
1153
|
+
stack.push([]);
|
|
1154
|
+
return test(err => {
|
|
1155
|
+
stack.pop();
|
|
1156
|
+
done(err);
|
|
1157
|
+
});
|
|
1158
|
+
};
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
exports.suppressAsyncException = suppressAsyncException;
|
|
1162
|
+
|
|
1085
1163
|
/***/ }),
|
|
1086
1164
|
|
|
1087
1165
|
/***/ 4128:
|
|
@@ -1186,8 +1264,7 @@ class Heap {
|
|
|
1186
1264
|
const array = this.array;
|
|
1187
1265
|
const index = node[2];
|
|
1188
1266
|
if (array[index] !== node) throw new Error('Invalid node');
|
|
1189
|
-
swap(array, index, --this.$length);
|
|
1190
|
-
|
|
1267
|
+
swap(array, index, --this.$length);
|
|
1191
1268
|
array[this.$length] = undefined;
|
|
1192
1269
|
index < this.$length && sort(this.cmp, array, index, this.$length, this.stable);
|
|
1193
1270
|
return node[1];
|
|
@@ -1496,8 +1573,7 @@ class List {
|
|
|
1496
1573
|
if (node.list === this) return node.moveTo(before), node;
|
|
1497
1574
|
node.delete();
|
|
1498
1575
|
++this.$length;
|
|
1499
|
-
this.head ??= node;
|
|
1500
|
-
|
|
1576
|
+
this.head ??= node;
|
|
1501
1577
|
node.list = this;
|
|
1502
1578
|
const next = node.next = before ?? node;
|
|
1503
1579
|
const prev = node.prev = next.prev ?? node;
|
|
@@ -1555,21 +1631,26 @@ class Node {
|
|
|
1555
1631
|
this.value = value;
|
|
1556
1632
|
this.next = next;
|
|
1557
1633
|
this.prev = prev;
|
|
1558
|
-
++list
|
|
1634
|
+
++list['$length'];
|
|
1559
1635
|
list.head ??= this;
|
|
1560
1636
|
next && prev ? next.prev = prev.next = this : this.next = this.prev = this;
|
|
1561
1637
|
}
|
|
1562
1638
|
|
|
1639
|
+
get alive() {
|
|
1640
|
+
return this.list !== undefined;
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1563
1643
|
delete() {
|
|
1564
|
-
|
|
1565
|
-
|
|
1644
|
+
const list = this.list;
|
|
1645
|
+
if (!list) return this.value;
|
|
1646
|
+
--list['$length'];
|
|
1566
1647
|
const {
|
|
1567
1648
|
next,
|
|
1568
1649
|
prev
|
|
1569
1650
|
} = this;
|
|
1570
1651
|
|
|
1571
|
-
if (
|
|
1572
|
-
|
|
1652
|
+
if (list.head === this) {
|
|
1653
|
+
list.head = next === this ? undefined : next;
|
|
1573
1654
|
}
|
|
1574
1655
|
|
|
1575
1656
|
if (next) {
|
|
@@ -1578,11 +1659,9 @@ class Node {
|
|
|
1578
1659
|
|
|
1579
1660
|
if (prev) {
|
|
1580
1661
|
prev.next = next;
|
|
1581
|
-
}
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
this.list = undefined; // @ts-expect-error
|
|
1662
|
+
}
|
|
1585
1663
|
|
|
1664
|
+
this.list = undefined;
|
|
1586
1665
|
this.next = this.prev = undefined;
|
|
1587
1666
|
return this.value;
|
|
1588
1667
|
}
|
|
@@ -2030,7 +2109,7 @@ exports.MultiQueue = MultiQueue;
|
|
|
2030
2109
|
Object.defineProperty(exports, "__esModule", ({
|
|
2031
2110
|
value: true
|
|
2032
2111
|
}));
|
|
2033
|
-
exports.unique = exports.rndAf = exports.rndAP = exports.rnd0_ = exports.rnd0Z = exports.rnd0v = exports.rnd0f = exports.rnd64 = exports.rnd62 = exports.rnd32 = exports.rnd16 = void 0;
|
|
2112
|
+
exports.pcg32 = exports.xorshift = exports.unique = exports.rndAf = exports.rndAP = exports.rnd0_ = exports.rnd0Z = exports.rnd0v = exports.rnd0f = exports.rnd64 = exports.rnd62 = exports.rnd32 = exports.rnd16 = void 0;
|
|
2034
2113
|
|
|
2035
2114
|
const global_1 = __webpack_require__(4128);
|
|
2036
2115
|
|
|
@@ -2115,27 +2194,185 @@ function conv(rnd, dict) {
|
|
|
2115
2194
|
const buffer = new Uint16Array(512);
|
|
2116
2195
|
const digit = 16;
|
|
2117
2196
|
let index = buffer.length;
|
|
2197
|
+
let rnd = 2 ** digit;
|
|
2118
2198
|
let offset = digit;
|
|
2119
2199
|
|
|
2120
2200
|
function random(len) {
|
|
2121
|
-
if (
|
|
2201
|
+
if (rnd === 2 ** digit) {
|
|
2122
2202
|
global_1.crypto.getRandomValues(buffer);
|
|
2123
2203
|
index = 0;
|
|
2204
|
+
rnd = buffer[index];
|
|
2124
2205
|
}
|
|
2125
2206
|
|
|
2126
2207
|
if (offset === len) {
|
|
2127
2208
|
offset = digit;
|
|
2128
|
-
|
|
2209
|
+
const r = rnd & masks[len];
|
|
2210
|
+
rnd = buffer[++index] ?? 2 ** digit;
|
|
2211
|
+
return r;
|
|
2129
2212
|
} else if (offset > len) {
|
|
2130
2213
|
offset -= len;
|
|
2131
|
-
return
|
|
2214
|
+
return rnd >> offset & masks[len];
|
|
2132
2215
|
} else {
|
|
2133
2216
|
offset = digit;
|
|
2134
|
-
++index;
|
|
2217
|
+
rnd = buffer[++index] ?? 2 ** digit;
|
|
2135
2218
|
return random(len);
|
|
2136
2219
|
}
|
|
2137
2220
|
}
|
|
2138
2221
|
|
|
2222
|
+
function xorshift(seed = xorshift.seed()) {
|
|
2223
|
+
return () => {
|
|
2224
|
+
let x = seed;
|
|
2225
|
+
x ^= x << 13;
|
|
2226
|
+
x ^= x >> 17;
|
|
2227
|
+
x ^= x << 5;
|
|
2228
|
+
return seed = x >>> 0;
|
|
2229
|
+
};
|
|
2230
|
+
}
|
|
2231
|
+
|
|
2232
|
+
exports.xorshift = xorshift;
|
|
2233
|
+
|
|
2234
|
+
(function (xorshift) {
|
|
2235
|
+
const max = -1 >>> 0;
|
|
2236
|
+
|
|
2237
|
+
function seed() {
|
|
2238
|
+
return global_1.Math.random() * max + 1 >>> 0;
|
|
2239
|
+
}
|
|
2240
|
+
|
|
2241
|
+
xorshift.seed = seed;
|
|
2242
|
+
|
|
2243
|
+
function random(seed) {
|
|
2244
|
+
const rnd = xorshift(seed);
|
|
2245
|
+
return () => rnd() / (max + 1);
|
|
2246
|
+
}
|
|
2247
|
+
|
|
2248
|
+
xorshift.random = random;
|
|
2249
|
+
})(xorshift = exports.xorshift || (exports.xorshift = {}));
|
|
2250
|
+
|
|
2251
|
+
const uint32n = n => n & 2n ** 32n - 1n;
|
|
2252
|
+
|
|
2253
|
+
const uint64n = n => n & 2n ** 64n - 1n; // https://www.pcg-random.org/download.html
|
|
2254
|
+
// https://github.com/imneme/pcg-c/blob/master/include/pcg_variants.h
|
|
2255
|
+
|
|
2256
|
+
|
|
2257
|
+
function pcg32(seed = pcg32.seed()) {
|
|
2258
|
+
return () => pcg32.next(seed);
|
|
2259
|
+
}
|
|
2260
|
+
|
|
2261
|
+
exports.pcg32 = pcg32;
|
|
2262
|
+
|
|
2263
|
+
(function (pcg32) {
|
|
2264
|
+
const MULT = 6364136223846793005n;
|
|
2265
|
+
|
|
2266
|
+
function random(seed) {
|
|
2267
|
+
const rnd = pcg32(seed);
|
|
2268
|
+
return () => rnd() / 2 ** 32;
|
|
2269
|
+
}
|
|
2270
|
+
|
|
2271
|
+
pcg32.random = random;
|
|
2272
|
+
|
|
2273
|
+
function seed(state = BigInt(xorshift.seed()) << 32n | BigInt(xorshift.seed()), inc = BigInt(xorshift.seed()) << 32n | BigInt(xorshift.seed())) {
|
|
2274
|
+
const seed = [0n, uint64n(inc << 1n | 1n)];
|
|
2275
|
+
seed[0] = uint64n(seed[0] * MULT + seed[1]);
|
|
2276
|
+
seed[0] = uint64n(seed[0] + state);
|
|
2277
|
+
seed[0] = uint64n(seed[0] * MULT + seed[1]);
|
|
2278
|
+
return seed;
|
|
2279
|
+
}
|
|
2280
|
+
|
|
2281
|
+
pcg32.seed = seed;
|
|
2282
|
+
|
|
2283
|
+
function next(seed) {
|
|
2284
|
+
const oldstate = seed[0];
|
|
2285
|
+
seed[0] = uint64n(oldstate * MULT + seed[1]);
|
|
2286
|
+
const xorshifted = uint32n((oldstate >> 18n ^ oldstate) >> 27n);
|
|
2287
|
+
const rot = oldstate >> 59n;
|
|
2288
|
+
return (0, global_1.Number)(uint32n(xorshifted >> rot | xorshifted << (-rot & 31n)));
|
|
2289
|
+
}
|
|
2290
|
+
|
|
2291
|
+
pcg32.next = next;
|
|
2292
|
+
|
|
2293
|
+
function advance(seed, delta) {
|
|
2294
|
+
while (delta < 0) {
|
|
2295
|
+
delta = 2n ** 64n + delta;
|
|
2296
|
+
}
|
|
2297
|
+
|
|
2298
|
+
delta = uint64n(delta);
|
|
2299
|
+
let acc_mult = 1n;
|
|
2300
|
+
let acc_plus = 0n;
|
|
2301
|
+
let cur_mult = MULT;
|
|
2302
|
+
let cur_plus = seed[1];
|
|
2303
|
+
|
|
2304
|
+
while (delta > 0) {
|
|
2305
|
+
if (delta & 1n) {
|
|
2306
|
+
acc_mult = uint64n(acc_mult * cur_mult);
|
|
2307
|
+
acc_plus = uint64n(acc_plus * cur_mult + cur_plus);
|
|
2308
|
+
}
|
|
2309
|
+
|
|
2310
|
+
cur_plus = uint64n((cur_mult + 1n) * cur_plus);
|
|
2311
|
+
cur_mult = uint64n(cur_mult * cur_mult);
|
|
2312
|
+
delta /= 2n;
|
|
2313
|
+
}
|
|
2314
|
+
|
|
2315
|
+
seed[0] = uint64n(acc_mult * seed[0] + acc_plus);
|
|
2316
|
+
return seed;
|
|
2317
|
+
}
|
|
2318
|
+
|
|
2319
|
+
pcg32.advance = advance;
|
|
2320
|
+
})(pcg32 = exports.pcg32 || (exports.pcg32 = {}));
|
|
2321
|
+
|
|
2322
|
+
/***/ }),
|
|
2323
|
+
|
|
2324
|
+
/***/ 5352:
|
|
2325
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
2326
|
+
|
|
2327
|
+
"use strict";
|
|
2328
|
+
|
|
2329
|
+
|
|
2330
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
2331
|
+
value: true
|
|
2332
|
+
}));
|
|
2333
|
+
exports.Stack = void 0;
|
|
2334
|
+
|
|
2335
|
+
class Stack {
|
|
2336
|
+
constructor() {
|
|
2337
|
+
this.array = [];
|
|
2338
|
+
}
|
|
2339
|
+
|
|
2340
|
+
get length() {
|
|
2341
|
+
return this.array.length;
|
|
2342
|
+
}
|
|
2343
|
+
|
|
2344
|
+
isEmpty() {
|
|
2345
|
+
return this.length === 0;
|
|
2346
|
+
}
|
|
2347
|
+
|
|
2348
|
+
peek(index = 0) {
|
|
2349
|
+
return index === 0 ? this.array[this.array.length - 1] : this.array[0];
|
|
2350
|
+
}
|
|
2351
|
+
|
|
2352
|
+
push(value) {
|
|
2353
|
+
this.array.push(value);
|
|
2354
|
+
}
|
|
2355
|
+
|
|
2356
|
+
pop() {
|
|
2357
|
+
return this.array.pop();
|
|
2358
|
+
}
|
|
2359
|
+
|
|
2360
|
+
clear() {
|
|
2361
|
+
this.array = [];
|
|
2362
|
+
}
|
|
2363
|
+
|
|
2364
|
+
*[Symbol.iterator]() {
|
|
2365
|
+
while (!this.isEmpty()) {
|
|
2366
|
+
yield this.pop();
|
|
2367
|
+
}
|
|
2368
|
+
|
|
2369
|
+
return;
|
|
2370
|
+
}
|
|
2371
|
+
|
|
2372
|
+
}
|
|
2373
|
+
|
|
2374
|
+
exports.Stack = Stack;
|
|
2375
|
+
|
|
2139
2376
|
/***/ }),
|
|
2140
2377
|
|
|
2141
2378
|
/***/ 5177:
|
|
@@ -2176,7 +2413,7 @@ function type(value) {
|
|
|
2176
2413
|
return 'Object';
|
|
2177
2414
|
|
|
2178
2415
|
default:
|
|
2179
|
-
return (0, alias_1.toString)(value).slice(8, -1);
|
|
2416
|
+
return value?.constructor?.name || (0, alias_1.toString)(value).slice(8, -1);
|
|
2180
2417
|
}
|
|
2181
2418
|
|
|
2182
2419
|
default:
|
|
@@ -2760,7 +2997,7 @@ function convert(conv, parser) {
|
|
|
2760
2997
|
context
|
|
2761
2998
|
}) => {
|
|
2762
2999
|
if (source === '') return;
|
|
2763
|
-
const src = conv(source);
|
|
3000
|
+
const src = conv(source, context);
|
|
2764
3001
|
if (src === '') return [[], ''];
|
|
2765
3002
|
context.offset ??= 0;
|
|
2766
3003
|
context.offset += source.length - src.length;
|
|
@@ -5012,11 +5249,17 @@ const blockquote_1 = __webpack_require__(7859);
|
|
|
5012
5249
|
|
|
5013
5250
|
const placeholder_1 = __webpack_require__(5198);
|
|
5014
5251
|
|
|
5252
|
+
const inline_1 = __webpack_require__(1160);
|
|
5253
|
+
|
|
5015
5254
|
exports.segment = (0, combinator_1.block)((0, combinator_1.validate)(['[$', '$'], (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.close)(label_1.segment, /^(?=\s).*\n/)), (0, combinator_1.union)([codeblock_1.segment, mathblock_1.segment, table_1.segment, blockquote_1.segment, placeholder_1.segment, (0, combinator_1.some)(source_1.contentline)])])));
|
|
5016
|
-
exports.fig = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.verify)((0, combinator_1.convert)(source => {
|
|
5255
|
+
exports.fig = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.verify)((0, combinator_1.convert)((source, context) => {
|
|
5017
5256
|
const fence = (/^[^\n]*\n!?>+\s/.test(source) && source.match(/^~{3,}(?=[^\S\n]*$)/mg) || []).reduce((max, fence) => fence > max ? fence : max, '~~') + '~';
|
|
5018
|
-
return
|
|
5257
|
+
return parser({
|
|
5258
|
+
source,
|
|
5259
|
+
context
|
|
5260
|
+
}) ? `${fence}figure ${source.replace(/^(.+\n.+\n)([\S\s]+?)\n?$/, '$1\n$2')}\n${fence}` : `${fence}figure ${source}\n\n${fence}`;
|
|
5019
5261
|
}, (0, combinator_1.union)([figure_1.figure])), ([el]) => el.tagName === 'FIGURE')));
|
|
5262
|
+
const parser = (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.close)(label_1.segment, /^(?=\s).*\n/)), (0, combinator_1.line)((0, combinator_1.union)([inline_1.media, inline_1.shortmedia])), (0, combinator_1.some)(source_1.contentline)]);
|
|
5020
5263
|
|
|
5021
5264
|
/***/ }),
|
|
5022
5265
|
|
|
@@ -9887,7 +10130,7 @@ function unlink(h) {
|
|
|
9887
10130
|
/***/ 3252:
|
|
9888
10131
|
/***/ (function(module) {
|
|
9889
10132
|
|
|
9890
|
-
/*! typed-dom v0.0.
|
|
10133
|
+
/*! typed-dom v0.0.310 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
|
|
9891
10134
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
9892
10135
|
if(true)
|
|
9893
10136
|
module.exports = factory();
|
|
@@ -10319,7 +10562,7 @@ exports.defrag = defrag;
|
|
|
10319
10562
|
/***/ 6120:
|
|
10320
10563
|
/***/ (function(module) {
|
|
10321
10564
|
|
|
10322
|
-
/*! typed-dom v0.0.
|
|
10565
|
+
/*! typed-dom v0.0.310 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
|
|
10323
10566
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
10324
10567
|
if(true)
|
|
10325
10568
|
module.exports = factory();
|
package/karma.conf.js
CHANGED
|
@@ -6,7 +6,7 @@ module.exports = function (config) {
|
|
|
6
6
|
{ pattern: 'https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.js', watched: false, served: false, included: true, integrity: 'sha512-2iwCHjuj+PmdCyvb88rMOch0UcKQxVHi/gsAml1fN3eg82IDaO/cdzzeXX4iF2VzIIes7pODE1/G0ts3QBwslA==' },
|
|
7
7
|
{ pattern: 'https://cdnjs.cloudflare.com/ajax/libs/benchmark/2.1.4/benchmark.js', watched: false, served: false, included: true, integrity: 'sha512-XnVGk21Ij51MbU8XezQpkwZ1/GA8b5qmoVGIOdJLBYycutjkaeemipzRJP7P6mEJl99OfnweA7M3e4WLfuG7Aw==' },
|
|
8
8
|
{ pattern: 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.js', watched: false, served: false, included: true, integrity: 'sha512-n/4gHW3atM3QqRcbCn6ewmpxcLAHGaDjpEBu4xZd47N0W2oQ+6q7oc3PXstrJYXcbNU1OHdQ1T7pAP+gi5Yu8g==' },
|
|
9
|
-
{ pattern: 'https://cdnjs.cloudflare.com/ajax/libs/prism/1.28.0/prism.min.js', watched: false, served: false, included: true, integrity: '
|
|
9
|
+
{ pattern: 'https://cdnjs.cloudflare.com/ajax/libs/prism/1.28.0/prism.min.js', watched: false, served: false, included: true, integrity: 'sha512-RDQSW3KoqJMiX0L/UBgwBmH1EmRYp8LBOiLaA8rBHIy+7OGP/7Gxg8vbt8wG4ZYd29P0Fnoq6+LOytCqx3cyoQ==' },
|
|
10
10
|
{ pattern: 'https://cdnjs.cloudflare.com/ajax/libs/prism/1.28.0/plugins/autoloader/prism-autoloader.min.js', watched: false, served: false, included: true, integrity: 'sha512-fTl/qcO1VgvKtOMApX2PdZzkziyr2stM65GYPLGuYMnuMm1z2JLJG6XVU7C/mR+E7xBUqCivykuhlzfqxXBXbg==' },
|
|
11
11
|
{ pattern: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.0/es5/tex-chtml.min.js', watched: false, served: false, included: true, integrity: 'sha512-93xLZnNMlYI6xaQPf/cSdXoBZ23DThX7VehiGJJXB76HTTalQKPC5CIHuFX8dlQ5yzt6baBQRJ4sDXhzpojRJA==' },
|
|
12
12
|
{ pattern: 'https://cdnjs.cloudflare.com/ajax/libs/dompurify/2.3.8/purify.js', watched: false, served: false, included: true, integrity: 'sha512-QaF+0tDlqVmwZaQSc0kImgYmw+Cd66TxA5D9X70I5V9BNSqk6yBTbyqw2VEUsVYV5OTbxw8HD9d45on1wvYv7g==' },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "securemark",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.263.0",
|
|
4
4
|
"description": "Secure markdown renderer working on browsers for user input data.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"homepage": "https://github.com/falsandtru/securemark",
|
|
@@ -34,26 +34,26 @@
|
|
|
34
34
|
"@types/mocha": "9.1.1",
|
|
35
35
|
"@types/power-assert": "1.5.8",
|
|
36
36
|
"@types/prismjs": "1.26.0",
|
|
37
|
-
"@typescript-eslint/parser": "^5.
|
|
37
|
+
"@typescript-eslint/parser": "^5.38.1",
|
|
38
38
|
"babel-loader": "^8.2.5",
|
|
39
39
|
"babel-plugin-unassert": "^3.2.0",
|
|
40
40
|
"concurrently": "^7.4.0",
|
|
41
|
-
"eslint": "^8.
|
|
41
|
+
"eslint": "^8.24.0",
|
|
42
42
|
"eslint-plugin-redos": "^4.4.1",
|
|
43
43
|
"eslint-webpack-plugin": "^3.2.0",
|
|
44
44
|
"glob": "^8.0.3",
|
|
45
|
-
"karma": "^6.4.
|
|
45
|
+
"karma": "^6.4.1",
|
|
46
46
|
"karma-chrome-launcher": "^3.1.1",
|
|
47
47
|
"karma-coverage": "^2.2.0",
|
|
48
48
|
"karma-firefox-launcher": "^2.1.2",
|
|
49
49
|
"karma-mocha": "^2.0.1",
|
|
50
50
|
"karma-power-assert": "^1.0.0",
|
|
51
51
|
"mocha": "^10.0.0",
|
|
52
|
-
"npm-check-updates": "^16.
|
|
52
|
+
"npm-check-updates": "^16.3.2",
|
|
53
53
|
"semver": "^7.3.7",
|
|
54
|
-
"spica": "0.0.
|
|
55
|
-
"ts-loader": "^9.
|
|
56
|
-
"typed-dom": "^0.0.
|
|
54
|
+
"spica": "0.0.640",
|
|
55
|
+
"ts-loader": "^9.4.1",
|
|
56
|
+
"typed-dom": "^0.0.310",
|
|
57
57
|
"typescript": "4.8.3",
|
|
58
58
|
"webpack": "^5.74.0",
|
|
59
59
|
"webpack-cli": "^4.10.0",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Parser, check } from '../../data/parser';
|
|
1
|
+
import { Parser, Ctx, Context, check } from '../../data/parser';
|
|
2
2
|
|
|
3
|
-
export function convert<P extends Parser<unknown>>(conv: (source: string) => string, parser: P): P;
|
|
4
|
-
export function convert<T>(conv: (source: string) => string, parser: Parser<T>): Parser<T> {
|
|
3
|
+
export function convert<P extends Parser<unknown>>(conv: (source: string, context: Context<P>) => string, parser: P): P;
|
|
4
|
+
export function convert<T>(conv: (source: string, context: Ctx) => string, parser: Parser<T>): Parser<T> {
|
|
5
5
|
assert(parser);
|
|
6
6
|
return ({ source, context }) => {
|
|
7
7
|
if (source === '') return;
|
|
8
|
-
const src = conv(source);
|
|
8
|
+
const src = conv(source, context);
|
|
9
9
|
if (src === '') return [[], ''];
|
|
10
10
|
context.offset ??= 0;
|
|
11
11
|
context.offset += source.length - src.length;
|
|
@@ -10,7 +10,6 @@ describe('Unit: parser/block/extension/fig', () => {
|
|
|
10
10
|
assert.deepStrictEqual(inspect(parser('\n!https://host\n')), undefined);
|
|
11
11
|
assert.deepStrictEqual(inspect(parser('[$group-name]\nhttps://host')), undefined);
|
|
12
12
|
assert.deepStrictEqual(inspect(parser('[$group-name]\nhttps://host\n')), undefined);
|
|
13
|
-
assert.deepStrictEqual(inspect(parser('[$group-name]\n!https://host\na')), undefined);
|
|
14
13
|
assert.deepStrictEqual(inspect(parser('[$group-name]\n !https://host')), undefined);
|
|
15
14
|
assert.deepStrictEqual(inspect(parser('[$group-name]\n\n!https://host')), undefined);
|
|
16
15
|
assert.deepStrictEqual(inspect(parser('[$group-name]a\nhttps://host')), undefined);
|
|
@@ -43,6 +42,8 @@ describe('Unit: parser/block/extension/fig', () => {
|
|
|
43
42
|
assert.deepStrictEqual(inspect(parser('[$group-name]\n!> _a_')), [['<figure data-type="quote" data-label="group-name" data-group="group"><figcaption><span class="figindex"></span><span class="figtext"></span></figcaption><div><blockquote><section><p><em>a</em></p><h2>References</h2><ol class="references"></ol></section></blockquote></div></figure>'], '']);
|
|
44
43
|
assert.deepStrictEqual(inspect(parser('[$group-name]\n![]{https://host}')), [['<figure data-type="media" data-label="group-name" data-group="group"><figcaption><span class="figindex"></span><span class="figtext"></span></figcaption><div><a href="https://host" target="_blank"><img class="media" data-src="https://host" alt=""></a></div></figure>'], '']);
|
|
45
44
|
assert.deepStrictEqual(inspect(parser('[$group-name]\n![]{https://host}\n')), [['<figure data-type="media" data-label="group-name" data-group="group"><figcaption><span class="figindex"></span><span class="figtext"></span></figcaption><div><a href="https://host" target="_blank"><img class="media" data-src="https://host" alt=""></a></div></figure>'], '']);
|
|
45
|
+
assert.deepStrictEqual(inspect(parser('[$group-name]\n!https://host\ncaption')), [['<figure data-type="media" data-label="group-name" data-group="group"><figcaption><span class="figindex"></span><span class="figtext">caption</span></figcaption><div><a href="https://host" target="_blank"><img class="media" data-src="https://host" alt=""></a></div></figure>'], '']);
|
|
46
|
+
assert.deepStrictEqual(inspect(parser('[$group-name]\n!https://host\ncaption\n')), [['<figure data-type="media" data-label="group-name" data-group="group"><figcaption><span class="figindex"></span><span class="figtext">caption</span></figcaption><div><a href="https://host" target="_blank"><img class="media" data-src="https://host" alt=""></a></div></figure>'], '']);
|
|
46
47
|
assert.deepStrictEqual(inspect(parser('$group-name\n!https://host')), [['<figure data-type="media" data-label="group-name" data-group="group"><figcaption><span class="figindex"></span><span class="figtext"></span></figcaption><div><a href="https://host" target="_blank"><img class="media" data-src="https://host" alt=""></a></div></figure>'], '']);
|
|
47
48
|
});
|
|
48
49
|
|
|
@@ -8,6 +8,7 @@ import { segment as seg_math } from '../mathblock';
|
|
|
8
8
|
import { segment as seg_table } from './table';
|
|
9
9
|
import { segment as seg_blockquote } from '../blockquote';
|
|
10
10
|
import { segment as seg_placeholder } from './placeholder';
|
|
11
|
+
import { media, shortmedia } from '../../inline';
|
|
11
12
|
|
|
12
13
|
import FigParser = ExtensionParser.FigParser;
|
|
13
14
|
|
|
@@ -25,10 +26,21 @@ export const segment: FigParser.SegmentParser = block(validate(['[$', '$'],
|
|
|
25
26
|
])));
|
|
26
27
|
|
|
27
28
|
export const fig: FigParser = block(rewrite(segment, verify(convert(
|
|
28
|
-
source => {
|
|
29
|
+
(source, context) => {
|
|
29
30
|
const fence = (/^[^\n]*\n!?>+\s/.test(source) && source.match(/^~{3,}(?=[^\S\n]*$)/mg) || [])
|
|
30
31
|
.reduce((max, fence) => fence > max ? fence : max, '~~') + '~';
|
|
31
|
-
return
|
|
32
|
+
return parser({ source, context })
|
|
33
|
+
? `${fence}figure ${source.replace(/^(.+\n.+\n)([\S\s]+?)\n?$/, '$1\n$2')}\n${fence}`
|
|
34
|
+
: `${fence}figure ${source}\n\n${fence}`;
|
|
32
35
|
},
|
|
33
36
|
union([figure])),
|
|
34
37
|
([el]) => el.tagName === 'FIGURE')));
|
|
38
|
+
|
|
39
|
+
const parser = sequence([
|
|
40
|
+
line(close(seg_label, /^(?=\s).*\n/)),
|
|
41
|
+
line(union([
|
|
42
|
+
media,
|
|
43
|
+
shortmedia,
|
|
44
|
+
])),
|
|
45
|
+
some(contentline),
|
|
46
|
+
]);
|