@abi-software/map-side-bar 1.4.4-context-card-disabled → 1.4.5-context-card-disabled
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/dist/map-side-bar.common.js +33 -3707
- package/dist/map-side-bar.common.js.map +1 -1
- package/dist/map-side-bar.css +1 -1
- package/dist/map-side-bar.umd.js +33 -3707
- package/dist/map-side-bar.umd.js.map +1 -1
- package/dist/map-side-bar.umd.min.js +2 -2
- package/dist/map-side-bar.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/SidebarContent.vue +1 -12
|
@@ -189,13 +189,6 @@ module.exports = require("core-js/modules/es.date.to-primitive.js");
|
|
|
189
189
|
|
|
190
190
|
/***/ }),
|
|
191
191
|
|
|
192
|
-
/***/ "230a":
|
|
193
|
-
/***/ (function(module, exports) {
|
|
194
|
-
|
|
195
|
-
module.exports = require("element-ui/lib/theme-chalk/link.css");
|
|
196
|
-
|
|
197
|
-
/***/ }),
|
|
198
|
-
|
|
199
192
|
/***/ "2439":
|
|
200
193
|
/***/ (function(module, exports) {
|
|
201
194
|
|
|
@@ -419,3120 +412,26 @@ module.exports = require("core-js/modules/web.url-search-params.js");
|
|
|
419
412
|
|
|
420
413
|
module.exports = require("core-js/modules/es.array.unscopables.flat.js");
|
|
421
414
|
|
|
422
|
-
/***/ }),
|
|
423
|
-
|
|
424
|
-
/***/ "7267":
|
|
425
|
-
/***/ (function(module, exports) {
|
|
426
|
-
|
|
427
|
-
module.exports = require("core-js/modules/es.math.to-string-tag.js");
|
|
428
|
-
|
|
429
|
-
/***/ }),
|
|
430
|
-
|
|
431
|
-
/***/ "7664":
|
|
432
|
-
/***/ (function(module, exports) {
|
|
433
|
-
|
|
434
|
-
module.exports = require("core-js/modules/es.object.get-own-property-descriptors.js");
|
|
435
|
-
|
|
436
|
-
/***/ }),
|
|
437
|
-
|
|
438
|
-
/***/ "77d9":
|
|
439
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
440
|
-
|
|
441
|
-
"use strict";
|
|
442
|
-
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_9_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_9_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_9_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_9_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_ContextCard_vue_vue_type_style_index_0_id_1221ea8f_prod_scoped_true_lang_scss___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("af4c");
|
|
443
|
-
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_9_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_9_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_9_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_9_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_ContextCard_vue_vue_type_style_index_0_id_1221ea8f_prod_scoped_true_lang_scss___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_9_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_9_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_9_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_9_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_ContextCard_vue_vue_type_style_index_0_id_1221ea8f_prod_scoped_true_lang_scss___WEBPACK_IMPORTED_MODULE_0__);
|
|
444
|
-
/* unused harmony reexport * */
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
/***/ }),
|
|
448
|
-
|
|
449
|
-
/***/ "7949":
|
|
450
|
-
/***/ (function(module, exports) {
|
|
451
|
-
|
|
452
|
-
module.exports = require("core-js/modules/es.object.proto.js");
|
|
453
|
-
|
|
454
|
-
/***/ }),
|
|
455
|
-
|
|
456
|
-
/***/ "7c5c":
|
|
457
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
458
|
-
|
|
459
|
-
/**
|
|
460
|
-
* marked - a markdown parser
|
|
461
|
-
* Copyright (c) 2011-2022, Christopher Jeffrey. (MIT Licensed)
|
|
462
|
-
* https://github.com/markedjs/marked
|
|
463
|
-
*/
|
|
464
|
-
|
|
465
|
-
/**
|
|
466
|
-
* DO NOT EDIT THIS FILE
|
|
467
|
-
* The code in this file is generated from files in ./src/
|
|
468
|
-
*/
|
|
469
|
-
|
|
470
|
-
(function (global, factory) {
|
|
471
|
-
true ? factory(exports) :
|
|
472
|
-
undefined;
|
|
473
|
-
})(this, (function (exports) { 'use strict';
|
|
474
|
-
|
|
475
|
-
function _defineProperties(target, props) {
|
|
476
|
-
for (var i = 0; i < props.length; i++) {
|
|
477
|
-
var descriptor = props[i];
|
|
478
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
479
|
-
descriptor.configurable = true;
|
|
480
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
481
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
486
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
487
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
488
|
-
Object.defineProperty(Constructor, "prototype", {
|
|
489
|
-
writable: false
|
|
490
|
-
});
|
|
491
|
-
return Constructor;
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
495
|
-
if (!o) return;
|
|
496
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
497
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
498
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
499
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
500
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
function _arrayLikeToArray(arr, len) {
|
|
504
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
505
|
-
|
|
506
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
507
|
-
|
|
508
|
-
return arr2;
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
512
|
-
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
513
|
-
if (it) return (it = it.call(o)).next.bind(it);
|
|
514
|
-
|
|
515
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
516
|
-
if (it) o = it;
|
|
517
|
-
var i = 0;
|
|
518
|
-
return function () {
|
|
519
|
-
if (i >= o.length) return {
|
|
520
|
-
done: true
|
|
521
|
-
};
|
|
522
|
-
return {
|
|
523
|
-
done: false,
|
|
524
|
-
value: o[i++]
|
|
525
|
-
};
|
|
526
|
-
};
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
function getDefaults() {
|
|
533
|
-
return {
|
|
534
|
-
async: false,
|
|
535
|
-
baseUrl: null,
|
|
536
|
-
breaks: false,
|
|
537
|
-
extensions: null,
|
|
538
|
-
gfm: true,
|
|
539
|
-
headerIds: true,
|
|
540
|
-
headerPrefix: '',
|
|
541
|
-
highlight: null,
|
|
542
|
-
langPrefix: 'language-',
|
|
543
|
-
mangle: true,
|
|
544
|
-
pedantic: false,
|
|
545
|
-
renderer: null,
|
|
546
|
-
sanitize: false,
|
|
547
|
-
sanitizer: null,
|
|
548
|
-
silent: false,
|
|
549
|
-
smartypants: false,
|
|
550
|
-
tokenizer: null,
|
|
551
|
-
walkTokens: null,
|
|
552
|
-
xhtml: false
|
|
553
|
-
};
|
|
554
|
-
}
|
|
555
|
-
exports.defaults = getDefaults();
|
|
556
|
-
function changeDefaults(newDefaults) {
|
|
557
|
-
exports.defaults = newDefaults;
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
/**
|
|
561
|
-
* Helpers
|
|
562
|
-
*/
|
|
563
|
-
var escapeTest = /[&<>"']/;
|
|
564
|
-
var escapeReplace = /[&<>"']/g;
|
|
565
|
-
var escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/;
|
|
566
|
-
var escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g;
|
|
567
|
-
var escapeReplacements = {
|
|
568
|
-
'&': '&',
|
|
569
|
-
'<': '<',
|
|
570
|
-
'>': '>',
|
|
571
|
-
'"': '"',
|
|
572
|
-
"'": '''
|
|
573
|
-
};
|
|
574
|
-
|
|
575
|
-
var getEscapeReplacement = function getEscapeReplacement(ch) {
|
|
576
|
-
return escapeReplacements[ch];
|
|
577
|
-
};
|
|
578
|
-
|
|
579
|
-
function escape(html, encode) {
|
|
580
|
-
if (encode) {
|
|
581
|
-
if (escapeTest.test(html)) {
|
|
582
|
-
return html.replace(escapeReplace, getEscapeReplacement);
|
|
583
|
-
}
|
|
584
|
-
} else {
|
|
585
|
-
if (escapeTestNoEncode.test(html)) {
|
|
586
|
-
return html.replace(escapeReplaceNoEncode, getEscapeReplacement);
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
return html;
|
|
591
|
-
}
|
|
592
|
-
var unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
|
|
593
|
-
/**
|
|
594
|
-
* @param {string} html
|
|
595
|
-
*/
|
|
596
|
-
|
|
597
|
-
function unescape(html) {
|
|
598
|
-
// explicitly match decimal, hex, and named HTML entities
|
|
599
|
-
return html.replace(unescapeTest, function (_, n) {
|
|
600
|
-
n = n.toLowerCase();
|
|
601
|
-
if (n === 'colon') return ':';
|
|
602
|
-
|
|
603
|
-
if (n.charAt(0) === '#') {
|
|
604
|
-
return n.charAt(1) === 'x' ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1));
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
return '';
|
|
608
|
-
});
|
|
609
|
-
}
|
|
610
|
-
var caret = /(^|[^\[])\^/g;
|
|
611
|
-
/**
|
|
612
|
-
* @param {string | RegExp} regex
|
|
613
|
-
* @param {string} opt
|
|
614
|
-
*/
|
|
615
|
-
|
|
616
|
-
function edit(regex, opt) {
|
|
617
|
-
regex = typeof regex === 'string' ? regex : regex.source;
|
|
618
|
-
opt = opt || '';
|
|
619
|
-
var obj = {
|
|
620
|
-
replace: function replace(name, val) {
|
|
621
|
-
val = val.source || val;
|
|
622
|
-
val = val.replace(caret, '$1');
|
|
623
|
-
regex = regex.replace(name, val);
|
|
624
|
-
return obj;
|
|
625
|
-
},
|
|
626
|
-
getRegex: function getRegex() {
|
|
627
|
-
return new RegExp(regex, opt);
|
|
628
|
-
}
|
|
629
|
-
};
|
|
630
|
-
return obj;
|
|
631
|
-
}
|
|
632
|
-
var nonWordAndColonTest = /[^\w:]/g;
|
|
633
|
-
var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
|
|
634
|
-
/**
|
|
635
|
-
* @param {boolean} sanitize
|
|
636
|
-
* @param {string} base
|
|
637
|
-
* @param {string} href
|
|
638
|
-
*/
|
|
639
|
-
|
|
640
|
-
function cleanUrl(sanitize, base, href) {
|
|
641
|
-
if (sanitize) {
|
|
642
|
-
var prot;
|
|
643
|
-
|
|
644
|
-
try {
|
|
645
|
-
prot = decodeURIComponent(unescape(href)).replace(nonWordAndColonTest, '').toLowerCase();
|
|
646
|
-
} catch (e) {
|
|
647
|
-
return null;
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
|
|
651
|
-
return null;
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
if (base && !originIndependentUrl.test(href)) {
|
|
656
|
-
href = resolveUrl(base, href);
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
try {
|
|
660
|
-
href = encodeURI(href).replace(/%25/g, '%');
|
|
661
|
-
} catch (e) {
|
|
662
|
-
return null;
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
return href;
|
|
666
|
-
}
|
|
667
|
-
var baseUrls = {};
|
|
668
|
-
var justDomain = /^[^:]+:\/*[^/]*$/;
|
|
669
|
-
var protocol = /^([^:]+:)[\s\S]*$/;
|
|
670
|
-
var domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;
|
|
671
|
-
/**
|
|
672
|
-
* @param {string} base
|
|
673
|
-
* @param {string} href
|
|
674
|
-
*/
|
|
675
|
-
|
|
676
|
-
function resolveUrl(base, href) {
|
|
677
|
-
if (!baseUrls[' ' + base]) {
|
|
678
|
-
// we can ignore everything in base after the last slash of its path component,
|
|
679
|
-
// but we might need to add _that_
|
|
680
|
-
// https://tools.ietf.org/html/rfc3986#section-3
|
|
681
|
-
if (justDomain.test(base)) {
|
|
682
|
-
baseUrls[' ' + base] = base + '/';
|
|
683
|
-
} else {
|
|
684
|
-
baseUrls[' ' + base] = rtrim(base, '/', true);
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
base = baseUrls[' ' + base];
|
|
689
|
-
var relativeBase = base.indexOf(':') === -1;
|
|
690
|
-
|
|
691
|
-
if (href.substring(0, 2) === '//') {
|
|
692
|
-
if (relativeBase) {
|
|
693
|
-
return href;
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
return base.replace(protocol, '$1') + href;
|
|
697
|
-
} else if (href.charAt(0) === '/') {
|
|
698
|
-
if (relativeBase) {
|
|
699
|
-
return href;
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
return base.replace(domain, '$1') + href;
|
|
703
|
-
} else {
|
|
704
|
-
return base + href;
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
var noopTest = {
|
|
708
|
-
exec: function noopTest() {}
|
|
709
|
-
};
|
|
710
|
-
function merge(obj) {
|
|
711
|
-
var i = 1,
|
|
712
|
-
target,
|
|
713
|
-
key;
|
|
714
|
-
|
|
715
|
-
for (; i < arguments.length; i++) {
|
|
716
|
-
target = arguments[i];
|
|
717
|
-
|
|
718
|
-
for (key in target) {
|
|
719
|
-
if (Object.prototype.hasOwnProperty.call(target, key)) {
|
|
720
|
-
obj[key] = target[key];
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
return obj;
|
|
726
|
-
}
|
|
727
|
-
function splitCells(tableRow, count) {
|
|
728
|
-
// ensure that every cell-delimiting pipe has a space
|
|
729
|
-
// before it to distinguish it from an escaped pipe
|
|
730
|
-
var row = tableRow.replace(/\|/g, function (match, offset, str) {
|
|
731
|
-
var escaped = false,
|
|
732
|
-
curr = offset;
|
|
733
|
-
|
|
734
|
-
while (--curr >= 0 && str[curr] === '\\') {
|
|
735
|
-
escaped = !escaped;
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
if (escaped) {
|
|
739
|
-
// odd number of slashes means | is escaped
|
|
740
|
-
// so we leave it alone
|
|
741
|
-
return '|';
|
|
742
|
-
} else {
|
|
743
|
-
// add space before unescaped |
|
|
744
|
-
return ' |';
|
|
745
|
-
}
|
|
746
|
-
}),
|
|
747
|
-
cells = row.split(/ \|/);
|
|
748
|
-
var i = 0; // First/last cell in a row cannot be empty if it has no leading/trailing pipe
|
|
749
|
-
|
|
750
|
-
if (!cells[0].trim()) {
|
|
751
|
-
cells.shift();
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
if (cells.length > 0 && !cells[cells.length - 1].trim()) {
|
|
755
|
-
cells.pop();
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
if (cells.length > count) {
|
|
759
|
-
cells.splice(count);
|
|
760
|
-
} else {
|
|
761
|
-
while (cells.length < count) {
|
|
762
|
-
cells.push('');
|
|
763
|
-
}
|
|
764
|
-
}
|
|
765
|
-
|
|
766
|
-
for (; i < cells.length; i++) {
|
|
767
|
-
// leading or trailing whitespace is ignored per the gfm spec
|
|
768
|
-
cells[i] = cells[i].trim().replace(/\\\|/g, '|');
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
return cells;
|
|
772
|
-
}
|
|
773
|
-
/**
|
|
774
|
-
* Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').
|
|
775
|
-
* /c*$/ is vulnerable to REDOS.
|
|
776
|
-
*
|
|
777
|
-
* @param {string} str
|
|
778
|
-
* @param {string} c
|
|
779
|
-
* @param {boolean} invert Remove suffix of non-c chars instead. Default falsey.
|
|
780
|
-
*/
|
|
781
|
-
|
|
782
|
-
function rtrim(str, c, invert) {
|
|
783
|
-
var l = str.length;
|
|
784
|
-
|
|
785
|
-
if (l === 0) {
|
|
786
|
-
return '';
|
|
787
|
-
} // Length of suffix matching the invert condition.
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
var suffLen = 0; // Step left until we fail to match the invert condition.
|
|
791
|
-
|
|
792
|
-
while (suffLen < l) {
|
|
793
|
-
var currChar = str.charAt(l - suffLen - 1);
|
|
794
|
-
|
|
795
|
-
if (currChar === c && !invert) {
|
|
796
|
-
suffLen++;
|
|
797
|
-
} else if (currChar !== c && invert) {
|
|
798
|
-
suffLen++;
|
|
799
|
-
} else {
|
|
800
|
-
break;
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
return str.slice(0, l - suffLen);
|
|
805
|
-
}
|
|
806
|
-
function findClosingBracket(str, b) {
|
|
807
|
-
if (str.indexOf(b[1]) === -1) {
|
|
808
|
-
return -1;
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
var l = str.length;
|
|
812
|
-
var level = 0,
|
|
813
|
-
i = 0;
|
|
814
|
-
|
|
815
|
-
for (; i < l; i++) {
|
|
816
|
-
if (str[i] === '\\') {
|
|
817
|
-
i++;
|
|
818
|
-
} else if (str[i] === b[0]) {
|
|
819
|
-
level++;
|
|
820
|
-
} else if (str[i] === b[1]) {
|
|
821
|
-
level--;
|
|
822
|
-
|
|
823
|
-
if (level < 0) {
|
|
824
|
-
return i;
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
return -1;
|
|
830
|
-
}
|
|
831
|
-
function checkSanitizeDeprecation(opt) {
|
|
832
|
-
if (opt && opt.sanitize && !opt.silent) {
|
|
833
|
-
console.warn('marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options');
|
|
834
|
-
}
|
|
835
|
-
} // copied from https://stackoverflow.com/a/5450113/806777
|
|
836
|
-
|
|
837
|
-
/**
|
|
838
|
-
* @param {string} pattern
|
|
839
|
-
* @param {number} count
|
|
840
|
-
*/
|
|
841
|
-
|
|
842
|
-
function repeatString(pattern, count) {
|
|
843
|
-
if (count < 1) {
|
|
844
|
-
return '';
|
|
845
|
-
}
|
|
846
|
-
|
|
847
|
-
var result = '';
|
|
848
|
-
|
|
849
|
-
while (count > 1) {
|
|
850
|
-
if (count & 1) {
|
|
851
|
-
result += pattern;
|
|
852
|
-
}
|
|
853
|
-
|
|
854
|
-
count >>= 1;
|
|
855
|
-
pattern += pattern;
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
return result + pattern;
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
function outputLink(cap, link, raw, lexer) {
|
|
862
|
-
var href = link.href;
|
|
863
|
-
var title = link.title ? escape(link.title) : null;
|
|
864
|
-
var text = cap[1].replace(/\\([\[\]])/g, '$1');
|
|
865
|
-
|
|
866
|
-
if (cap[0].charAt(0) !== '!') {
|
|
867
|
-
lexer.state.inLink = true;
|
|
868
|
-
var token = {
|
|
869
|
-
type: 'link',
|
|
870
|
-
raw: raw,
|
|
871
|
-
href: href,
|
|
872
|
-
title: title,
|
|
873
|
-
text: text,
|
|
874
|
-
tokens: lexer.inlineTokens(text)
|
|
875
|
-
};
|
|
876
|
-
lexer.state.inLink = false;
|
|
877
|
-
return token;
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
return {
|
|
881
|
-
type: 'image',
|
|
882
|
-
raw: raw,
|
|
883
|
-
href: href,
|
|
884
|
-
title: title,
|
|
885
|
-
text: escape(text)
|
|
886
|
-
};
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
function indentCodeCompensation(raw, text) {
|
|
890
|
-
var matchIndentToCode = raw.match(/^(\s+)(?:```)/);
|
|
891
|
-
|
|
892
|
-
if (matchIndentToCode === null) {
|
|
893
|
-
return text;
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
var indentToCode = matchIndentToCode[1];
|
|
897
|
-
return text.split('\n').map(function (node) {
|
|
898
|
-
var matchIndentInNode = node.match(/^\s+/);
|
|
899
|
-
|
|
900
|
-
if (matchIndentInNode === null) {
|
|
901
|
-
return node;
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
var indentInNode = matchIndentInNode[0];
|
|
905
|
-
|
|
906
|
-
if (indentInNode.length >= indentToCode.length) {
|
|
907
|
-
return node.slice(indentToCode.length);
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
return node;
|
|
911
|
-
}).join('\n');
|
|
912
|
-
}
|
|
913
|
-
/**
|
|
914
|
-
* Tokenizer
|
|
915
|
-
*/
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
var Tokenizer = /*#__PURE__*/function () {
|
|
919
|
-
function Tokenizer(options) {
|
|
920
|
-
this.options = options || exports.defaults;
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
var _proto = Tokenizer.prototype;
|
|
924
|
-
|
|
925
|
-
_proto.space = function space(src) {
|
|
926
|
-
var cap = this.rules.block.newline.exec(src);
|
|
927
|
-
|
|
928
|
-
if (cap && cap[0].length > 0) {
|
|
929
|
-
return {
|
|
930
|
-
type: 'space',
|
|
931
|
-
raw: cap[0]
|
|
932
|
-
};
|
|
933
|
-
}
|
|
934
|
-
};
|
|
935
|
-
|
|
936
|
-
_proto.code = function code(src) {
|
|
937
|
-
var cap = this.rules.block.code.exec(src);
|
|
938
|
-
|
|
939
|
-
if (cap) {
|
|
940
|
-
var text = cap[0].replace(/^ {1,4}/gm, '');
|
|
941
|
-
return {
|
|
942
|
-
type: 'code',
|
|
943
|
-
raw: cap[0],
|
|
944
|
-
codeBlockStyle: 'indented',
|
|
945
|
-
text: !this.options.pedantic ? rtrim(text, '\n') : text
|
|
946
|
-
};
|
|
947
|
-
}
|
|
948
|
-
};
|
|
949
|
-
|
|
950
|
-
_proto.fences = function fences(src) {
|
|
951
|
-
var cap = this.rules.block.fences.exec(src);
|
|
952
|
-
|
|
953
|
-
if (cap) {
|
|
954
|
-
var raw = cap[0];
|
|
955
|
-
var text = indentCodeCompensation(raw, cap[3] || '');
|
|
956
|
-
return {
|
|
957
|
-
type: 'code',
|
|
958
|
-
raw: raw,
|
|
959
|
-
lang: cap[2] ? cap[2].trim() : cap[2],
|
|
960
|
-
text: text
|
|
961
|
-
};
|
|
962
|
-
}
|
|
963
|
-
};
|
|
964
|
-
|
|
965
|
-
_proto.heading = function heading(src) {
|
|
966
|
-
var cap = this.rules.block.heading.exec(src);
|
|
967
|
-
|
|
968
|
-
if (cap) {
|
|
969
|
-
var text = cap[2].trim(); // remove trailing #s
|
|
970
|
-
|
|
971
|
-
if (/#$/.test(text)) {
|
|
972
|
-
var trimmed = rtrim(text, '#');
|
|
973
|
-
|
|
974
|
-
if (this.options.pedantic) {
|
|
975
|
-
text = trimmed.trim();
|
|
976
|
-
} else if (!trimmed || / $/.test(trimmed)) {
|
|
977
|
-
// CommonMark requires space before trailing #s
|
|
978
|
-
text = trimmed.trim();
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
|
|
982
|
-
return {
|
|
983
|
-
type: 'heading',
|
|
984
|
-
raw: cap[0],
|
|
985
|
-
depth: cap[1].length,
|
|
986
|
-
text: text,
|
|
987
|
-
tokens: this.lexer.inline(text)
|
|
988
|
-
};
|
|
989
|
-
}
|
|
990
|
-
};
|
|
991
|
-
|
|
992
|
-
_proto.hr = function hr(src) {
|
|
993
|
-
var cap = this.rules.block.hr.exec(src);
|
|
994
|
-
|
|
995
|
-
if (cap) {
|
|
996
|
-
return {
|
|
997
|
-
type: 'hr',
|
|
998
|
-
raw: cap[0]
|
|
999
|
-
};
|
|
1000
|
-
}
|
|
1001
|
-
};
|
|
1002
|
-
|
|
1003
|
-
_proto.blockquote = function blockquote(src) {
|
|
1004
|
-
var cap = this.rules.block.blockquote.exec(src);
|
|
1005
|
-
|
|
1006
|
-
if (cap) {
|
|
1007
|
-
var text = cap[0].replace(/^ *>[ \t]?/gm, '');
|
|
1008
|
-
return {
|
|
1009
|
-
type: 'blockquote',
|
|
1010
|
-
raw: cap[0],
|
|
1011
|
-
tokens: this.lexer.blockTokens(text, []),
|
|
1012
|
-
text: text
|
|
1013
|
-
};
|
|
1014
|
-
}
|
|
1015
|
-
};
|
|
1016
|
-
|
|
1017
|
-
_proto.list = function list(src) {
|
|
1018
|
-
var cap = this.rules.block.list.exec(src);
|
|
1019
|
-
|
|
1020
|
-
if (cap) {
|
|
1021
|
-
var raw, istask, ischecked, indent, i, blankLine, endsWithBlankLine, line, nextLine, rawLine, itemContents, endEarly;
|
|
1022
|
-
var bull = cap[1].trim();
|
|
1023
|
-
var isordered = bull.length > 1;
|
|
1024
|
-
var list = {
|
|
1025
|
-
type: 'list',
|
|
1026
|
-
raw: '',
|
|
1027
|
-
ordered: isordered,
|
|
1028
|
-
start: isordered ? +bull.slice(0, -1) : '',
|
|
1029
|
-
loose: false,
|
|
1030
|
-
items: []
|
|
1031
|
-
};
|
|
1032
|
-
bull = isordered ? "\\d{1,9}\\" + bull.slice(-1) : "\\" + bull;
|
|
1033
|
-
|
|
1034
|
-
if (this.options.pedantic) {
|
|
1035
|
-
bull = isordered ? bull : '[*+-]';
|
|
1036
|
-
} // Get next list item
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
var itemRegex = new RegExp("^( {0,3}" + bull + ")((?:[\t ][^\\n]*)?(?:\\n|$))"); // Check if current bullet point can start a new List Item
|
|
1040
|
-
|
|
1041
|
-
while (src) {
|
|
1042
|
-
endEarly = false;
|
|
1043
|
-
|
|
1044
|
-
if (!(cap = itemRegex.exec(src))) {
|
|
1045
|
-
break;
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
if (this.rules.block.hr.test(src)) {
|
|
1049
|
-
// End list if bullet was actually HR (possibly move into itemRegex?)
|
|
1050
|
-
break;
|
|
1051
|
-
}
|
|
1052
|
-
|
|
1053
|
-
raw = cap[0];
|
|
1054
|
-
src = src.substring(raw.length);
|
|
1055
|
-
line = cap[2].split('\n', 1)[0];
|
|
1056
|
-
nextLine = src.split('\n', 1)[0];
|
|
1057
|
-
|
|
1058
|
-
if (this.options.pedantic) {
|
|
1059
|
-
indent = 2;
|
|
1060
|
-
itemContents = line.trimLeft();
|
|
1061
|
-
} else {
|
|
1062
|
-
indent = cap[2].search(/[^ ]/); // Find first non-space char
|
|
1063
|
-
|
|
1064
|
-
indent = indent > 4 ? 1 : indent; // Treat indented code blocks (> 4 spaces) as having only 1 indent
|
|
1065
|
-
|
|
1066
|
-
itemContents = line.slice(indent);
|
|
1067
|
-
indent += cap[1].length;
|
|
1068
|
-
}
|
|
1069
|
-
|
|
1070
|
-
blankLine = false;
|
|
1071
|
-
|
|
1072
|
-
if (!line && /^ *$/.test(nextLine)) {
|
|
1073
|
-
// Items begin with at most one blank line
|
|
1074
|
-
raw += nextLine + '\n';
|
|
1075
|
-
src = src.substring(nextLine.length + 1);
|
|
1076
|
-
endEarly = true;
|
|
1077
|
-
}
|
|
1078
|
-
|
|
1079
|
-
if (!endEarly) {
|
|
1080
|
-
var nextBulletRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}(?:[*+-]|\\d{1,9}[.)])((?: [^\\n]*)?(?:\\n|$))");
|
|
1081
|
-
var hrRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)");
|
|
1082
|
-
var fencesBeginRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}(?:```|~~~)");
|
|
1083
|
-
var headingBeginRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}#"); // Check if following lines should be included in List Item
|
|
1084
|
-
|
|
1085
|
-
while (src) {
|
|
1086
|
-
rawLine = src.split('\n', 1)[0];
|
|
1087
|
-
line = rawLine; // Re-align to follow commonmark nesting rules
|
|
1088
|
-
|
|
1089
|
-
if (this.options.pedantic) {
|
|
1090
|
-
line = line.replace(/^ {1,4}(?=( {4})*[^ ])/g, ' ');
|
|
1091
|
-
} // End list item if found code fences
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
if (fencesBeginRegex.test(line)) {
|
|
1095
|
-
break;
|
|
1096
|
-
} // End list item if found start of new heading
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
if (headingBeginRegex.test(line)) {
|
|
1100
|
-
break;
|
|
1101
|
-
} // End list item if found start of new bullet
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
if (nextBulletRegex.test(line)) {
|
|
1105
|
-
break;
|
|
1106
|
-
} // Horizontal rule found
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
if (hrRegex.test(src)) {
|
|
1110
|
-
break;
|
|
1111
|
-
}
|
|
1112
|
-
|
|
1113
|
-
if (line.search(/[^ ]/) >= indent || !line.trim()) {
|
|
1114
|
-
// Dedent if possible
|
|
1115
|
-
itemContents += '\n' + line.slice(indent);
|
|
1116
|
-
} else if (!blankLine) {
|
|
1117
|
-
// Until blank line, item doesn't need indentation
|
|
1118
|
-
itemContents += '\n' + line;
|
|
1119
|
-
} else {
|
|
1120
|
-
// Otherwise, improper indentation ends this item
|
|
1121
|
-
break;
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
if (!blankLine && !line.trim()) {
|
|
1125
|
-
// Check if current line is blank
|
|
1126
|
-
blankLine = true;
|
|
1127
|
-
}
|
|
1128
|
-
|
|
1129
|
-
raw += rawLine + '\n';
|
|
1130
|
-
src = src.substring(rawLine.length + 1);
|
|
1131
|
-
}
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
if (!list.loose) {
|
|
1135
|
-
// If the previous item ended with a blank line, the list is loose
|
|
1136
|
-
if (endsWithBlankLine) {
|
|
1137
|
-
list.loose = true;
|
|
1138
|
-
} else if (/\n *\n *$/.test(raw)) {
|
|
1139
|
-
endsWithBlankLine = true;
|
|
1140
|
-
}
|
|
1141
|
-
} // Check for task list items
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
if (this.options.gfm) {
|
|
1145
|
-
istask = /^\[[ xX]\] /.exec(itemContents);
|
|
1146
|
-
|
|
1147
|
-
if (istask) {
|
|
1148
|
-
ischecked = istask[0] !== '[ ] ';
|
|
1149
|
-
itemContents = itemContents.replace(/^\[[ xX]\] +/, '');
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
|
|
1153
|
-
list.items.push({
|
|
1154
|
-
type: 'list_item',
|
|
1155
|
-
raw: raw,
|
|
1156
|
-
task: !!istask,
|
|
1157
|
-
checked: ischecked,
|
|
1158
|
-
loose: false,
|
|
1159
|
-
text: itemContents
|
|
1160
|
-
});
|
|
1161
|
-
list.raw += raw;
|
|
1162
|
-
} // Do not consume newlines at end of final item. Alternatively, make itemRegex *start* with any newlines to simplify/speed up endsWithBlankLine logic
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
list.items[list.items.length - 1].raw = raw.trimRight();
|
|
1166
|
-
list.items[list.items.length - 1].text = itemContents.trimRight();
|
|
1167
|
-
list.raw = list.raw.trimRight();
|
|
1168
|
-
var l = list.items.length; // Item child tokens handled here at end because we needed to have the final item to trim it first
|
|
1169
|
-
|
|
1170
|
-
for (i = 0; i < l; i++) {
|
|
1171
|
-
this.lexer.state.top = false;
|
|
1172
|
-
list.items[i].tokens = this.lexer.blockTokens(list.items[i].text, []);
|
|
1173
|
-
var spacers = list.items[i].tokens.filter(function (t) {
|
|
1174
|
-
return t.type === 'space';
|
|
1175
|
-
});
|
|
1176
|
-
var hasMultipleLineBreaks = spacers.every(function (t) {
|
|
1177
|
-
var chars = t.raw.split('');
|
|
1178
|
-
var lineBreaks = 0;
|
|
1179
|
-
|
|
1180
|
-
for (var _iterator = _createForOfIteratorHelperLoose(chars), _step; !(_step = _iterator()).done;) {
|
|
1181
|
-
var _char = _step.value;
|
|
1182
|
-
|
|
1183
|
-
if (_char === '\n') {
|
|
1184
|
-
lineBreaks += 1;
|
|
1185
|
-
}
|
|
1186
|
-
|
|
1187
|
-
if (lineBreaks > 1) {
|
|
1188
|
-
return true;
|
|
1189
|
-
}
|
|
1190
|
-
}
|
|
1191
|
-
|
|
1192
|
-
return false;
|
|
1193
|
-
});
|
|
1194
|
-
|
|
1195
|
-
if (!list.loose && spacers.length && hasMultipleLineBreaks) {
|
|
1196
|
-
// Having a single line break doesn't mean a list is loose. A single line break is terminating the last list item
|
|
1197
|
-
list.loose = true;
|
|
1198
|
-
list.items[i].loose = true;
|
|
1199
|
-
}
|
|
1200
|
-
}
|
|
1201
|
-
|
|
1202
|
-
return list;
|
|
1203
|
-
}
|
|
1204
|
-
};
|
|
1205
|
-
|
|
1206
|
-
_proto.html = function html(src) {
|
|
1207
|
-
var cap = this.rules.block.html.exec(src);
|
|
1208
|
-
|
|
1209
|
-
if (cap) {
|
|
1210
|
-
var token = {
|
|
1211
|
-
type: 'html',
|
|
1212
|
-
raw: cap[0],
|
|
1213
|
-
pre: !this.options.sanitizer && (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'),
|
|
1214
|
-
text: cap[0]
|
|
1215
|
-
};
|
|
1216
|
-
|
|
1217
|
-
if (this.options.sanitize) {
|
|
1218
|
-
var text = this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]);
|
|
1219
|
-
token.type = 'paragraph';
|
|
1220
|
-
token.text = text;
|
|
1221
|
-
token.tokens = this.lexer.inline(text);
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
|
-
return token;
|
|
1225
|
-
}
|
|
1226
|
-
};
|
|
1227
|
-
|
|
1228
|
-
_proto.def = function def(src) {
|
|
1229
|
-
var cap = this.rules.block.def.exec(src);
|
|
1230
|
-
|
|
1231
|
-
if (cap) {
|
|
1232
|
-
if (cap[3]) cap[3] = cap[3].substring(1, cap[3].length - 1);
|
|
1233
|
-
var tag = cap[1].toLowerCase().replace(/\s+/g, ' ');
|
|
1234
|
-
return {
|
|
1235
|
-
type: 'def',
|
|
1236
|
-
tag: tag,
|
|
1237
|
-
raw: cap[0],
|
|
1238
|
-
href: cap[2],
|
|
1239
|
-
title: cap[3]
|
|
1240
|
-
};
|
|
1241
|
-
}
|
|
1242
|
-
};
|
|
1243
|
-
|
|
1244
|
-
_proto.table = function table(src) {
|
|
1245
|
-
var cap = this.rules.block.table.exec(src);
|
|
1246
|
-
|
|
1247
|
-
if (cap) {
|
|
1248
|
-
var item = {
|
|
1249
|
-
type: 'table',
|
|
1250
|
-
header: splitCells(cap[1]).map(function (c) {
|
|
1251
|
-
return {
|
|
1252
|
-
text: c
|
|
1253
|
-
};
|
|
1254
|
-
}),
|
|
1255
|
-
align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
|
|
1256
|
-
rows: cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, '').split('\n') : []
|
|
1257
|
-
};
|
|
1258
|
-
|
|
1259
|
-
if (item.header.length === item.align.length) {
|
|
1260
|
-
item.raw = cap[0];
|
|
1261
|
-
var l = item.align.length;
|
|
1262
|
-
var i, j, k, row;
|
|
1263
|
-
|
|
1264
|
-
for (i = 0; i < l; i++) {
|
|
1265
|
-
if (/^ *-+: *$/.test(item.align[i])) {
|
|
1266
|
-
item.align[i] = 'right';
|
|
1267
|
-
} else if (/^ *:-+: *$/.test(item.align[i])) {
|
|
1268
|
-
item.align[i] = 'center';
|
|
1269
|
-
} else if (/^ *:-+ *$/.test(item.align[i])) {
|
|
1270
|
-
item.align[i] = 'left';
|
|
1271
|
-
} else {
|
|
1272
|
-
item.align[i] = null;
|
|
1273
|
-
}
|
|
1274
|
-
}
|
|
1275
|
-
|
|
1276
|
-
l = item.rows.length;
|
|
1277
|
-
|
|
1278
|
-
for (i = 0; i < l; i++) {
|
|
1279
|
-
item.rows[i] = splitCells(item.rows[i], item.header.length).map(function (c) {
|
|
1280
|
-
return {
|
|
1281
|
-
text: c
|
|
1282
|
-
};
|
|
1283
|
-
});
|
|
1284
|
-
} // parse child tokens inside headers and cells
|
|
1285
|
-
// header child tokens
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
l = item.header.length;
|
|
1289
|
-
|
|
1290
|
-
for (j = 0; j < l; j++) {
|
|
1291
|
-
item.header[j].tokens = this.lexer.inline(item.header[j].text);
|
|
1292
|
-
} // cell child tokens
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
l = item.rows.length;
|
|
1296
|
-
|
|
1297
|
-
for (j = 0; j < l; j++) {
|
|
1298
|
-
row = item.rows[j];
|
|
1299
|
-
|
|
1300
|
-
for (k = 0; k < row.length; k++) {
|
|
1301
|
-
row[k].tokens = this.lexer.inline(row[k].text);
|
|
1302
|
-
}
|
|
1303
|
-
}
|
|
1304
|
-
|
|
1305
|
-
return item;
|
|
1306
|
-
}
|
|
1307
|
-
}
|
|
1308
|
-
};
|
|
1309
|
-
|
|
1310
|
-
_proto.lheading = function lheading(src) {
|
|
1311
|
-
var cap = this.rules.block.lheading.exec(src);
|
|
1312
|
-
|
|
1313
|
-
if (cap) {
|
|
1314
|
-
return {
|
|
1315
|
-
type: 'heading',
|
|
1316
|
-
raw: cap[0],
|
|
1317
|
-
depth: cap[2].charAt(0) === '=' ? 1 : 2,
|
|
1318
|
-
text: cap[1],
|
|
1319
|
-
tokens: this.lexer.inline(cap[1])
|
|
1320
|
-
};
|
|
1321
|
-
}
|
|
1322
|
-
};
|
|
1323
|
-
|
|
1324
|
-
_proto.paragraph = function paragraph(src) {
|
|
1325
|
-
var cap = this.rules.block.paragraph.exec(src);
|
|
1326
|
-
|
|
1327
|
-
if (cap) {
|
|
1328
|
-
var text = cap[1].charAt(cap[1].length - 1) === '\n' ? cap[1].slice(0, -1) : cap[1];
|
|
1329
|
-
return {
|
|
1330
|
-
type: 'paragraph',
|
|
1331
|
-
raw: cap[0],
|
|
1332
|
-
text: text,
|
|
1333
|
-
tokens: this.lexer.inline(text)
|
|
1334
|
-
};
|
|
1335
|
-
}
|
|
1336
|
-
};
|
|
1337
|
-
|
|
1338
|
-
_proto.text = function text(src) {
|
|
1339
|
-
var cap = this.rules.block.text.exec(src);
|
|
1340
|
-
|
|
1341
|
-
if (cap) {
|
|
1342
|
-
return {
|
|
1343
|
-
type: 'text',
|
|
1344
|
-
raw: cap[0],
|
|
1345
|
-
text: cap[0],
|
|
1346
|
-
tokens: this.lexer.inline(cap[0])
|
|
1347
|
-
};
|
|
1348
|
-
}
|
|
1349
|
-
};
|
|
1350
|
-
|
|
1351
|
-
_proto.escape = function escape$1(src) {
|
|
1352
|
-
var cap = this.rules.inline.escape.exec(src);
|
|
1353
|
-
|
|
1354
|
-
if (cap) {
|
|
1355
|
-
return {
|
|
1356
|
-
type: 'escape',
|
|
1357
|
-
raw: cap[0],
|
|
1358
|
-
text: escape(cap[1])
|
|
1359
|
-
};
|
|
1360
|
-
}
|
|
1361
|
-
};
|
|
1362
|
-
|
|
1363
|
-
_proto.tag = function tag(src) {
|
|
1364
|
-
var cap = this.rules.inline.tag.exec(src);
|
|
1365
|
-
|
|
1366
|
-
if (cap) {
|
|
1367
|
-
if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) {
|
|
1368
|
-
this.lexer.state.inLink = true;
|
|
1369
|
-
} else if (this.lexer.state.inLink && /^<\/a>/i.test(cap[0])) {
|
|
1370
|
-
this.lexer.state.inLink = false;
|
|
1371
|
-
}
|
|
1372
|
-
|
|
1373
|
-
if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
|
|
1374
|
-
this.lexer.state.inRawBlock = true;
|
|
1375
|
-
} else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
|
|
1376
|
-
this.lexer.state.inRawBlock = false;
|
|
1377
|
-
}
|
|
1378
|
-
|
|
1379
|
-
return {
|
|
1380
|
-
type: this.options.sanitize ? 'text' : 'html',
|
|
1381
|
-
raw: cap[0],
|
|
1382
|
-
inLink: this.lexer.state.inLink,
|
|
1383
|
-
inRawBlock: this.lexer.state.inRawBlock,
|
|
1384
|
-
text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]) : cap[0]
|
|
1385
|
-
};
|
|
1386
|
-
}
|
|
1387
|
-
};
|
|
1388
|
-
|
|
1389
|
-
_proto.link = function link(src) {
|
|
1390
|
-
var cap = this.rules.inline.link.exec(src);
|
|
1391
|
-
|
|
1392
|
-
if (cap) {
|
|
1393
|
-
var trimmedUrl = cap[2].trim();
|
|
1394
|
-
|
|
1395
|
-
if (!this.options.pedantic && /^</.test(trimmedUrl)) {
|
|
1396
|
-
// commonmark requires matching angle brackets
|
|
1397
|
-
if (!/>$/.test(trimmedUrl)) {
|
|
1398
|
-
return;
|
|
1399
|
-
} // ending angle bracket cannot be escaped
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
var rtrimSlash = rtrim(trimmedUrl.slice(0, -1), '\\');
|
|
1403
|
-
|
|
1404
|
-
if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
|
|
1405
|
-
return;
|
|
1406
|
-
}
|
|
1407
|
-
} else {
|
|
1408
|
-
// find closing parenthesis
|
|
1409
|
-
var lastParenIndex = findClosingBracket(cap[2], '()');
|
|
1410
|
-
|
|
1411
|
-
if (lastParenIndex > -1) {
|
|
1412
|
-
var start = cap[0].indexOf('!') === 0 ? 5 : 4;
|
|
1413
|
-
var linkLen = start + cap[1].length + lastParenIndex;
|
|
1414
|
-
cap[2] = cap[2].substring(0, lastParenIndex);
|
|
1415
|
-
cap[0] = cap[0].substring(0, linkLen).trim();
|
|
1416
|
-
cap[3] = '';
|
|
1417
|
-
}
|
|
1418
|
-
}
|
|
1419
|
-
|
|
1420
|
-
var href = cap[2];
|
|
1421
|
-
var title = '';
|
|
1422
|
-
|
|
1423
|
-
if (this.options.pedantic) {
|
|
1424
|
-
// split pedantic href and title
|
|
1425
|
-
var link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
|
|
1426
|
-
|
|
1427
|
-
if (link) {
|
|
1428
|
-
href = link[1];
|
|
1429
|
-
title = link[3];
|
|
1430
|
-
}
|
|
1431
|
-
} else {
|
|
1432
|
-
title = cap[3] ? cap[3].slice(1, -1) : '';
|
|
1433
|
-
}
|
|
1434
|
-
|
|
1435
|
-
href = href.trim();
|
|
1436
|
-
|
|
1437
|
-
if (/^</.test(href)) {
|
|
1438
|
-
if (this.options.pedantic && !/>$/.test(trimmedUrl)) {
|
|
1439
|
-
// pedantic allows starting angle bracket without ending angle bracket
|
|
1440
|
-
href = href.slice(1);
|
|
1441
|
-
} else {
|
|
1442
|
-
href = href.slice(1, -1);
|
|
1443
|
-
}
|
|
1444
|
-
}
|
|
1445
|
-
|
|
1446
|
-
return outputLink(cap, {
|
|
1447
|
-
href: href ? href.replace(this.rules.inline._escapes, '$1') : href,
|
|
1448
|
-
title: title ? title.replace(this.rules.inline._escapes, '$1') : title
|
|
1449
|
-
}, cap[0], this.lexer);
|
|
1450
|
-
}
|
|
1451
|
-
};
|
|
1452
|
-
|
|
1453
|
-
_proto.reflink = function reflink(src, links) {
|
|
1454
|
-
var cap;
|
|
1455
|
-
|
|
1456
|
-
if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
|
|
1457
|
-
var link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
|
|
1458
|
-
link = links[link.toLowerCase()];
|
|
1459
|
-
|
|
1460
|
-
if (!link || !link.href) {
|
|
1461
|
-
var text = cap[0].charAt(0);
|
|
1462
|
-
return {
|
|
1463
|
-
type: 'text',
|
|
1464
|
-
raw: text,
|
|
1465
|
-
text: text
|
|
1466
|
-
};
|
|
1467
|
-
}
|
|
1468
|
-
|
|
1469
|
-
return outputLink(cap, link, cap[0], this.lexer);
|
|
1470
|
-
}
|
|
1471
|
-
};
|
|
1472
|
-
|
|
1473
|
-
_proto.emStrong = function emStrong(src, maskedSrc, prevChar) {
|
|
1474
|
-
if (prevChar === void 0) {
|
|
1475
|
-
prevChar = '';
|
|
1476
|
-
}
|
|
1477
|
-
|
|
1478
|
-
var match = this.rules.inline.emStrong.lDelim.exec(src);
|
|
1479
|
-
if (!match) return; // _ can't be between two alphanumerics. \p{L}\p{N} includes non-english alphabet/numbers as well
|
|
1480
|
-
|
|
1481
|
-
if (match[3] && prevChar.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDF70-\uDF81\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/)) return;
|
|
1482
|
-
var nextChar = match[1] || match[2] || '';
|
|
1483
|
-
|
|
1484
|
-
if (!nextChar || nextChar && (prevChar === '' || this.rules.inline.punctuation.exec(prevChar))) {
|
|
1485
|
-
var lLength = match[0].length - 1;
|
|
1486
|
-
var rDelim,
|
|
1487
|
-
rLength,
|
|
1488
|
-
delimTotal = lLength,
|
|
1489
|
-
midDelimTotal = 0;
|
|
1490
|
-
var endReg = match[0][0] === '*' ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
|
|
1491
|
-
endReg.lastIndex = 0; // Clip maskedSrc to same section of string as src (move to lexer?)
|
|
1492
|
-
|
|
1493
|
-
maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
|
|
1494
|
-
|
|
1495
|
-
while ((match = endReg.exec(maskedSrc)) != null) {
|
|
1496
|
-
rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
|
|
1497
|
-
if (!rDelim) continue; // skip single * in __abc*abc__
|
|
1498
|
-
|
|
1499
|
-
rLength = rDelim.length;
|
|
1500
|
-
|
|
1501
|
-
if (match[3] || match[4]) {
|
|
1502
|
-
// found another Left Delim
|
|
1503
|
-
delimTotal += rLength;
|
|
1504
|
-
continue;
|
|
1505
|
-
} else if (match[5] || match[6]) {
|
|
1506
|
-
// either Left or Right Delim
|
|
1507
|
-
if (lLength % 3 && !((lLength + rLength) % 3)) {
|
|
1508
|
-
midDelimTotal += rLength;
|
|
1509
|
-
continue; // CommonMark Emphasis Rules 9-10
|
|
1510
|
-
}
|
|
1511
|
-
}
|
|
1512
|
-
|
|
1513
|
-
delimTotal -= rLength;
|
|
1514
|
-
if (delimTotal > 0) continue; // Haven't found enough closing delimiters
|
|
1515
|
-
// Remove extra characters. *a*** -> *a*
|
|
1516
|
-
|
|
1517
|
-
rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal); // Create `em` if smallest delimiter has odd char count. *a***
|
|
1518
|
-
|
|
1519
|
-
if (Math.min(lLength, rLength) % 2) {
|
|
1520
|
-
var _text = src.slice(1, lLength + match.index + rLength);
|
|
1521
|
-
|
|
1522
|
-
return {
|
|
1523
|
-
type: 'em',
|
|
1524
|
-
raw: src.slice(0, lLength + match.index + rLength + 1),
|
|
1525
|
-
text: _text,
|
|
1526
|
-
tokens: this.lexer.inlineTokens(_text)
|
|
1527
|
-
};
|
|
1528
|
-
} // Create 'strong' if smallest delimiter has even char count. **a***
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
var text = src.slice(2, lLength + match.index + rLength - 1);
|
|
1532
|
-
return {
|
|
1533
|
-
type: 'strong',
|
|
1534
|
-
raw: src.slice(0, lLength + match.index + rLength + 1),
|
|
1535
|
-
text: text,
|
|
1536
|
-
tokens: this.lexer.inlineTokens(text)
|
|
1537
|
-
};
|
|
1538
|
-
}
|
|
1539
|
-
}
|
|
1540
|
-
};
|
|
1541
|
-
|
|
1542
|
-
_proto.codespan = function codespan(src) {
|
|
1543
|
-
var cap = this.rules.inline.code.exec(src);
|
|
1544
|
-
|
|
1545
|
-
if (cap) {
|
|
1546
|
-
var text = cap[2].replace(/\n/g, ' ');
|
|
1547
|
-
var hasNonSpaceChars = /[^ ]/.test(text);
|
|
1548
|
-
var hasSpaceCharsOnBothEnds = /^ /.test(text) && / $/.test(text);
|
|
1549
|
-
|
|
1550
|
-
if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
|
|
1551
|
-
text = text.substring(1, text.length - 1);
|
|
1552
|
-
}
|
|
1553
|
-
|
|
1554
|
-
text = escape(text, true);
|
|
1555
|
-
return {
|
|
1556
|
-
type: 'codespan',
|
|
1557
|
-
raw: cap[0],
|
|
1558
|
-
text: text
|
|
1559
|
-
};
|
|
1560
|
-
}
|
|
1561
|
-
};
|
|
1562
|
-
|
|
1563
|
-
_proto.br = function br(src) {
|
|
1564
|
-
var cap = this.rules.inline.br.exec(src);
|
|
1565
|
-
|
|
1566
|
-
if (cap) {
|
|
1567
|
-
return {
|
|
1568
|
-
type: 'br',
|
|
1569
|
-
raw: cap[0]
|
|
1570
|
-
};
|
|
1571
|
-
}
|
|
1572
|
-
};
|
|
1573
|
-
|
|
1574
|
-
_proto.del = function del(src) {
|
|
1575
|
-
var cap = this.rules.inline.del.exec(src);
|
|
1576
|
-
|
|
1577
|
-
if (cap) {
|
|
1578
|
-
return {
|
|
1579
|
-
type: 'del',
|
|
1580
|
-
raw: cap[0],
|
|
1581
|
-
text: cap[2],
|
|
1582
|
-
tokens: this.lexer.inlineTokens(cap[2])
|
|
1583
|
-
};
|
|
1584
|
-
}
|
|
1585
|
-
};
|
|
1586
|
-
|
|
1587
|
-
_proto.autolink = function autolink(src, mangle) {
|
|
1588
|
-
var cap = this.rules.inline.autolink.exec(src);
|
|
1589
|
-
|
|
1590
|
-
if (cap) {
|
|
1591
|
-
var text, href;
|
|
1592
|
-
|
|
1593
|
-
if (cap[2] === '@') {
|
|
1594
|
-
text = escape(this.options.mangle ? mangle(cap[1]) : cap[1]);
|
|
1595
|
-
href = 'mailto:' + text;
|
|
1596
|
-
} else {
|
|
1597
|
-
text = escape(cap[1]);
|
|
1598
|
-
href = text;
|
|
1599
|
-
}
|
|
1600
|
-
|
|
1601
|
-
return {
|
|
1602
|
-
type: 'link',
|
|
1603
|
-
raw: cap[0],
|
|
1604
|
-
text: text,
|
|
1605
|
-
href: href,
|
|
1606
|
-
tokens: [{
|
|
1607
|
-
type: 'text',
|
|
1608
|
-
raw: text,
|
|
1609
|
-
text: text
|
|
1610
|
-
}]
|
|
1611
|
-
};
|
|
1612
|
-
}
|
|
1613
|
-
};
|
|
1614
|
-
|
|
1615
|
-
_proto.url = function url(src, mangle) {
|
|
1616
|
-
var cap;
|
|
1617
|
-
|
|
1618
|
-
if (cap = this.rules.inline.url.exec(src)) {
|
|
1619
|
-
var text, href;
|
|
1620
|
-
|
|
1621
|
-
if (cap[2] === '@') {
|
|
1622
|
-
text = escape(this.options.mangle ? mangle(cap[0]) : cap[0]);
|
|
1623
|
-
href = 'mailto:' + text;
|
|
1624
|
-
} else {
|
|
1625
|
-
// do extended autolink path validation
|
|
1626
|
-
var prevCapZero;
|
|
1627
|
-
|
|
1628
|
-
do {
|
|
1629
|
-
prevCapZero = cap[0];
|
|
1630
|
-
cap[0] = this.rules.inline._backpedal.exec(cap[0])[0];
|
|
1631
|
-
} while (prevCapZero !== cap[0]);
|
|
1632
|
-
|
|
1633
|
-
text = escape(cap[0]);
|
|
1634
|
-
|
|
1635
|
-
if (cap[1] === 'www.') {
|
|
1636
|
-
href = 'http://' + text;
|
|
1637
|
-
} else {
|
|
1638
|
-
href = text;
|
|
1639
|
-
}
|
|
1640
|
-
}
|
|
1641
|
-
|
|
1642
|
-
return {
|
|
1643
|
-
type: 'link',
|
|
1644
|
-
raw: cap[0],
|
|
1645
|
-
text: text,
|
|
1646
|
-
href: href,
|
|
1647
|
-
tokens: [{
|
|
1648
|
-
type: 'text',
|
|
1649
|
-
raw: text,
|
|
1650
|
-
text: text
|
|
1651
|
-
}]
|
|
1652
|
-
};
|
|
1653
|
-
}
|
|
1654
|
-
};
|
|
1655
|
-
|
|
1656
|
-
_proto.inlineText = function inlineText(src, smartypants) {
|
|
1657
|
-
var cap = this.rules.inline.text.exec(src);
|
|
1658
|
-
|
|
1659
|
-
if (cap) {
|
|
1660
|
-
var text;
|
|
1661
|
-
|
|
1662
|
-
if (this.lexer.state.inRawBlock) {
|
|
1663
|
-
text = this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]) : cap[0];
|
|
1664
|
-
} else {
|
|
1665
|
-
text = escape(this.options.smartypants ? smartypants(cap[0]) : cap[0]);
|
|
1666
|
-
}
|
|
1667
|
-
|
|
1668
|
-
return {
|
|
1669
|
-
type: 'text',
|
|
1670
|
-
raw: cap[0],
|
|
1671
|
-
text: text
|
|
1672
|
-
};
|
|
1673
|
-
}
|
|
1674
|
-
};
|
|
1675
|
-
|
|
1676
|
-
return Tokenizer;
|
|
1677
|
-
}();
|
|
1678
|
-
|
|
1679
|
-
/**
|
|
1680
|
-
* Block-Level Grammar
|
|
1681
|
-
*/
|
|
1682
|
-
|
|
1683
|
-
var block = {
|
|
1684
|
-
newline: /^(?: *(?:\n|$))+/,
|
|
1685
|
-
code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
|
|
1686
|
-
fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
|
|
1687
|
-
hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
|
|
1688
|
-
heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
|
|
1689
|
-
blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
|
|
1690
|
-
list: /^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,
|
|
1691
|
-
html: '^ {0,3}(?:' // optional indentation
|
|
1692
|
-
+ '<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
|
|
1693
|
-
+ '|comment[^\\n]*(\\n+|$)' // (2)
|
|
1694
|
-
+ '|<\\?[\\s\\S]*?(?:\\?>\\n*|$)' // (3)
|
|
1695
|
-
+ '|<![A-Z][\\s\\S]*?(?:>\\n*|$)' // (4)
|
|
1696
|
-
+ '|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)' // (5)
|
|
1697
|
-
+ '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (6)
|
|
1698
|
-
+ '|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) open tag
|
|
1699
|
-
+ '|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) closing tag
|
|
1700
|
-
+ ')',
|
|
1701
|
-
def: /^ {0,3}\[(label)\]: *(?:\n *)?<?([^\s>]+)>?(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
|
|
1702
|
-
table: noopTest,
|
|
1703
|
-
lheading: /^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
1704
|
-
// regex template, placeholders will be replaced according to different paragraph
|
|
1705
|
-
// interruption rules of commonmark and the original markdown spec:
|
|
1706
|
-
_paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
|
|
1707
|
-
text: /^[^\n]+/
|
|
1708
|
-
};
|
|
1709
|
-
block._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
|
|
1710
|
-
block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
|
|
1711
|
-
block.def = edit(block.def).replace('label', block._label).replace('title', block._title).getRegex();
|
|
1712
|
-
block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
|
|
1713
|
-
block.listItemStart = edit(/^( *)(bull) */).replace('bull', block.bullet).getRegex();
|
|
1714
|
-
block.list = edit(block.list).replace(/bull/g, block.bullet).replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))').replace('def', '\\n+(?=' + block.def.source + ')').getRegex();
|
|
1715
|
-
block._tag = 'address|article|aside|base|basefont|blockquote|body|caption' + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption' + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe' + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option' + '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr' + '|track|ul';
|
|
1716
|
-
block._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
|
|
1717
|
-
block.html = edit(block.html, 'i').replace('comment', block._comment).replace('tag', block._tag).replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
|
|
1718
|
-
block.paragraph = edit(block._paragraph).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
|
|
1719
|
-
.replace('|table', '').replace('blockquote', ' {0,3}>').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
|
|
1720
|
-
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
|
|
1721
|
-
.getRegex();
|
|
1722
|
-
block.blockquote = edit(block.blockquote).replace('paragraph', block.paragraph).getRegex();
|
|
1723
|
-
/**
|
|
1724
|
-
* Normal Block Grammar
|
|
1725
|
-
*/
|
|
1726
|
-
|
|
1727
|
-
block.normal = merge({}, block);
|
|
1728
|
-
/**
|
|
1729
|
-
* GFM Block Grammar
|
|
1730
|
-
*/
|
|
1731
|
-
|
|
1732
|
-
block.gfm = merge({}, block.normal, {
|
|
1733
|
-
table: '^ *([^\\n ].*\\|.*)\\n' // Header
|
|
1734
|
-
+ ' {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?' // Align
|
|
1735
|
-
+ '(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells
|
|
1736
|
-
|
|
1737
|
-
});
|
|
1738
|
-
block.gfm.table = edit(block.gfm.table).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('blockquote', ' {0,3}>').replace('code', ' {4}[^\\n]').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
|
|
1739
|
-
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', block._tag) // tables can be interrupted by type (6) html blocks
|
|
1740
|
-
.getRegex();
|
|
1741
|
-
block.gfm.paragraph = edit(block._paragraph).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
|
|
1742
|
-
.replace('table', block.gfm.table) // interrupt paragraphs with table
|
|
1743
|
-
.replace('blockquote', ' {0,3}>').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
|
|
1744
|
-
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
|
|
1745
|
-
.getRegex();
|
|
1746
|
-
/**
|
|
1747
|
-
* Pedantic grammar (original John Gruber's loose markdown specification)
|
|
1748
|
-
*/
|
|
1749
|
-
|
|
1750
|
-
block.pedantic = merge({}, block.normal, {
|
|
1751
|
-
html: edit('^ *(?:comment *(?:\\n|\\s*$)' + '|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)' // closed tag
|
|
1752
|
-
+ '|<tag(?:"[^"]*"|\'[^\']*\'|\\s[^\'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))').replace('comment', block._comment).replace(/tag/g, '(?!(?:' + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub' + '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)' + '\\b)\\w+(?!:|[^\\w\\s@]*@)\\b').getRegex(),
|
|
1753
|
-
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
1754
|
-
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
1755
|
-
fences: noopTest,
|
|
1756
|
-
// fences not supported
|
|
1757
|
-
paragraph: edit(block.normal._paragraph).replace('hr', block.hr).replace('heading', ' *#{1,6} *[^\n]').replace('lheading', block.lheading).replace('blockquote', ' {0,3}>').replace('|fences', '').replace('|list', '').replace('|html', '').getRegex()
|
|
1758
|
-
});
|
|
1759
|
-
/**
|
|
1760
|
-
* Inline-Level Grammar
|
|
1761
|
-
*/
|
|
1762
|
-
|
|
1763
|
-
var inline = {
|
|
1764
|
-
escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
|
|
1765
|
-
autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
|
|
1766
|
-
url: noopTest,
|
|
1767
|
-
tag: '^comment' + '|^</[a-zA-Z][\\w:-]*\\s*>' // self-closing tag
|
|
1768
|
-
+ '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag
|
|
1769
|
-
+ '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g. <?php ?>
|
|
1770
|
-
+ '|^<![a-zA-Z]+\\s[\\s\\S]*?>' // declaration, e.g. <!DOCTYPE html>
|
|
1771
|
-
+ '|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>',
|
|
1772
|
-
// CDATA section
|
|
1773
|
-
link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
|
|
1774
|
-
reflink: /^!?\[(label)\]\[(ref)\]/,
|
|
1775
|
-
nolink: /^!?\[(ref)\](?:\[\])?/,
|
|
1776
|
-
reflinkSearch: 'reflink|nolink(?!\\()',
|
|
1777
|
-
emStrong: {
|
|
1778
|
-
lDelim: /^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,
|
|
1779
|
-
// (1) and (2) can only be a Right Delimiter. (3) and (4) can only be Left. (5) and (6) can be either Left or Right.
|
|
1780
|
-
// () Skip orphan inside strong () Consume to delim (1) #*** (2) a***#, a*** (3) #***a, ***a (4) ***# (5) #***# (6) a***a
|
|
1781
|
-
rDelimAst: /^[^_*]*?\_\_[^_*]*?\*[^_*]*?(?=\_\_)|[^*]+(?=[^*])|[punct_](\*+)(?=[\s]|$)|[^punct*_\s](\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|[^punct*_\s](\*+)(?=[^punct*_\s])/,
|
|
1782
|
-
rDelimUnd: /^[^_*]*?\*\*[^_*]*?\_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|[punct*](\_+)(?=[\s]|$)|[^punct*_\s](\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/ // ^- Not allowed for _
|
|
1783
|
-
|
|
1784
|
-
},
|
|
1785
|
-
code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
|
|
1786
|
-
br: /^( {2,}|\\)\n(?!\s*$)/,
|
|
1787
|
-
del: noopTest,
|
|
1788
|
-
text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
|
|
1789
|
-
punctuation: /^([\spunctuation])/
|
|
1790
|
-
}; // list of punctuation marks from CommonMark spec
|
|
1791
|
-
// without * and _ to handle the different emphasis markers * and _
|
|
1792
|
-
|
|
1793
|
-
inline._punctuation = '!"#$%&\'()+\\-.,/:;<=>?@\\[\\]`^{|}~';
|
|
1794
|
-
inline.punctuation = edit(inline.punctuation).replace(/punctuation/g, inline._punctuation).getRegex(); // sequences em should skip over [title](link), `code`, <html>
|
|
1795
|
-
|
|
1796
|
-
inline.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
|
|
1797
|
-
inline.escapedEmSt = /\\\*|\\_/g;
|
|
1798
|
-
inline._comment = edit(block._comment).replace('(?:-->|$)', '-->').getRegex();
|
|
1799
|
-
inline.emStrong.lDelim = edit(inline.emStrong.lDelim).replace(/punct/g, inline._punctuation).getRegex();
|
|
1800
|
-
inline.emStrong.rDelimAst = edit(inline.emStrong.rDelimAst, 'g').replace(/punct/g, inline._punctuation).getRegex();
|
|
1801
|
-
inline.emStrong.rDelimUnd = edit(inline.emStrong.rDelimUnd, 'g').replace(/punct/g, inline._punctuation).getRegex();
|
|
1802
|
-
inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
|
|
1803
|
-
inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
|
|
1804
|
-
inline._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;
|
|
1805
|
-
inline.autolink = edit(inline.autolink).replace('scheme', inline._scheme).replace('email', inline._email).getRegex();
|
|
1806
|
-
inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
|
|
1807
|
-
inline.tag = edit(inline.tag).replace('comment', inline._comment).replace('attribute', inline._attribute).getRegex();
|
|
1808
|
-
inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
|
|
1809
|
-
inline._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
|
|
1810
|
-
inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
|
|
1811
|
-
inline.link = edit(inline.link).replace('label', inline._label).replace('href', inline._href).replace('title', inline._title).getRegex();
|
|
1812
|
-
inline.reflink = edit(inline.reflink).replace('label', inline._label).replace('ref', block._label).getRegex();
|
|
1813
|
-
inline.nolink = edit(inline.nolink).replace('ref', block._label).getRegex();
|
|
1814
|
-
inline.reflinkSearch = edit(inline.reflinkSearch, 'g').replace('reflink', inline.reflink).replace('nolink', inline.nolink).getRegex();
|
|
1815
|
-
/**
|
|
1816
|
-
* Normal Inline Grammar
|
|
1817
|
-
*/
|
|
1818
|
-
|
|
1819
|
-
inline.normal = merge({}, inline);
|
|
1820
|
-
/**
|
|
1821
|
-
* Pedantic Inline Grammar
|
|
1822
|
-
*/
|
|
1823
|
-
|
|
1824
|
-
inline.pedantic = merge({}, inline.normal, {
|
|
1825
|
-
strong: {
|
|
1826
|
-
start: /^__|\*\*/,
|
|
1827
|
-
middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
|
|
1828
|
-
endAst: /\*\*(?!\*)/g,
|
|
1829
|
-
endUnd: /__(?!_)/g
|
|
1830
|
-
},
|
|
1831
|
-
em: {
|
|
1832
|
-
start: /^_|\*/,
|
|
1833
|
-
middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
|
|
1834
|
-
endAst: /\*(?!\*)/g,
|
|
1835
|
-
endUnd: /_(?!_)/g
|
|
1836
|
-
},
|
|
1837
|
-
link: edit(/^!?\[(label)\]\((.*?)\)/).replace('label', inline._label).getRegex(),
|
|
1838
|
-
reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace('label', inline._label).getRegex()
|
|
1839
|
-
});
|
|
1840
|
-
/**
|
|
1841
|
-
* GFM Inline Grammar
|
|
1842
|
-
*/
|
|
1843
|
-
|
|
1844
|
-
inline.gfm = merge({}, inline.normal, {
|
|
1845
|
-
escape: edit(inline.escape).replace('])', '~|])').getRegex(),
|
|
1846
|
-
_extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
|
|
1847
|
-
url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
|
|
1848
|
-
_backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,
|
|
1849
|
-
del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
|
|
1850
|
-
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
|
|
1851
|
-
});
|
|
1852
|
-
inline.gfm.url = edit(inline.gfm.url, 'i').replace('email', inline.gfm._extended_email).getRegex();
|
|
1853
|
-
/**
|
|
1854
|
-
* GFM + Line Breaks Inline Grammar
|
|
1855
|
-
*/
|
|
1856
|
-
|
|
1857
|
-
inline.breaks = merge({}, inline.gfm, {
|
|
1858
|
-
br: edit(inline.br).replace('{2,}', '*').getRegex(),
|
|
1859
|
-
text: edit(inline.gfm.text).replace('\\b_', '\\b_| {2,}\\n').replace(/\{2,\}/g, '*').getRegex()
|
|
1860
|
-
});
|
|
1861
|
-
|
|
1862
|
-
/**
|
|
1863
|
-
* smartypants text replacement
|
|
1864
|
-
* @param {string} text
|
|
1865
|
-
*/
|
|
1866
|
-
|
|
1867
|
-
function smartypants(text) {
|
|
1868
|
-
return text // em-dashes
|
|
1869
|
-
.replace(/---/g, "\u2014") // en-dashes
|
|
1870
|
-
.replace(/--/g, "\u2013") // opening singles
|
|
1871
|
-
.replace(/(^|[-\u2014/(\[{"\s])'/g, "$1\u2018") // closing singles & apostrophes
|
|
1872
|
-
.replace(/'/g, "\u2019") // opening doubles
|
|
1873
|
-
.replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1\u201C") // closing doubles
|
|
1874
|
-
.replace(/"/g, "\u201D") // ellipses
|
|
1875
|
-
.replace(/\.{3}/g, "\u2026");
|
|
1876
|
-
}
|
|
1877
|
-
/**
|
|
1878
|
-
* mangle email addresses
|
|
1879
|
-
* @param {string} text
|
|
1880
|
-
*/
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
function mangle(text) {
|
|
1884
|
-
var out = '',
|
|
1885
|
-
i,
|
|
1886
|
-
ch;
|
|
1887
|
-
var l = text.length;
|
|
1888
|
-
|
|
1889
|
-
for (i = 0; i < l; i++) {
|
|
1890
|
-
ch = text.charCodeAt(i);
|
|
1891
|
-
|
|
1892
|
-
if (Math.random() > 0.5) {
|
|
1893
|
-
ch = 'x' + ch.toString(16);
|
|
1894
|
-
}
|
|
1895
|
-
|
|
1896
|
-
out += '&#' + ch + ';';
|
|
1897
|
-
}
|
|
1898
|
-
|
|
1899
|
-
return out;
|
|
1900
|
-
}
|
|
1901
|
-
/**
|
|
1902
|
-
* Block Lexer
|
|
1903
|
-
*/
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
var Lexer = /*#__PURE__*/function () {
|
|
1907
|
-
function Lexer(options) {
|
|
1908
|
-
this.tokens = [];
|
|
1909
|
-
this.tokens.links = Object.create(null);
|
|
1910
|
-
this.options = options || exports.defaults;
|
|
1911
|
-
this.options.tokenizer = this.options.tokenizer || new Tokenizer();
|
|
1912
|
-
this.tokenizer = this.options.tokenizer;
|
|
1913
|
-
this.tokenizer.options = this.options;
|
|
1914
|
-
this.tokenizer.lexer = this;
|
|
1915
|
-
this.inlineQueue = [];
|
|
1916
|
-
this.state = {
|
|
1917
|
-
inLink: false,
|
|
1918
|
-
inRawBlock: false,
|
|
1919
|
-
top: true
|
|
1920
|
-
};
|
|
1921
|
-
var rules = {
|
|
1922
|
-
block: block.normal,
|
|
1923
|
-
inline: inline.normal
|
|
1924
|
-
};
|
|
1925
|
-
|
|
1926
|
-
if (this.options.pedantic) {
|
|
1927
|
-
rules.block = block.pedantic;
|
|
1928
|
-
rules.inline = inline.pedantic;
|
|
1929
|
-
} else if (this.options.gfm) {
|
|
1930
|
-
rules.block = block.gfm;
|
|
1931
|
-
|
|
1932
|
-
if (this.options.breaks) {
|
|
1933
|
-
rules.inline = inline.breaks;
|
|
1934
|
-
} else {
|
|
1935
|
-
rules.inline = inline.gfm;
|
|
1936
|
-
}
|
|
1937
|
-
}
|
|
1938
|
-
|
|
1939
|
-
this.tokenizer.rules = rules;
|
|
1940
|
-
}
|
|
1941
|
-
/**
|
|
1942
|
-
* Expose Rules
|
|
1943
|
-
*/
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
/**
|
|
1947
|
-
* Static Lex Method
|
|
1948
|
-
*/
|
|
1949
|
-
Lexer.lex = function lex(src, options) {
|
|
1950
|
-
var lexer = new Lexer(options);
|
|
1951
|
-
return lexer.lex(src);
|
|
1952
|
-
}
|
|
1953
|
-
/**
|
|
1954
|
-
* Static Lex Inline Method
|
|
1955
|
-
*/
|
|
1956
|
-
;
|
|
1957
|
-
|
|
1958
|
-
Lexer.lexInline = function lexInline(src, options) {
|
|
1959
|
-
var lexer = new Lexer(options);
|
|
1960
|
-
return lexer.inlineTokens(src);
|
|
1961
|
-
}
|
|
1962
|
-
/**
|
|
1963
|
-
* Preprocessing
|
|
1964
|
-
*/
|
|
1965
|
-
;
|
|
1966
|
-
|
|
1967
|
-
var _proto = Lexer.prototype;
|
|
1968
|
-
|
|
1969
|
-
_proto.lex = function lex(src) {
|
|
1970
|
-
src = src.replace(/\r\n|\r/g, '\n');
|
|
1971
|
-
this.blockTokens(src, this.tokens);
|
|
1972
|
-
var next;
|
|
1973
|
-
|
|
1974
|
-
while (next = this.inlineQueue.shift()) {
|
|
1975
|
-
this.inlineTokens(next.src, next.tokens);
|
|
1976
|
-
}
|
|
1977
|
-
|
|
1978
|
-
return this.tokens;
|
|
1979
|
-
}
|
|
1980
|
-
/**
|
|
1981
|
-
* Lexing
|
|
1982
|
-
*/
|
|
1983
|
-
;
|
|
1984
|
-
|
|
1985
|
-
_proto.blockTokens = function blockTokens(src, tokens) {
|
|
1986
|
-
var _this = this;
|
|
1987
|
-
|
|
1988
|
-
if (tokens === void 0) {
|
|
1989
|
-
tokens = [];
|
|
1990
|
-
}
|
|
1991
|
-
|
|
1992
|
-
if (this.options.pedantic) {
|
|
1993
|
-
src = src.replace(/\t/g, ' ').replace(/^ +$/gm, '');
|
|
1994
|
-
} else {
|
|
1995
|
-
src = src.replace(/^( *)(\t+)/gm, function (_, leading, tabs) {
|
|
1996
|
-
return leading + ' '.repeat(tabs.length);
|
|
1997
|
-
});
|
|
1998
|
-
}
|
|
1999
|
-
|
|
2000
|
-
var token, lastToken, cutSrc, lastParagraphClipped;
|
|
2001
|
-
|
|
2002
|
-
while (src) {
|
|
2003
|
-
if (this.options.extensions && this.options.extensions.block && this.options.extensions.block.some(function (extTokenizer) {
|
|
2004
|
-
if (token = extTokenizer.call({
|
|
2005
|
-
lexer: _this
|
|
2006
|
-
}, src, tokens)) {
|
|
2007
|
-
src = src.substring(token.raw.length);
|
|
2008
|
-
tokens.push(token);
|
|
2009
|
-
return true;
|
|
2010
|
-
}
|
|
2011
|
-
|
|
2012
|
-
return false;
|
|
2013
|
-
})) {
|
|
2014
|
-
continue;
|
|
2015
|
-
} // newline
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
if (token = this.tokenizer.space(src)) {
|
|
2019
|
-
src = src.substring(token.raw.length);
|
|
2020
|
-
|
|
2021
|
-
if (token.raw.length === 1 && tokens.length > 0) {
|
|
2022
|
-
// if there's a single \n as a spacer, it's terminating the last line,
|
|
2023
|
-
// so move it there so that we don't get unecessary paragraph tags
|
|
2024
|
-
tokens[tokens.length - 1].raw += '\n';
|
|
2025
|
-
} else {
|
|
2026
|
-
tokens.push(token);
|
|
2027
|
-
}
|
|
2028
|
-
|
|
2029
|
-
continue;
|
|
2030
|
-
} // code
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
if (token = this.tokenizer.code(src)) {
|
|
2034
|
-
src = src.substring(token.raw.length);
|
|
2035
|
-
lastToken = tokens[tokens.length - 1]; // An indented code block cannot interrupt a paragraph.
|
|
2036
|
-
|
|
2037
|
-
if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {
|
|
2038
|
-
lastToken.raw += '\n' + token.raw;
|
|
2039
|
-
lastToken.text += '\n' + token.text;
|
|
2040
|
-
this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
|
2041
|
-
} else {
|
|
2042
|
-
tokens.push(token);
|
|
2043
|
-
}
|
|
2044
|
-
|
|
2045
|
-
continue;
|
|
2046
|
-
} // fences
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
if (token = this.tokenizer.fences(src)) {
|
|
2050
|
-
src = src.substring(token.raw.length);
|
|
2051
|
-
tokens.push(token);
|
|
2052
|
-
continue;
|
|
2053
|
-
} // heading
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
if (token = this.tokenizer.heading(src)) {
|
|
2057
|
-
src = src.substring(token.raw.length);
|
|
2058
|
-
tokens.push(token);
|
|
2059
|
-
continue;
|
|
2060
|
-
} // hr
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
if (token = this.tokenizer.hr(src)) {
|
|
2064
|
-
src = src.substring(token.raw.length);
|
|
2065
|
-
tokens.push(token);
|
|
2066
|
-
continue;
|
|
2067
|
-
} // blockquote
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
if (token = this.tokenizer.blockquote(src)) {
|
|
2071
|
-
src = src.substring(token.raw.length);
|
|
2072
|
-
tokens.push(token);
|
|
2073
|
-
continue;
|
|
2074
|
-
} // list
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
if (token = this.tokenizer.list(src)) {
|
|
2078
|
-
src = src.substring(token.raw.length);
|
|
2079
|
-
tokens.push(token);
|
|
2080
|
-
continue;
|
|
2081
|
-
} // html
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
if (token = this.tokenizer.html(src)) {
|
|
2085
|
-
src = src.substring(token.raw.length);
|
|
2086
|
-
tokens.push(token);
|
|
2087
|
-
continue;
|
|
2088
|
-
} // def
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
if (token = this.tokenizer.def(src)) {
|
|
2092
|
-
src = src.substring(token.raw.length);
|
|
2093
|
-
lastToken = tokens[tokens.length - 1];
|
|
2094
|
-
|
|
2095
|
-
if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {
|
|
2096
|
-
lastToken.raw += '\n' + token.raw;
|
|
2097
|
-
lastToken.text += '\n' + token.raw;
|
|
2098
|
-
this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
|
2099
|
-
} else if (!this.tokens.links[token.tag]) {
|
|
2100
|
-
this.tokens.links[token.tag] = {
|
|
2101
|
-
href: token.href,
|
|
2102
|
-
title: token.title
|
|
2103
|
-
};
|
|
2104
|
-
}
|
|
2105
|
-
|
|
2106
|
-
continue;
|
|
2107
|
-
} // table (gfm)
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
if (token = this.tokenizer.table(src)) {
|
|
2111
|
-
src = src.substring(token.raw.length);
|
|
2112
|
-
tokens.push(token);
|
|
2113
|
-
continue;
|
|
2114
|
-
} // lheading
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
if (token = this.tokenizer.lheading(src)) {
|
|
2118
|
-
src = src.substring(token.raw.length);
|
|
2119
|
-
tokens.push(token);
|
|
2120
|
-
continue;
|
|
2121
|
-
} // top-level paragraph
|
|
2122
|
-
// prevent paragraph consuming extensions by clipping 'src' to extension start
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
cutSrc = src;
|
|
2126
|
-
|
|
2127
|
-
if (this.options.extensions && this.options.extensions.startBlock) {
|
|
2128
|
-
(function () {
|
|
2129
|
-
var startIndex = Infinity;
|
|
2130
|
-
var tempSrc = src.slice(1);
|
|
2131
|
-
var tempStart = void 0;
|
|
2132
|
-
|
|
2133
|
-
_this.options.extensions.startBlock.forEach(function (getStartIndex) {
|
|
2134
|
-
tempStart = getStartIndex.call({
|
|
2135
|
-
lexer: this
|
|
2136
|
-
}, tempSrc);
|
|
2137
|
-
|
|
2138
|
-
if (typeof tempStart === 'number' && tempStart >= 0) {
|
|
2139
|
-
startIndex = Math.min(startIndex, tempStart);
|
|
2140
|
-
}
|
|
2141
|
-
});
|
|
2142
|
-
|
|
2143
|
-
if (startIndex < Infinity && startIndex >= 0) {
|
|
2144
|
-
cutSrc = src.substring(0, startIndex + 1);
|
|
2145
|
-
}
|
|
2146
|
-
})();
|
|
2147
|
-
}
|
|
2148
|
-
|
|
2149
|
-
if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
|
|
2150
|
-
lastToken = tokens[tokens.length - 1];
|
|
2151
|
-
|
|
2152
|
-
if (lastParagraphClipped && lastToken.type === 'paragraph') {
|
|
2153
|
-
lastToken.raw += '\n' + token.raw;
|
|
2154
|
-
lastToken.text += '\n' + token.text;
|
|
2155
|
-
this.inlineQueue.pop();
|
|
2156
|
-
this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
|
2157
|
-
} else {
|
|
2158
|
-
tokens.push(token);
|
|
2159
|
-
}
|
|
2160
|
-
|
|
2161
|
-
lastParagraphClipped = cutSrc.length !== src.length;
|
|
2162
|
-
src = src.substring(token.raw.length);
|
|
2163
|
-
continue;
|
|
2164
|
-
} // text
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
if (token = this.tokenizer.text(src)) {
|
|
2168
|
-
src = src.substring(token.raw.length);
|
|
2169
|
-
lastToken = tokens[tokens.length - 1];
|
|
2170
|
-
|
|
2171
|
-
if (lastToken && lastToken.type === 'text') {
|
|
2172
|
-
lastToken.raw += '\n' + token.raw;
|
|
2173
|
-
lastToken.text += '\n' + token.text;
|
|
2174
|
-
this.inlineQueue.pop();
|
|
2175
|
-
this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
|
2176
|
-
} else {
|
|
2177
|
-
tokens.push(token);
|
|
2178
|
-
}
|
|
2179
|
-
|
|
2180
|
-
continue;
|
|
2181
|
-
}
|
|
2182
|
-
|
|
2183
|
-
if (src) {
|
|
2184
|
-
var errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
|
|
2185
|
-
|
|
2186
|
-
if (this.options.silent) {
|
|
2187
|
-
console.error(errMsg);
|
|
2188
|
-
break;
|
|
2189
|
-
} else {
|
|
2190
|
-
throw new Error(errMsg);
|
|
2191
|
-
}
|
|
2192
|
-
}
|
|
2193
|
-
}
|
|
2194
|
-
|
|
2195
|
-
this.state.top = true;
|
|
2196
|
-
return tokens;
|
|
2197
|
-
};
|
|
2198
|
-
|
|
2199
|
-
_proto.inline = function inline(src, tokens) {
|
|
2200
|
-
if (tokens === void 0) {
|
|
2201
|
-
tokens = [];
|
|
2202
|
-
}
|
|
2203
|
-
|
|
2204
|
-
this.inlineQueue.push({
|
|
2205
|
-
src: src,
|
|
2206
|
-
tokens: tokens
|
|
2207
|
-
});
|
|
2208
|
-
return tokens;
|
|
2209
|
-
}
|
|
2210
|
-
/**
|
|
2211
|
-
* Lexing/Compiling
|
|
2212
|
-
*/
|
|
2213
|
-
;
|
|
2214
|
-
|
|
2215
|
-
_proto.inlineTokens = function inlineTokens(src, tokens) {
|
|
2216
|
-
var _this2 = this;
|
|
2217
|
-
|
|
2218
|
-
if (tokens === void 0) {
|
|
2219
|
-
tokens = [];
|
|
2220
|
-
}
|
|
2221
|
-
|
|
2222
|
-
var token, lastToken, cutSrc; // String with links masked to avoid interference with em and strong
|
|
2223
|
-
|
|
2224
|
-
var maskedSrc = src;
|
|
2225
|
-
var match;
|
|
2226
|
-
var keepPrevChar, prevChar; // Mask out reflinks
|
|
2227
|
-
|
|
2228
|
-
if (this.tokens.links) {
|
|
2229
|
-
var links = Object.keys(this.tokens.links);
|
|
2230
|
-
|
|
2231
|
-
if (links.length > 0) {
|
|
2232
|
-
while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
|
|
2233
|
-
if (links.includes(match[0].slice(match[0].lastIndexOf('[') + 1, -1))) {
|
|
2234
|
-
maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString('a', match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
|
|
2235
|
-
}
|
|
2236
|
-
}
|
|
2237
|
-
}
|
|
2238
|
-
} // Mask out other blocks
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
|
|
2242
|
-
maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString('a', match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
2243
|
-
} // Mask out escaped em & strong delimiters
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
while ((match = this.tokenizer.rules.inline.escapedEmSt.exec(maskedSrc)) != null) {
|
|
2247
|
-
maskedSrc = maskedSrc.slice(0, match.index) + '++' + maskedSrc.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);
|
|
2248
|
-
}
|
|
2249
|
-
|
|
2250
|
-
while (src) {
|
|
2251
|
-
if (!keepPrevChar) {
|
|
2252
|
-
prevChar = '';
|
|
2253
|
-
}
|
|
2254
|
-
|
|
2255
|
-
keepPrevChar = false; // extensions
|
|
2256
|
-
|
|
2257
|
-
if (this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some(function (extTokenizer) {
|
|
2258
|
-
if (token = extTokenizer.call({
|
|
2259
|
-
lexer: _this2
|
|
2260
|
-
}, src, tokens)) {
|
|
2261
|
-
src = src.substring(token.raw.length);
|
|
2262
|
-
tokens.push(token);
|
|
2263
|
-
return true;
|
|
2264
|
-
}
|
|
2265
|
-
|
|
2266
|
-
return false;
|
|
2267
|
-
})) {
|
|
2268
|
-
continue;
|
|
2269
|
-
} // escape
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
if (token = this.tokenizer.escape(src)) {
|
|
2273
|
-
src = src.substring(token.raw.length);
|
|
2274
|
-
tokens.push(token);
|
|
2275
|
-
continue;
|
|
2276
|
-
} // tag
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
if (token = this.tokenizer.tag(src)) {
|
|
2280
|
-
src = src.substring(token.raw.length);
|
|
2281
|
-
lastToken = tokens[tokens.length - 1];
|
|
2282
|
-
|
|
2283
|
-
if (lastToken && token.type === 'text' && lastToken.type === 'text') {
|
|
2284
|
-
lastToken.raw += token.raw;
|
|
2285
|
-
lastToken.text += token.text;
|
|
2286
|
-
} else {
|
|
2287
|
-
tokens.push(token);
|
|
2288
|
-
}
|
|
2289
|
-
|
|
2290
|
-
continue;
|
|
2291
|
-
} // link
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
if (token = this.tokenizer.link(src)) {
|
|
2295
|
-
src = src.substring(token.raw.length);
|
|
2296
|
-
tokens.push(token);
|
|
2297
|
-
continue;
|
|
2298
|
-
} // reflink, nolink
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
if (token = this.tokenizer.reflink(src, this.tokens.links)) {
|
|
2302
|
-
src = src.substring(token.raw.length);
|
|
2303
|
-
lastToken = tokens[tokens.length - 1];
|
|
2304
|
-
|
|
2305
|
-
if (lastToken && token.type === 'text' && lastToken.type === 'text') {
|
|
2306
|
-
lastToken.raw += token.raw;
|
|
2307
|
-
lastToken.text += token.text;
|
|
2308
|
-
} else {
|
|
2309
|
-
tokens.push(token);
|
|
2310
|
-
}
|
|
2311
|
-
|
|
2312
|
-
continue;
|
|
2313
|
-
} // em & strong
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
|
|
2317
|
-
src = src.substring(token.raw.length);
|
|
2318
|
-
tokens.push(token);
|
|
2319
|
-
continue;
|
|
2320
|
-
} // code
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
if (token = this.tokenizer.codespan(src)) {
|
|
2324
|
-
src = src.substring(token.raw.length);
|
|
2325
|
-
tokens.push(token);
|
|
2326
|
-
continue;
|
|
2327
|
-
} // br
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
if (token = this.tokenizer.br(src)) {
|
|
2331
|
-
src = src.substring(token.raw.length);
|
|
2332
|
-
tokens.push(token);
|
|
2333
|
-
continue;
|
|
2334
|
-
} // del (gfm)
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
if (token = this.tokenizer.del(src)) {
|
|
2338
|
-
src = src.substring(token.raw.length);
|
|
2339
|
-
tokens.push(token);
|
|
2340
|
-
continue;
|
|
2341
|
-
} // autolink
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
if (token = this.tokenizer.autolink(src, mangle)) {
|
|
2345
|
-
src = src.substring(token.raw.length);
|
|
2346
|
-
tokens.push(token);
|
|
2347
|
-
continue;
|
|
2348
|
-
} // url (gfm)
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
if (!this.state.inLink && (token = this.tokenizer.url(src, mangle))) {
|
|
2352
|
-
src = src.substring(token.raw.length);
|
|
2353
|
-
tokens.push(token);
|
|
2354
|
-
continue;
|
|
2355
|
-
} // text
|
|
2356
|
-
// prevent inlineText consuming extensions by clipping 'src' to extension start
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
cutSrc = src;
|
|
2360
|
-
|
|
2361
|
-
if (this.options.extensions && this.options.extensions.startInline) {
|
|
2362
|
-
(function () {
|
|
2363
|
-
var startIndex = Infinity;
|
|
2364
|
-
var tempSrc = src.slice(1);
|
|
2365
|
-
var tempStart = void 0;
|
|
2366
|
-
|
|
2367
|
-
_this2.options.extensions.startInline.forEach(function (getStartIndex) {
|
|
2368
|
-
tempStart = getStartIndex.call({
|
|
2369
|
-
lexer: this
|
|
2370
|
-
}, tempSrc);
|
|
2371
|
-
|
|
2372
|
-
if (typeof tempStart === 'number' && tempStart >= 0) {
|
|
2373
|
-
startIndex = Math.min(startIndex, tempStart);
|
|
2374
|
-
}
|
|
2375
|
-
});
|
|
2376
|
-
|
|
2377
|
-
if (startIndex < Infinity && startIndex >= 0) {
|
|
2378
|
-
cutSrc = src.substring(0, startIndex + 1);
|
|
2379
|
-
}
|
|
2380
|
-
})();
|
|
2381
|
-
}
|
|
2382
|
-
|
|
2383
|
-
if (token = this.tokenizer.inlineText(cutSrc, smartypants)) {
|
|
2384
|
-
src = src.substring(token.raw.length);
|
|
2385
|
-
|
|
2386
|
-
if (token.raw.slice(-1) !== '_') {
|
|
2387
|
-
// Track prevChar before string of ____ started
|
|
2388
|
-
prevChar = token.raw.slice(-1);
|
|
2389
|
-
}
|
|
2390
|
-
|
|
2391
|
-
keepPrevChar = true;
|
|
2392
|
-
lastToken = tokens[tokens.length - 1];
|
|
2393
|
-
|
|
2394
|
-
if (lastToken && lastToken.type === 'text') {
|
|
2395
|
-
lastToken.raw += token.raw;
|
|
2396
|
-
lastToken.text += token.text;
|
|
2397
|
-
} else {
|
|
2398
|
-
tokens.push(token);
|
|
2399
|
-
}
|
|
2400
|
-
|
|
2401
|
-
continue;
|
|
2402
|
-
}
|
|
2403
|
-
|
|
2404
|
-
if (src) {
|
|
2405
|
-
var errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
|
|
2406
|
-
|
|
2407
|
-
if (this.options.silent) {
|
|
2408
|
-
console.error(errMsg);
|
|
2409
|
-
break;
|
|
2410
|
-
} else {
|
|
2411
|
-
throw new Error(errMsg);
|
|
2412
|
-
}
|
|
2413
|
-
}
|
|
2414
|
-
}
|
|
2415
|
-
|
|
2416
|
-
return tokens;
|
|
2417
|
-
};
|
|
2418
|
-
|
|
2419
|
-
_createClass(Lexer, null, [{
|
|
2420
|
-
key: "rules",
|
|
2421
|
-
get: function get() {
|
|
2422
|
-
return {
|
|
2423
|
-
block: block,
|
|
2424
|
-
inline: inline
|
|
2425
|
-
};
|
|
2426
|
-
}
|
|
2427
|
-
}]);
|
|
2428
|
-
|
|
2429
|
-
return Lexer;
|
|
2430
|
-
}();
|
|
2431
|
-
|
|
2432
|
-
/**
|
|
2433
|
-
* Renderer
|
|
2434
|
-
*/
|
|
2435
|
-
|
|
2436
|
-
var Renderer = /*#__PURE__*/function () {
|
|
2437
|
-
function Renderer(options) {
|
|
2438
|
-
this.options = options || exports.defaults;
|
|
2439
|
-
}
|
|
2440
|
-
|
|
2441
|
-
var _proto = Renderer.prototype;
|
|
2442
|
-
|
|
2443
|
-
_proto.code = function code(_code, infostring, escaped) {
|
|
2444
|
-
var lang = (infostring || '').match(/\S*/)[0];
|
|
2445
|
-
|
|
2446
|
-
if (this.options.highlight) {
|
|
2447
|
-
var out = this.options.highlight(_code, lang);
|
|
2448
|
-
|
|
2449
|
-
if (out != null && out !== _code) {
|
|
2450
|
-
escaped = true;
|
|
2451
|
-
_code = out;
|
|
2452
|
-
}
|
|
2453
|
-
}
|
|
2454
|
-
|
|
2455
|
-
_code = _code.replace(/\n$/, '') + '\n';
|
|
2456
|
-
|
|
2457
|
-
if (!lang) {
|
|
2458
|
-
return '<pre><code>' + (escaped ? _code : escape(_code, true)) + '</code></pre>\n';
|
|
2459
|
-
}
|
|
2460
|
-
|
|
2461
|
-
return '<pre><code class="' + this.options.langPrefix + escape(lang, true) + '">' + (escaped ? _code : escape(_code, true)) + '</code></pre>\n';
|
|
2462
|
-
}
|
|
2463
|
-
/**
|
|
2464
|
-
* @param {string} quote
|
|
2465
|
-
*/
|
|
2466
|
-
;
|
|
2467
|
-
|
|
2468
|
-
_proto.blockquote = function blockquote(quote) {
|
|
2469
|
-
return "<blockquote>\n" + quote + "</blockquote>\n";
|
|
2470
|
-
};
|
|
2471
|
-
|
|
2472
|
-
_proto.html = function html(_html) {
|
|
2473
|
-
return _html;
|
|
2474
|
-
}
|
|
2475
|
-
/**
|
|
2476
|
-
* @param {string} text
|
|
2477
|
-
* @param {string} level
|
|
2478
|
-
* @param {string} raw
|
|
2479
|
-
* @param {any} slugger
|
|
2480
|
-
*/
|
|
2481
|
-
;
|
|
2482
|
-
|
|
2483
|
-
_proto.heading = function heading(text, level, raw, slugger) {
|
|
2484
|
-
if (this.options.headerIds) {
|
|
2485
|
-
var id = this.options.headerPrefix + slugger.slug(raw);
|
|
2486
|
-
return "<h" + level + " id=\"" + id + "\">" + text + "</h" + level + ">\n";
|
|
2487
|
-
} // ignore IDs
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
return "<h" + level + ">" + text + "</h" + level + ">\n";
|
|
2491
|
-
};
|
|
2492
|
-
|
|
2493
|
-
_proto.hr = function hr() {
|
|
2494
|
-
return this.options.xhtml ? '<hr/>\n' : '<hr>\n';
|
|
2495
|
-
};
|
|
2496
|
-
|
|
2497
|
-
_proto.list = function list(body, ordered, start) {
|
|
2498
|
-
var type = ordered ? 'ol' : 'ul',
|
|
2499
|
-
startatt = ordered && start !== 1 ? ' start="' + start + '"' : '';
|
|
2500
|
-
return '<' + type + startatt + '>\n' + body + '</' + type + '>\n';
|
|
2501
|
-
}
|
|
2502
|
-
/**
|
|
2503
|
-
* @param {string} text
|
|
2504
|
-
*/
|
|
2505
|
-
;
|
|
2506
|
-
|
|
2507
|
-
_proto.listitem = function listitem(text) {
|
|
2508
|
-
return "<li>" + text + "</li>\n";
|
|
2509
|
-
};
|
|
2510
|
-
|
|
2511
|
-
_proto.checkbox = function checkbox(checked) {
|
|
2512
|
-
return '<input ' + (checked ? 'checked="" ' : '') + 'disabled="" type="checkbox"' + (this.options.xhtml ? ' /' : '') + '> ';
|
|
2513
|
-
}
|
|
2514
|
-
/**
|
|
2515
|
-
* @param {string} text
|
|
2516
|
-
*/
|
|
2517
|
-
;
|
|
2518
|
-
|
|
2519
|
-
_proto.paragraph = function paragraph(text) {
|
|
2520
|
-
return "<p>" + text + "</p>\n";
|
|
2521
|
-
}
|
|
2522
|
-
/**
|
|
2523
|
-
* @param {string} header
|
|
2524
|
-
* @param {string} body
|
|
2525
|
-
*/
|
|
2526
|
-
;
|
|
2527
|
-
|
|
2528
|
-
_proto.table = function table(header, body) {
|
|
2529
|
-
if (body) body = "<tbody>" + body + "</tbody>";
|
|
2530
|
-
return '<table>\n' + '<thead>\n' + header + '</thead>\n' + body + '</table>\n';
|
|
2531
|
-
}
|
|
2532
|
-
/**
|
|
2533
|
-
* @param {string} content
|
|
2534
|
-
*/
|
|
2535
|
-
;
|
|
2536
|
-
|
|
2537
|
-
_proto.tablerow = function tablerow(content) {
|
|
2538
|
-
return "<tr>\n" + content + "</tr>\n";
|
|
2539
|
-
};
|
|
2540
|
-
|
|
2541
|
-
_proto.tablecell = function tablecell(content, flags) {
|
|
2542
|
-
var type = flags.header ? 'th' : 'td';
|
|
2543
|
-
var tag = flags.align ? "<" + type + " align=\"" + flags.align + "\">" : "<" + type + ">";
|
|
2544
|
-
return tag + content + ("</" + type + ">\n");
|
|
2545
|
-
}
|
|
2546
|
-
/**
|
|
2547
|
-
* span level renderer
|
|
2548
|
-
* @param {string} text
|
|
2549
|
-
*/
|
|
2550
|
-
;
|
|
2551
|
-
|
|
2552
|
-
_proto.strong = function strong(text) {
|
|
2553
|
-
return "<strong>" + text + "</strong>";
|
|
2554
|
-
}
|
|
2555
|
-
/**
|
|
2556
|
-
* @param {string} text
|
|
2557
|
-
*/
|
|
2558
|
-
;
|
|
2559
|
-
|
|
2560
|
-
_proto.em = function em(text) {
|
|
2561
|
-
return "<em>" + text + "</em>";
|
|
2562
|
-
}
|
|
2563
|
-
/**
|
|
2564
|
-
* @param {string} text
|
|
2565
|
-
*/
|
|
2566
|
-
;
|
|
2567
|
-
|
|
2568
|
-
_proto.codespan = function codespan(text) {
|
|
2569
|
-
return "<code>" + text + "</code>";
|
|
2570
|
-
};
|
|
2571
|
-
|
|
2572
|
-
_proto.br = function br() {
|
|
2573
|
-
return this.options.xhtml ? '<br/>' : '<br>';
|
|
2574
|
-
}
|
|
2575
|
-
/**
|
|
2576
|
-
* @param {string} text
|
|
2577
|
-
*/
|
|
2578
|
-
;
|
|
2579
|
-
|
|
2580
|
-
_proto.del = function del(text) {
|
|
2581
|
-
return "<del>" + text + "</del>";
|
|
2582
|
-
}
|
|
2583
|
-
/**
|
|
2584
|
-
* @param {string} href
|
|
2585
|
-
* @param {string} title
|
|
2586
|
-
* @param {string} text
|
|
2587
|
-
*/
|
|
2588
|
-
;
|
|
2589
|
-
|
|
2590
|
-
_proto.link = function link(href, title, text) {
|
|
2591
|
-
href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
|
|
2592
|
-
|
|
2593
|
-
if (href === null) {
|
|
2594
|
-
return text;
|
|
2595
|
-
}
|
|
2596
|
-
|
|
2597
|
-
var out = '<a href="' + escape(href) + '"';
|
|
2598
|
-
|
|
2599
|
-
if (title) {
|
|
2600
|
-
out += ' title="' + title + '"';
|
|
2601
|
-
}
|
|
2602
|
-
|
|
2603
|
-
out += '>' + text + '</a>';
|
|
2604
|
-
return out;
|
|
2605
|
-
}
|
|
2606
|
-
/**
|
|
2607
|
-
* @param {string} href
|
|
2608
|
-
* @param {string} title
|
|
2609
|
-
* @param {string} text
|
|
2610
|
-
*/
|
|
2611
|
-
;
|
|
2612
|
-
|
|
2613
|
-
_proto.image = function image(href, title, text) {
|
|
2614
|
-
href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
|
|
2615
|
-
|
|
2616
|
-
if (href === null) {
|
|
2617
|
-
return text;
|
|
2618
|
-
}
|
|
2619
|
-
|
|
2620
|
-
var out = "<img src=\"" + href + "\" alt=\"" + text + "\"";
|
|
2621
|
-
|
|
2622
|
-
if (title) {
|
|
2623
|
-
out += " title=\"" + title + "\"";
|
|
2624
|
-
}
|
|
2625
|
-
|
|
2626
|
-
out += this.options.xhtml ? '/>' : '>';
|
|
2627
|
-
return out;
|
|
2628
|
-
};
|
|
2629
|
-
|
|
2630
|
-
_proto.text = function text(_text) {
|
|
2631
|
-
return _text;
|
|
2632
|
-
};
|
|
2633
|
-
|
|
2634
|
-
return Renderer;
|
|
2635
|
-
}();
|
|
2636
|
-
|
|
2637
|
-
/**
|
|
2638
|
-
* TextRenderer
|
|
2639
|
-
* returns only the textual part of the token
|
|
2640
|
-
*/
|
|
2641
|
-
var TextRenderer = /*#__PURE__*/function () {
|
|
2642
|
-
function TextRenderer() {}
|
|
2643
|
-
|
|
2644
|
-
var _proto = TextRenderer.prototype;
|
|
2645
|
-
|
|
2646
|
-
// no need for block level renderers
|
|
2647
|
-
_proto.strong = function strong(text) {
|
|
2648
|
-
return text;
|
|
2649
|
-
};
|
|
2650
|
-
|
|
2651
|
-
_proto.em = function em(text) {
|
|
2652
|
-
return text;
|
|
2653
|
-
};
|
|
2654
|
-
|
|
2655
|
-
_proto.codespan = function codespan(text) {
|
|
2656
|
-
return text;
|
|
2657
|
-
};
|
|
2658
|
-
|
|
2659
|
-
_proto.del = function del(text) {
|
|
2660
|
-
return text;
|
|
2661
|
-
};
|
|
2662
|
-
|
|
2663
|
-
_proto.html = function html(text) {
|
|
2664
|
-
return text;
|
|
2665
|
-
};
|
|
2666
|
-
|
|
2667
|
-
_proto.text = function text(_text) {
|
|
2668
|
-
return _text;
|
|
2669
|
-
};
|
|
2670
|
-
|
|
2671
|
-
_proto.link = function link(href, title, text) {
|
|
2672
|
-
return '' + text;
|
|
2673
|
-
};
|
|
2674
|
-
|
|
2675
|
-
_proto.image = function image(href, title, text) {
|
|
2676
|
-
return '' + text;
|
|
2677
|
-
};
|
|
2678
|
-
|
|
2679
|
-
_proto.br = function br() {
|
|
2680
|
-
return '';
|
|
2681
|
-
};
|
|
2682
|
-
|
|
2683
|
-
return TextRenderer;
|
|
2684
|
-
}();
|
|
2685
|
-
|
|
2686
|
-
/**
|
|
2687
|
-
* Slugger generates header id
|
|
2688
|
-
*/
|
|
2689
|
-
var Slugger = /*#__PURE__*/function () {
|
|
2690
|
-
function Slugger() {
|
|
2691
|
-
this.seen = {};
|
|
2692
|
-
}
|
|
2693
|
-
/**
|
|
2694
|
-
* @param {string} value
|
|
2695
|
-
*/
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
var _proto = Slugger.prototype;
|
|
2699
|
-
|
|
2700
|
-
_proto.serialize = function serialize(value) {
|
|
2701
|
-
return value.toLowerCase().trim() // remove html tags
|
|
2702
|
-
.replace(/<[!\/a-z].*?>/ig, '') // remove unwanted chars
|
|
2703
|
-
.replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '').replace(/\s/g, '-');
|
|
2704
|
-
}
|
|
2705
|
-
/**
|
|
2706
|
-
* Finds the next safe (unique) slug to use
|
|
2707
|
-
* @param {string} originalSlug
|
|
2708
|
-
* @param {boolean} isDryRun
|
|
2709
|
-
*/
|
|
2710
|
-
;
|
|
2711
|
-
|
|
2712
|
-
_proto.getNextSafeSlug = function getNextSafeSlug(originalSlug, isDryRun) {
|
|
2713
|
-
var slug = originalSlug;
|
|
2714
|
-
var occurenceAccumulator = 0;
|
|
2715
|
-
|
|
2716
|
-
if (this.seen.hasOwnProperty(slug)) {
|
|
2717
|
-
occurenceAccumulator = this.seen[originalSlug];
|
|
2718
|
-
|
|
2719
|
-
do {
|
|
2720
|
-
occurenceAccumulator++;
|
|
2721
|
-
slug = originalSlug + '-' + occurenceAccumulator;
|
|
2722
|
-
} while (this.seen.hasOwnProperty(slug));
|
|
2723
|
-
}
|
|
2724
|
-
|
|
2725
|
-
if (!isDryRun) {
|
|
2726
|
-
this.seen[originalSlug] = occurenceAccumulator;
|
|
2727
|
-
this.seen[slug] = 0;
|
|
2728
|
-
}
|
|
2729
|
-
|
|
2730
|
-
return slug;
|
|
2731
|
-
}
|
|
2732
|
-
/**
|
|
2733
|
-
* Convert string to unique id
|
|
2734
|
-
* @param {object} [options]
|
|
2735
|
-
* @param {boolean} [options.dryrun] Generates the next unique slug without
|
|
2736
|
-
* updating the internal accumulator.
|
|
2737
|
-
*/
|
|
2738
|
-
;
|
|
2739
|
-
|
|
2740
|
-
_proto.slug = function slug(value, options) {
|
|
2741
|
-
if (options === void 0) {
|
|
2742
|
-
options = {};
|
|
2743
|
-
}
|
|
2744
|
-
|
|
2745
|
-
var slug = this.serialize(value);
|
|
2746
|
-
return this.getNextSafeSlug(slug, options.dryrun);
|
|
2747
|
-
};
|
|
2748
|
-
|
|
2749
|
-
return Slugger;
|
|
2750
|
-
}();
|
|
2751
|
-
|
|
2752
|
-
/**
|
|
2753
|
-
* Parsing & Compiling
|
|
2754
|
-
*/
|
|
2755
|
-
|
|
2756
|
-
var Parser = /*#__PURE__*/function () {
|
|
2757
|
-
function Parser(options) {
|
|
2758
|
-
this.options = options || exports.defaults;
|
|
2759
|
-
this.options.renderer = this.options.renderer || new Renderer();
|
|
2760
|
-
this.renderer = this.options.renderer;
|
|
2761
|
-
this.renderer.options = this.options;
|
|
2762
|
-
this.textRenderer = new TextRenderer();
|
|
2763
|
-
this.slugger = new Slugger();
|
|
2764
|
-
}
|
|
2765
|
-
/**
|
|
2766
|
-
* Static Parse Method
|
|
2767
|
-
*/
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
Parser.parse = function parse(tokens, options) {
|
|
2771
|
-
var parser = new Parser(options);
|
|
2772
|
-
return parser.parse(tokens);
|
|
2773
|
-
}
|
|
2774
|
-
/**
|
|
2775
|
-
* Static Parse Inline Method
|
|
2776
|
-
*/
|
|
2777
|
-
;
|
|
2778
|
-
|
|
2779
|
-
Parser.parseInline = function parseInline(tokens, options) {
|
|
2780
|
-
var parser = new Parser(options);
|
|
2781
|
-
return parser.parseInline(tokens);
|
|
2782
|
-
}
|
|
2783
|
-
/**
|
|
2784
|
-
* Parse Loop
|
|
2785
|
-
*/
|
|
2786
|
-
;
|
|
2787
|
-
|
|
2788
|
-
var _proto = Parser.prototype;
|
|
2789
|
-
|
|
2790
|
-
_proto.parse = function parse(tokens, top) {
|
|
2791
|
-
if (top === void 0) {
|
|
2792
|
-
top = true;
|
|
2793
|
-
}
|
|
2794
|
-
|
|
2795
|
-
var out = '',
|
|
2796
|
-
i,
|
|
2797
|
-
j,
|
|
2798
|
-
k,
|
|
2799
|
-
l2,
|
|
2800
|
-
l3,
|
|
2801
|
-
row,
|
|
2802
|
-
cell,
|
|
2803
|
-
header,
|
|
2804
|
-
body,
|
|
2805
|
-
token,
|
|
2806
|
-
ordered,
|
|
2807
|
-
start,
|
|
2808
|
-
loose,
|
|
2809
|
-
itemBody,
|
|
2810
|
-
item,
|
|
2811
|
-
checked,
|
|
2812
|
-
task,
|
|
2813
|
-
checkbox,
|
|
2814
|
-
ret;
|
|
2815
|
-
var l = tokens.length;
|
|
2816
|
-
|
|
2817
|
-
for (i = 0; i < l; i++) {
|
|
2818
|
-
token = tokens[i]; // Run any renderer extensions
|
|
2819
|
-
|
|
2820
|
-
if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
|
|
2821
|
-
ret = this.options.extensions.renderers[token.type].call({
|
|
2822
|
-
parser: this
|
|
2823
|
-
}, token);
|
|
2824
|
-
|
|
2825
|
-
if (ret !== false || !['space', 'hr', 'heading', 'code', 'table', 'blockquote', 'list', 'html', 'paragraph', 'text'].includes(token.type)) {
|
|
2826
|
-
out += ret || '';
|
|
2827
|
-
continue;
|
|
2828
|
-
}
|
|
2829
|
-
}
|
|
2830
|
-
|
|
2831
|
-
switch (token.type) {
|
|
2832
|
-
case 'space':
|
|
2833
|
-
{
|
|
2834
|
-
continue;
|
|
2835
|
-
}
|
|
2836
|
-
|
|
2837
|
-
case 'hr':
|
|
2838
|
-
{
|
|
2839
|
-
out += this.renderer.hr();
|
|
2840
|
-
continue;
|
|
2841
|
-
}
|
|
2842
|
-
|
|
2843
|
-
case 'heading':
|
|
2844
|
-
{
|
|
2845
|
-
out += this.renderer.heading(this.parseInline(token.tokens), token.depth, unescape(this.parseInline(token.tokens, this.textRenderer)), this.slugger);
|
|
2846
|
-
continue;
|
|
2847
|
-
}
|
|
2848
|
-
|
|
2849
|
-
case 'code':
|
|
2850
|
-
{
|
|
2851
|
-
out += this.renderer.code(token.text, token.lang, token.escaped);
|
|
2852
|
-
continue;
|
|
2853
|
-
}
|
|
2854
|
-
|
|
2855
|
-
case 'table':
|
|
2856
|
-
{
|
|
2857
|
-
header = ''; // header
|
|
2858
|
-
|
|
2859
|
-
cell = '';
|
|
2860
|
-
l2 = token.header.length;
|
|
2861
|
-
|
|
2862
|
-
for (j = 0; j < l2; j++) {
|
|
2863
|
-
cell += this.renderer.tablecell(this.parseInline(token.header[j].tokens), {
|
|
2864
|
-
header: true,
|
|
2865
|
-
align: token.align[j]
|
|
2866
|
-
});
|
|
2867
|
-
}
|
|
2868
|
-
|
|
2869
|
-
header += this.renderer.tablerow(cell);
|
|
2870
|
-
body = '';
|
|
2871
|
-
l2 = token.rows.length;
|
|
2872
|
-
|
|
2873
|
-
for (j = 0; j < l2; j++) {
|
|
2874
|
-
row = token.rows[j];
|
|
2875
|
-
cell = '';
|
|
2876
|
-
l3 = row.length;
|
|
2877
|
-
|
|
2878
|
-
for (k = 0; k < l3; k++) {
|
|
2879
|
-
cell += this.renderer.tablecell(this.parseInline(row[k].tokens), {
|
|
2880
|
-
header: false,
|
|
2881
|
-
align: token.align[k]
|
|
2882
|
-
});
|
|
2883
|
-
}
|
|
2884
|
-
|
|
2885
|
-
body += this.renderer.tablerow(cell);
|
|
2886
|
-
}
|
|
2887
|
-
|
|
2888
|
-
out += this.renderer.table(header, body);
|
|
2889
|
-
continue;
|
|
2890
|
-
}
|
|
2891
|
-
|
|
2892
|
-
case 'blockquote':
|
|
2893
|
-
{
|
|
2894
|
-
body = this.parse(token.tokens);
|
|
2895
|
-
out += this.renderer.blockquote(body);
|
|
2896
|
-
continue;
|
|
2897
|
-
}
|
|
2898
|
-
|
|
2899
|
-
case 'list':
|
|
2900
|
-
{
|
|
2901
|
-
ordered = token.ordered;
|
|
2902
|
-
start = token.start;
|
|
2903
|
-
loose = token.loose;
|
|
2904
|
-
l2 = token.items.length;
|
|
2905
|
-
body = '';
|
|
2906
|
-
|
|
2907
|
-
for (j = 0; j < l2; j++) {
|
|
2908
|
-
item = token.items[j];
|
|
2909
|
-
checked = item.checked;
|
|
2910
|
-
task = item.task;
|
|
2911
|
-
itemBody = '';
|
|
2912
|
-
|
|
2913
|
-
if (item.task) {
|
|
2914
|
-
checkbox = this.renderer.checkbox(checked);
|
|
2915
|
-
|
|
2916
|
-
if (loose) {
|
|
2917
|
-
if (item.tokens.length > 0 && item.tokens[0].type === 'paragraph') {
|
|
2918
|
-
item.tokens[0].text = checkbox + ' ' + item.tokens[0].text;
|
|
2919
|
-
|
|
2920
|
-
if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === 'text') {
|
|
2921
|
-
item.tokens[0].tokens[0].text = checkbox + ' ' + item.tokens[0].tokens[0].text;
|
|
2922
|
-
}
|
|
2923
|
-
} else {
|
|
2924
|
-
item.tokens.unshift({
|
|
2925
|
-
type: 'text',
|
|
2926
|
-
text: checkbox
|
|
2927
|
-
});
|
|
2928
|
-
}
|
|
2929
|
-
} else {
|
|
2930
|
-
itemBody += checkbox;
|
|
2931
|
-
}
|
|
2932
|
-
}
|
|
2933
|
-
|
|
2934
|
-
itemBody += this.parse(item.tokens, loose);
|
|
2935
|
-
body += this.renderer.listitem(itemBody, task, checked);
|
|
2936
|
-
}
|
|
2937
|
-
|
|
2938
|
-
out += this.renderer.list(body, ordered, start);
|
|
2939
|
-
continue;
|
|
2940
|
-
}
|
|
2941
|
-
|
|
2942
|
-
case 'html':
|
|
2943
|
-
{
|
|
2944
|
-
// TODO parse inline content if parameter markdown=1
|
|
2945
|
-
out += this.renderer.html(token.text);
|
|
2946
|
-
continue;
|
|
2947
|
-
}
|
|
2948
|
-
|
|
2949
|
-
case 'paragraph':
|
|
2950
|
-
{
|
|
2951
|
-
out += this.renderer.paragraph(this.parseInline(token.tokens));
|
|
2952
|
-
continue;
|
|
2953
|
-
}
|
|
2954
|
-
|
|
2955
|
-
case 'text':
|
|
2956
|
-
{
|
|
2957
|
-
body = token.tokens ? this.parseInline(token.tokens) : token.text;
|
|
2958
|
-
|
|
2959
|
-
while (i + 1 < l && tokens[i + 1].type === 'text') {
|
|
2960
|
-
token = tokens[++i];
|
|
2961
|
-
body += '\n' + (token.tokens ? this.parseInline(token.tokens) : token.text);
|
|
2962
|
-
}
|
|
2963
|
-
|
|
2964
|
-
out += top ? this.renderer.paragraph(body) : body;
|
|
2965
|
-
continue;
|
|
2966
|
-
}
|
|
2967
|
-
|
|
2968
|
-
default:
|
|
2969
|
-
{
|
|
2970
|
-
var errMsg = 'Token with "' + token.type + '" type was not found.';
|
|
2971
|
-
|
|
2972
|
-
if (this.options.silent) {
|
|
2973
|
-
console.error(errMsg);
|
|
2974
|
-
return;
|
|
2975
|
-
} else {
|
|
2976
|
-
throw new Error(errMsg);
|
|
2977
|
-
}
|
|
2978
|
-
}
|
|
2979
|
-
}
|
|
2980
|
-
}
|
|
2981
|
-
|
|
2982
|
-
return out;
|
|
2983
|
-
}
|
|
2984
|
-
/**
|
|
2985
|
-
* Parse Inline Tokens
|
|
2986
|
-
*/
|
|
2987
|
-
;
|
|
2988
|
-
|
|
2989
|
-
_proto.parseInline = function parseInline(tokens, renderer) {
|
|
2990
|
-
renderer = renderer || this.renderer;
|
|
2991
|
-
var out = '',
|
|
2992
|
-
i,
|
|
2993
|
-
token,
|
|
2994
|
-
ret;
|
|
2995
|
-
var l = tokens.length;
|
|
2996
|
-
|
|
2997
|
-
for (i = 0; i < l; i++) {
|
|
2998
|
-
token = tokens[i]; // Run any renderer extensions
|
|
2999
|
-
|
|
3000
|
-
if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
|
|
3001
|
-
ret = this.options.extensions.renderers[token.type].call({
|
|
3002
|
-
parser: this
|
|
3003
|
-
}, token);
|
|
3004
|
-
|
|
3005
|
-
if (ret !== false || !['escape', 'html', 'link', 'image', 'strong', 'em', 'codespan', 'br', 'del', 'text'].includes(token.type)) {
|
|
3006
|
-
out += ret || '';
|
|
3007
|
-
continue;
|
|
3008
|
-
}
|
|
3009
|
-
}
|
|
3010
|
-
|
|
3011
|
-
switch (token.type) {
|
|
3012
|
-
case 'escape':
|
|
3013
|
-
{
|
|
3014
|
-
out += renderer.text(token.text);
|
|
3015
|
-
break;
|
|
3016
|
-
}
|
|
3017
|
-
|
|
3018
|
-
case 'html':
|
|
3019
|
-
{
|
|
3020
|
-
out += renderer.html(token.text);
|
|
3021
|
-
break;
|
|
3022
|
-
}
|
|
3023
|
-
|
|
3024
|
-
case 'link':
|
|
3025
|
-
{
|
|
3026
|
-
out += renderer.link(token.href, token.title, this.parseInline(token.tokens, renderer));
|
|
3027
|
-
break;
|
|
3028
|
-
}
|
|
3029
|
-
|
|
3030
|
-
case 'image':
|
|
3031
|
-
{
|
|
3032
|
-
out += renderer.image(token.href, token.title, token.text);
|
|
3033
|
-
break;
|
|
3034
|
-
}
|
|
3035
|
-
|
|
3036
|
-
case 'strong':
|
|
3037
|
-
{
|
|
3038
|
-
out += renderer.strong(this.parseInline(token.tokens, renderer));
|
|
3039
|
-
break;
|
|
3040
|
-
}
|
|
3041
|
-
|
|
3042
|
-
case 'em':
|
|
3043
|
-
{
|
|
3044
|
-
out += renderer.em(this.parseInline(token.tokens, renderer));
|
|
3045
|
-
break;
|
|
3046
|
-
}
|
|
3047
|
-
|
|
3048
|
-
case 'codespan':
|
|
3049
|
-
{
|
|
3050
|
-
out += renderer.codespan(token.text);
|
|
3051
|
-
break;
|
|
3052
|
-
}
|
|
3053
|
-
|
|
3054
|
-
case 'br':
|
|
3055
|
-
{
|
|
3056
|
-
out += renderer.br();
|
|
3057
|
-
break;
|
|
3058
|
-
}
|
|
3059
|
-
|
|
3060
|
-
case 'del':
|
|
3061
|
-
{
|
|
3062
|
-
out += renderer.del(this.parseInline(token.tokens, renderer));
|
|
3063
|
-
break;
|
|
3064
|
-
}
|
|
3065
|
-
|
|
3066
|
-
case 'text':
|
|
3067
|
-
{
|
|
3068
|
-
out += renderer.text(token.text);
|
|
3069
|
-
break;
|
|
3070
|
-
}
|
|
3071
|
-
|
|
3072
|
-
default:
|
|
3073
|
-
{
|
|
3074
|
-
var errMsg = 'Token with "' + token.type + '" type was not found.';
|
|
3075
|
-
|
|
3076
|
-
if (this.options.silent) {
|
|
3077
|
-
console.error(errMsg);
|
|
3078
|
-
return;
|
|
3079
|
-
} else {
|
|
3080
|
-
throw new Error(errMsg);
|
|
3081
|
-
}
|
|
3082
|
-
}
|
|
3083
|
-
}
|
|
3084
|
-
}
|
|
3085
|
-
|
|
3086
|
-
return out;
|
|
3087
|
-
};
|
|
3088
|
-
|
|
3089
|
-
return Parser;
|
|
3090
|
-
}();
|
|
3091
|
-
|
|
3092
|
-
/**
|
|
3093
|
-
* Marked
|
|
3094
|
-
*/
|
|
3095
|
-
|
|
3096
|
-
function marked(src, opt, callback) {
|
|
3097
|
-
// throw error in case of non string input
|
|
3098
|
-
if (typeof src === 'undefined' || src === null) {
|
|
3099
|
-
throw new Error('marked(): input parameter is undefined or null');
|
|
3100
|
-
}
|
|
3101
|
-
|
|
3102
|
-
if (typeof src !== 'string') {
|
|
3103
|
-
throw new Error('marked(): input parameter is of type ' + Object.prototype.toString.call(src) + ', string expected');
|
|
3104
|
-
}
|
|
3105
|
-
|
|
3106
|
-
if (typeof opt === 'function') {
|
|
3107
|
-
callback = opt;
|
|
3108
|
-
opt = null;
|
|
3109
|
-
}
|
|
3110
|
-
|
|
3111
|
-
opt = merge({}, marked.defaults, opt || {});
|
|
3112
|
-
checkSanitizeDeprecation(opt);
|
|
3113
|
-
|
|
3114
|
-
if (callback) {
|
|
3115
|
-
var highlight = opt.highlight;
|
|
3116
|
-
var tokens;
|
|
3117
|
-
|
|
3118
|
-
try {
|
|
3119
|
-
tokens = Lexer.lex(src, opt);
|
|
3120
|
-
} catch (e) {
|
|
3121
|
-
return callback(e);
|
|
3122
|
-
}
|
|
3123
|
-
|
|
3124
|
-
var done = function done(err) {
|
|
3125
|
-
var out;
|
|
3126
|
-
|
|
3127
|
-
if (!err) {
|
|
3128
|
-
try {
|
|
3129
|
-
if (opt.walkTokens) {
|
|
3130
|
-
marked.walkTokens(tokens, opt.walkTokens);
|
|
3131
|
-
}
|
|
3132
|
-
|
|
3133
|
-
out = Parser.parse(tokens, opt);
|
|
3134
|
-
} catch (e) {
|
|
3135
|
-
err = e;
|
|
3136
|
-
}
|
|
3137
|
-
}
|
|
3138
|
-
|
|
3139
|
-
opt.highlight = highlight;
|
|
3140
|
-
return err ? callback(err) : callback(null, out);
|
|
3141
|
-
};
|
|
3142
|
-
|
|
3143
|
-
if (!highlight || highlight.length < 3) {
|
|
3144
|
-
return done();
|
|
3145
|
-
}
|
|
3146
|
-
|
|
3147
|
-
delete opt.highlight;
|
|
3148
|
-
if (!tokens.length) return done();
|
|
3149
|
-
var pending = 0;
|
|
3150
|
-
marked.walkTokens(tokens, function (token) {
|
|
3151
|
-
if (token.type === 'code') {
|
|
3152
|
-
pending++;
|
|
3153
|
-
setTimeout(function () {
|
|
3154
|
-
highlight(token.text, token.lang, function (err, code) {
|
|
3155
|
-
if (err) {
|
|
3156
|
-
return done(err);
|
|
3157
|
-
}
|
|
3158
|
-
|
|
3159
|
-
if (code != null && code !== token.text) {
|
|
3160
|
-
token.text = code;
|
|
3161
|
-
token.escaped = true;
|
|
3162
|
-
}
|
|
3163
|
-
|
|
3164
|
-
pending--;
|
|
3165
|
-
|
|
3166
|
-
if (pending === 0) {
|
|
3167
|
-
done();
|
|
3168
|
-
}
|
|
3169
|
-
});
|
|
3170
|
-
}, 0);
|
|
3171
|
-
}
|
|
3172
|
-
});
|
|
3173
|
-
|
|
3174
|
-
if (pending === 0) {
|
|
3175
|
-
done();
|
|
3176
|
-
}
|
|
3177
|
-
|
|
3178
|
-
return;
|
|
3179
|
-
}
|
|
3180
|
-
|
|
3181
|
-
function onError(e) {
|
|
3182
|
-
e.message += '\nPlease report this to https://github.com/markedjs/marked.';
|
|
3183
|
-
|
|
3184
|
-
if (opt.silent) {
|
|
3185
|
-
return '<p>An error occurred:</p><pre>' + escape(e.message + '', true) + '</pre>';
|
|
3186
|
-
}
|
|
3187
|
-
|
|
3188
|
-
throw e;
|
|
3189
|
-
}
|
|
3190
|
-
|
|
3191
|
-
try {
|
|
3192
|
-
var _tokens = Lexer.lex(src, opt);
|
|
3193
|
-
|
|
3194
|
-
if (opt.walkTokens) {
|
|
3195
|
-
if (opt.async) {
|
|
3196
|
-
return Promise.all(marked.walkTokens(_tokens, opt.walkTokens)).then(function () {
|
|
3197
|
-
return Parser.parse(_tokens, opt);
|
|
3198
|
-
})["catch"](onError);
|
|
3199
|
-
}
|
|
3200
|
-
|
|
3201
|
-
marked.walkTokens(_tokens, opt.walkTokens);
|
|
3202
|
-
}
|
|
3203
|
-
|
|
3204
|
-
return Parser.parse(_tokens, opt);
|
|
3205
|
-
} catch (e) {
|
|
3206
|
-
onError(e);
|
|
3207
|
-
}
|
|
3208
|
-
}
|
|
3209
|
-
/**
|
|
3210
|
-
* Options
|
|
3211
|
-
*/
|
|
3212
|
-
|
|
3213
|
-
marked.options = marked.setOptions = function (opt) {
|
|
3214
|
-
merge(marked.defaults, opt);
|
|
3215
|
-
changeDefaults(marked.defaults);
|
|
3216
|
-
return marked;
|
|
3217
|
-
};
|
|
3218
|
-
|
|
3219
|
-
marked.getDefaults = getDefaults;
|
|
3220
|
-
marked.defaults = exports.defaults;
|
|
3221
|
-
/**
|
|
3222
|
-
* Use Extension
|
|
3223
|
-
*/
|
|
3224
|
-
|
|
3225
|
-
marked.use = function () {
|
|
3226
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3227
|
-
args[_key] = arguments[_key];
|
|
3228
|
-
}
|
|
3229
|
-
|
|
3230
|
-
var opts = merge.apply(void 0, [{}].concat(args));
|
|
3231
|
-
var extensions = marked.defaults.extensions || {
|
|
3232
|
-
renderers: {},
|
|
3233
|
-
childTokens: {}
|
|
3234
|
-
};
|
|
3235
|
-
var hasExtensions;
|
|
3236
|
-
args.forEach(function (pack) {
|
|
3237
|
-
// ==-- Parse "addon" extensions --== //
|
|
3238
|
-
if (pack.extensions) {
|
|
3239
|
-
hasExtensions = true;
|
|
3240
|
-
pack.extensions.forEach(function (ext) {
|
|
3241
|
-
if (!ext.name) {
|
|
3242
|
-
throw new Error('extension name required');
|
|
3243
|
-
}
|
|
3244
|
-
|
|
3245
|
-
if (ext.renderer) {
|
|
3246
|
-
// Renderer extensions
|
|
3247
|
-
var prevRenderer = extensions.renderers ? extensions.renderers[ext.name] : null;
|
|
3248
|
-
|
|
3249
|
-
if (prevRenderer) {
|
|
3250
|
-
// Replace extension with func to run new extension but fall back if false
|
|
3251
|
-
extensions.renderers[ext.name] = function () {
|
|
3252
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
3253
|
-
args[_key2] = arguments[_key2];
|
|
3254
|
-
}
|
|
3255
|
-
|
|
3256
|
-
var ret = ext.renderer.apply(this, args);
|
|
3257
|
-
|
|
3258
|
-
if (ret === false) {
|
|
3259
|
-
ret = prevRenderer.apply(this, args);
|
|
3260
|
-
}
|
|
3261
|
-
|
|
3262
|
-
return ret;
|
|
3263
|
-
};
|
|
3264
|
-
} else {
|
|
3265
|
-
extensions.renderers[ext.name] = ext.renderer;
|
|
3266
|
-
}
|
|
3267
|
-
}
|
|
3268
|
-
|
|
3269
|
-
if (ext.tokenizer) {
|
|
3270
|
-
// Tokenizer Extensions
|
|
3271
|
-
if (!ext.level || ext.level !== 'block' && ext.level !== 'inline') {
|
|
3272
|
-
throw new Error("extension level must be 'block' or 'inline'");
|
|
3273
|
-
}
|
|
3274
|
-
|
|
3275
|
-
if (extensions[ext.level]) {
|
|
3276
|
-
extensions[ext.level].unshift(ext.tokenizer);
|
|
3277
|
-
} else {
|
|
3278
|
-
extensions[ext.level] = [ext.tokenizer];
|
|
3279
|
-
}
|
|
3280
|
-
|
|
3281
|
-
if (ext.start) {
|
|
3282
|
-
// Function to check for start of token
|
|
3283
|
-
if (ext.level === 'block') {
|
|
3284
|
-
if (extensions.startBlock) {
|
|
3285
|
-
extensions.startBlock.push(ext.start);
|
|
3286
|
-
} else {
|
|
3287
|
-
extensions.startBlock = [ext.start];
|
|
3288
|
-
}
|
|
3289
|
-
} else if (ext.level === 'inline') {
|
|
3290
|
-
if (extensions.startInline) {
|
|
3291
|
-
extensions.startInline.push(ext.start);
|
|
3292
|
-
} else {
|
|
3293
|
-
extensions.startInline = [ext.start];
|
|
3294
|
-
}
|
|
3295
|
-
}
|
|
3296
|
-
}
|
|
3297
|
-
}
|
|
3298
|
-
|
|
3299
|
-
if (ext.childTokens) {
|
|
3300
|
-
// Child tokens to be visited by walkTokens
|
|
3301
|
-
extensions.childTokens[ext.name] = ext.childTokens;
|
|
3302
|
-
}
|
|
3303
|
-
});
|
|
3304
|
-
} // ==-- Parse "overwrite" extensions --== //
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
if (pack.renderer) {
|
|
3308
|
-
(function () {
|
|
3309
|
-
var renderer = marked.defaults.renderer || new Renderer();
|
|
3310
|
-
|
|
3311
|
-
var _loop = function _loop(prop) {
|
|
3312
|
-
var prevRenderer = renderer[prop]; // Replace renderer with func to run extension, but fall back if false
|
|
3313
|
-
|
|
3314
|
-
renderer[prop] = function () {
|
|
3315
|
-
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
3316
|
-
args[_key3] = arguments[_key3];
|
|
3317
|
-
}
|
|
3318
|
-
|
|
3319
|
-
var ret = pack.renderer[prop].apply(renderer, args);
|
|
3320
|
-
|
|
3321
|
-
if (ret === false) {
|
|
3322
|
-
ret = prevRenderer.apply(renderer, args);
|
|
3323
|
-
}
|
|
3324
|
-
|
|
3325
|
-
return ret;
|
|
3326
|
-
};
|
|
3327
|
-
};
|
|
3328
|
-
|
|
3329
|
-
for (var prop in pack.renderer) {
|
|
3330
|
-
_loop(prop);
|
|
3331
|
-
}
|
|
3332
|
-
|
|
3333
|
-
opts.renderer = renderer;
|
|
3334
|
-
})();
|
|
3335
|
-
}
|
|
3336
|
-
|
|
3337
|
-
if (pack.tokenizer) {
|
|
3338
|
-
(function () {
|
|
3339
|
-
var tokenizer = marked.defaults.tokenizer || new Tokenizer();
|
|
3340
|
-
|
|
3341
|
-
var _loop2 = function _loop2(prop) {
|
|
3342
|
-
var prevTokenizer = tokenizer[prop]; // Replace tokenizer with func to run extension, but fall back if false
|
|
3343
|
-
|
|
3344
|
-
tokenizer[prop] = function () {
|
|
3345
|
-
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
3346
|
-
args[_key4] = arguments[_key4];
|
|
3347
|
-
}
|
|
3348
|
-
|
|
3349
|
-
var ret = pack.tokenizer[prop].apply(tokenizer, args);
|
|
3350
|
-
|
|
3351
|
-
if (ret === false) {
|
|
3352
|
-
ret = prevTokenizer.apply(tokenizer, args);
|
|
3353
|
-
}
|
|
3354
|
-
|
|
3355
|
-
return ret;
|
|
3356
|
-
};
|
|
3357
|
-
};
|
|
3358
|
-
|
|
3359
|
-
for (var prop in pack.tokenizer) {
|
|
3360
|
-
_loop2(prop);
|
|
3361
|
-
}
|
|
3362
|
-
|
|
3363
|
-
opts.tokenizer = tokenizer;
|
|
3364
|
-
})();
|
|
3365
|
-
} // ==-- Parse WalkTokens extensions --== //
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
if (pack.walkTokens) {
|
|
3369
|
-
var _walkTokens = marked.defaults.walkTokens;
|
|
3370
|
-
|
|
3371
|
-
opts.walkTokens = function (token) {
|
|
3372
|
-
var values = [];
|
|
3373
|
-
values.push(pack.walkTokens.call(this, token));
|
|
3374
|
-
|
|
3375
|
-
if (_walkTokens) {
|
|
3376
|
-
values = values.concat(_walkTokens.call(this, token));
|
|
3377
|
-
}
|
|
3378
|
-
|
|
3379
|
-
return values;
|
|
3380
|
-
};
|
|
3381
|
-
}
|
|
3382
|
-
|
|
3383
|
-
if (hasExtensions) {
|
|
3384
|
-
opts.extensions = extensions;
|
|
3385
|
-
}
|
|
3386
|
-
|
|
3387
|
-
marked.setOptions(opts);
|
|
3388
|
-
});
|
|
3389
|
-
};
|
|
3390
|
-
/**
|
|
3391
|
-
* Run callback for every token
|
|
3392
|
-
*/
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
marked.walkTokens = function (tokens, callback) {
|
|
3396
|
-
var values = [];
|
|
3397
|
-
|
|
3398
|
-
var _loop3 = function _loop3() {
|
|
3399
|
-
var token = _step.value;
|
|
3400
|
-
values = values.concat(callback.call(marked, token));
|
|
3401
|
-
|
|
3402
|
-
switch (token.type) {
|
|
3403
|
-
case 'table':
|
|
3404
|
-
{
|
|
3405
|
-
for (var _iterator2 = _createForOfIteratorHelperLoose(token.header), _step2; !(_step2 = _iterator2()).done;) {
|
|
3406
|
-
var cell = _step2.value;
|
|
3407
|
-
values = values.concat(marked.walkTokens(cell.tokens, callback));
|
|
3408
|
-
}
|
|
3409
|
-
|
|
3410
|
-
for (var _iterator3 = _createForOfIteratorHelperLoose(token.rows), _step3; !(_step3 = _iterator3()).done;) {
|
|
3411
|
-
var row = _step3.value;
|
|
3412
|
-
|
|
3413
|
-
for (var _iterator4 = _createForOfIteratorHelperLoose(row), _step4; !(_step4 = _iterator4()).done;) {
|
|
3414
|
-
var _cell = _step4.value;
|
|
3415
|
-
values = values.concat(marked.walkTokens(_cell.tokens, callback));
|
|
3416
|
-
}
|
|
3417
|
-
}
|
|
3418
|
-
|
|
3419
|
-
break;
|
|
3420
|
-
}
|
|
3421
|
-
|
|
3422
|
-
case 'list':
|
|
3423
|
-
{
|
|
3424
|
-
values = values.concat(marked.walkTokens(token.items, callback));
|
|
3425
|
-
break;
|
|
3426
|
-
}
|
|
3427
|
-
|
|
3428
|
-
default:
|
|
3429
|
-
{
|
|
3430
|
-
if (marked.defaults.extensions && marked.defaults.extensions.childTokens && marked.defaults.extensions.childTokens[token.type]) {
|
|
3431
|
-
// Walk any extensions
|
|
3432
|
-
marked.defaults.extensions.childTokens[token.type].forEach(function (childTokens) {
|
|
3433
|
-
values = values.concat(marked.walkTokens(token[childTokens], callback));
|
|
3434
|
-
});
|
|
3435
|
-
} else if (token.tokens) {
|
|
3436
|
-
values = values.concat(marked.walkTokens(token.tokens, callback));
|
|
3437
|
-
}
|
|
3438
|
-
}
|
|
3439
|
-
}
|
|
3440
|
-
};
|
|
3441
|
-
|
|
3442
|
-
for (var _iterator = _createForOfIteratorHelperLoose(tokens), _step; !(_step = _iterator()).done;) {
|
|
3443
|
-
_loop3();
|
|
3444
|
-
}
|
|
3445
|
-
|
|
3446
|
-
return values;
|
|
3447
|
-
};
|
|
3448
|
-
/**
|
|
3449
|
-
* Parse Inline
|
|
3450
|
-
* @param {string} src
|
|
3451
|
-
*/
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
marked.parseInline = function (src, opt) {
|
|
3455
|
-
// throw error in case of non string input
|
|
3456
|
-
if (typeof src === 'undefined' || src === null) {
|
|
3457
|
-
throw new Error('marked.parseInline(): input parameter is undefined or null');
|
|
3458
|
-
}
|
|
3459
|
-
|
|
3460
|
-
if (typeof src !== 'string') {
|
|
3461
|
-
throw new Error('marked.parseInline(): input parameter is of type ' + Object.prototype.toString.call(src) + ', string expected');
|
|
3462
|
-
}
|
|
3463
|
-
|
|
3464
|
-
opt = merge({}, marked.defaults, opt || {});
|
|
3465
|
-
checkSanitizeDeprecation(opt);
|
|
3466
|
-
|
|
3467
|
-
try {
|
|
3468
|
-
var tokens = Lexer.lexInline(src, opt);
|
|
415
|
+
/***/ }),
|
|
3469
416
|
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
}
|
|
417
|
+
/***/ "7267":
|
|
418
|
+
/***/ (function(module, exports) {
|
|
3473
419
|
|
|
3474
|
-
|
|
3475
|
-
} catch (e) {
|
|
3476
|
-
e.message += '\nPlease report this to https://github.com/markedjs/marked.';
|
|
420
|
+
module.exports = require("core-js/modules/es.math.to-string-tag.js");
|
|
3477
421
|
|
|
3478
|
-
|
|
3479
|
-
return '<p>An error occurred:</p><pre>' + escape(e.message + '', true) + '</pre>';
|
|
3480
|
-
}
|
|
422
|
+
/***/ }),
|
|
3481
423
|
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
};
|
|
3485
|
-
/**
|
|
3486
|
-
* Expose
|
|
3487
|
-
*/
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
marked.Parser = Parser;
|
|
3491
|
-
marked.parser = Parser.parse;
|
|
3492
|
-
marked.Renderer = Renderer;
|
|
3493
|
-
marked.TextRenderer = TextRenderer;
|
|
3494
|
-
marked.Lexer = Lexer;
|
|
3495
|
-
marked.lexer = Lexer.lex;
|
|
3496
|
-
marked.Tokenizer = Tokenizer;
|
|
3497
|
-
marked.Slugger = Slugger;
|
|
3498
|
-
marked.parse = marked;
|
|
3499
|
-
var options = marked.options;
|
|
3500
|
-
var setOptions = marked.setOptions;
|
|
3501
|
-
var use = marked.use;
|
|
3502
|
-
var walkTokens = marked.walkTokens;
|
|
3503
|
-
var parseInline = marked.parseInline;
|
|
3504
|
-
var parse = marked;
|
|
3505
|
-
var parser = Parser.parse;
|
|
3506
|
-
var lexer = Lexer.lex;
|
|
3507
|
-
|
|
3508
|
-
exports.Lexer = Lexer;
|
|
3509
|
-
exports.Parser = Parser;
|
|
3510
|
-
exports.Renderer = Renderer;
|
|
3511
|
-
exports.Slugger = Slugger;
|
|
3512
|
-
exports.TextRenderer = TextRenderer;
|
|
3513
|
-
exports.Tokenizer = Tokenizer;
|
|
3514
|
-
exports.getDefaults = getDefaults;
|
|
3515
|
-
exports.lexer = lexer;
|
|
3516
|
-
exports.marked = marked;
|
|
3517
|
-
exports.options = options;
|
|
3518
|
-
exports.parse = parse;
|
|
3519
|
-
exports.parseInline = parseInline;
|
|
3520
|
-
exports.parser = parser;
|
|
3521
|
-
exports.setOptions = setOptions;
|
|
3522
|
-
exports.use = use;
|
|
3523
|
-
exports.walkTokens = walkTokens;
|
|
3524
|
-
|
|
3525
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3526
|
-
|
|
3527
|
-
}));
|
|
424
|
+
/***/ "7664":
|
|
425
|
+
/***/ (function(module, exports) {
|
|
3528
426
|
|
|
427
|
+
module.exports = require("core-js/modules/es.object.get-own-property-descriptors.js");
|
|
3529
428
|
|
|
3530
429
|
/***/ }),
|
|
3531
430
|
|
|
3532
|
-
/***/ "
|
|
431
|
+
/***/ "7949":
|
|
3533
432
|
/***/ (function(module, exports) {
|
|
3534
433
|
|
|
3535
|
-
module.exports = require("
|
|
434
|
+
module.exports = require("core-js/modules/es.object.proto.js");
|
|
3536
435
|
|
|
3537
436
|
/***/ }),
|
|
3538
437
|
|
|
@@ -3541,6 +440,17 @@ module.exports = require("element-ui/lib/link");
|
|
|
3541
440
|
|
|
3542
441
|
module.exports = require("element-ui/lib/locale");
|
|
3543
442
|
|
|
443
|
+
/***/ }),
|
|
444
|
+
|
|
445
|
+
/***/ "8017":
|
|
446
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
447
|
+
|
|
448
|
+
"use strict";
|
|
449
|
+
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_9_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_9_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_9_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_9_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_SidebarContent_vue_vue_type_style_index_0_id_29231cf0_prod_scoped_true_lang_scss___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("adf3");
|
|
450
|
+
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_9_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_9_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_9_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_9_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_SidebarContent_vue_vue_type_style_index_0_id_29231cf0_prod_scoped_true_lang_scss___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_9_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_9_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_9_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_9_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_SidebarContent_vue_vue_type_style_index_0_id_29231cf0_prod_scoped_true_lang_scss___WEBPACK_IMPORTED_MODULE_0__);
|
|
451
|
+
/* unused harmony reexport * */
|
|
452
|
+
|
|
453
|
+
|
|
3544
454
|
/***/ }),
|
|
3545
455
|
|
|
3546
456
|
/***/ "80c4":
|
|
@@ -3662,13 +572,6 @@ module.exports = require("@abi-software/gallery/src/mixins/GalleryHelpers");
|
|
|
3662
572
|
|
|
3663
573
|
/***/ }),
|
|
3664
574
|
|
|
3665
|
-
/***/ "a290":
|
|
3666
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
3667
|
-
|
|
3668
|
-
// extracted by mini-css-extract-plugin
|
|
3669
|
-
|
|
3670
|
-
/***/ }),
|
|
3671
|
-
|
|
3672
575
|
/***/ "a525":
|
|
3673
576
|
/***/ (function(module, exports) {
|
|
3674
577
|
|
|
@@ -3718,7 +621,7 @@ module.exports = require("core-js/modules/es.object.assign.js");
|
|
|
3718
621
|
|
|
3719
622
|
/***/ }),
|
|
3720
623
|
|
|
3721
|
-
/***/ "
|
|
624
|
+
/***/ "adf3":
|
|
3722
625
|
/***/ (function(module, exports, __webpack_require__) {
|
|
3723
626
|
|
|
3724
627
|
// extracted by mini-css-extract-plugin
|
|
@@ -3805,17 +708,6 @@ module.exports = require("core-js/modules/es.regexp.exec.js");
|
|
|
3805
708
|
|
|
3806
709
|
module.exports = require("core-js/modules/es.array.concat.js");
|
|
3807
710
|
|
|
3808
|
-
/***/ }),
|
|
3809
|
-
|
|
3810
|
-
/***/ "d019":
|
|
3811
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
3812
|
-
|
|
3813
|
-
"use strict";
|
|
3814
|
-
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_9_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_9_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_9_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_9_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_SidebarContent_vue_vue_type_style_index_0_id_35b8b64a_prod_scoped_true_lang_scss___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("a290");
|
|
3815
|
-
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_9_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_9_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_9_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_9_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_SidebarContent_vue_vue_type_style_index_0_id_35b8b64a_prod_scoped_true_lang_scss___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_9_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_9_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_9_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_9_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_SidebarContent_vue_vue_type_style_index_0_id_35b8b64a_prod_scoped_true_lang_scss___WEBPACK_IMPORTED_MODULE_0__);
|
|
3816
|
-
/* unused harmony reexport * */
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
711
|
/***/ }),
|
|
3820
712
|
|
|
3821
713
|
/***/ "da6e":
|
|
@@ -3874,13 +766,6 @@ module.exports = require("core-js/modules/es.promise.js");
|
|
|
3874
766
|
|
|
3875
767
|
/***/ }),
|
|
3876
768
|
|
|
3877
|
-
/***/ "efde":
|
|
3878
|
-
/***/ (function(module, exports) {
|
|
3879
|
-
|
|
3880
|
-
module.exports = require("xss");
|
|
3881
|
-
|
|
3882
|
-
/***/ }),
|
|
3883
|
-
|
|
3884
769
|
/***/ "f3b8":
|
|
3885
770
|
/***/ (function(module, exports) {
|
|
3886
771
|
|
|
@@ -4572,8 +1457,8 @@ var en_default = /*#__PURE__*/__webpack_require__.n(en_);
|
|
|
4572
1457
|
var locale_ = __webpack_require__("7f9f");
|
|
4573
1458
|
var locale_default = /*#__PURE__*/__webpack_require__.n(locale_);
|
|
4574
1459
|
|
|
4575
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"fb6f3a7c-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/SidebarContent.vue?vue&type=template&id=
|
|
4576
|
-
var
|
|
1460
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"fb6f3a7c-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/SidebarContent.vue?vue&type=template&id=29231cf0&scoped=true&
|
|
1461
|
+
var SidebarContentvue_type_template_id_29231cf0_scoped_true_render = function render() {
|
|
4577
1462
|
var _vm = this,
|
|
4578
1463
|
_c = _vm._self._c;
|
|
4579
1464
|
return _c('el-card', {
|
|
@@ -4587,12 +1472,7 @@ var SidebarContentvue_type_template_id_35b8b64a_scoped_true_render = function re
|
|
|
4587
1472
|
"slot": "header"
|
|
4588
1473
|
},
|
|
4589
1474
|
slot: "header"
|
|
4590
|
-
}, [
|
|
4591
|
-
attrs: {
|
|
4592
|
-
"entry": _vm.contextCardEntry,
|
|
4593
|
-
"envVars": _vm.envVars
|
|
4594
|
-
}
|
|
4595
|
-
}) : _vm._e(), _c('el-input', {
|
|
1475
|
+
}, [_c('el-input', {
|
|
4596
1476
|
staticClass: "search-input",
|
|
4597
1477
|
attrs: {
|
|
4598
1478
|
"placeholder": "Search",
|
|
@@ -4650,9 +1530,6 @@ var SidebarContentvue_type_template_id_35b8b64a_scoped_true_render = function re
|
|
|
4650
1530
|
attrs: {
|
|
4651
1531
|
"entry": result,
|
|
4652
1532
|
"envVars": _vm.envVars
|
|
4653
|
-
},
|
|
4654
|
-
on: {
|
|
4655
|
-
"contextUpdate": _vm.contextCardUpdate
|
|
4656
1533
|
}
|
|
4657
1534
|
})], 1);
|
|
4658
1535
|
}), _c('el-pagination', {
|
|
@@ -4676,9 +1553,9 @@ var SidebarContentvue_type_template_id_35b8b64a_scoped_true_render = function re
|
|
|
4676
1553
|
}
|
|
4677
1554
|
})], 2)], 1);
|
|
4678
1555
|
};
|
|
4679
|
-
var
|
|
1556
|
+
var SidebarContentvue_type_template_id_29231cf0_scoped_true_staticRenderFns = [];
|
|
4680
1557
|
|
|
4681
|
-
// CONCATENATED MODULE: ./src/components/SidebarContent.vue?vue&type=template&id=
|
|
1558
|
+
// CONCATENATED MODULE: ./src/components/SidebarContent.vue?vue&type=template&id=29231cf0&scoped=true&
|
|
4682
1559
|
|
|
4683
1560
|
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
|
|
4684
1561
|
function _arrayLikeToArray(arr, len) {
|
|
@@ -7068,551 +3945,6 @@ var DatasetCard_component = normalizeComponent(
|
|
|
7068
3945
|
)
|
|
7069
3946
|
|
|
7070
3947
|
/* harmony default export */ var DatasetCard = (DatasetCard_component.exports);
|
|
7071
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"fb6f3a7c-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/ContextCard.vue?vue&type=template&id=1221ea8f&scoped=true&
|
|
7072
|
-
|
|
7073
|
-
|
|
7074
|
-
|
|
7075
|
-
var ContextCardvue_type_template_id_1221ea8f_scoped_true_render = function render() {
|
|
7076
|
-
var _vm = this,
|
|
7077
|
-
_c = _vm._self._c;
|
|
7078
|
-
return _c('div', {
|
|
7079
|
-
ref: "container",
|
|
7080
|
-
staticClass: "context-card-container"
|
|
7081
|
-
}, [_c('div', {
|
|
7082
|
-
directives: [{
|
|
7083
|
-
name: "show",
|
|
7084
|
-
rawName: "v-show",
|
|
7085
|
-
value: _vm.showContextCard,
|
|
7086
|
-
expression: "showContextCard"
|
|
7087
|
-
}]
|
|
7088
|
-
}, [_c('div', {
|
|
7089
|
-
directives: [{
|
|
7090
|
-
name: "show",
|
|
7091
|
-
rawName: "v-show",
|
|
7092
|
-
value: _vm.showDetails,
|
|
7093
|
-
expression: "showDetails"
|
|
7094
|
-
}],
|
|
7095
|
-
staticClass: "hide",
|
|
7096
|
-
on: {
|
|
7097
|
-
"click": function click($event) {
|
|
7098
|
-
_vm.showDetails = !_vm.showDetails;
|
|
7099
|
-
}
|
|
7100
|
-
}
|
|
7101
|
-
}, [_vm._v("Hide information"), _c('i', {
|
|
7102
|
-
staticClass: "el-icon-arrow-up"
|
|
7103
|
-
})]), _c('div', {
|
|
7104
|
-
directives: [{
|
|
7105
|
-
name: "show",
|
|
7106
|
-
rawName: "v-show",
|
|
7107
|
-
value: !_vm.showDetails,
|
|
7108
|
-
expression: "!showDetails"
|
|
7109
|
-
}],
|
|
7110
|
-
staticClass: "hide",
|
|
7111
|
-
on: {
|
|
7112
|
-
"click": function click($event) {
|
|
7113
|
-
_vm.showDetails = !_vm.showDetails;
|
|
7114
|
-
}
|
|
7115
|
-
}
|
|
7116
|
-
}, [_vm._v("Show information"), _c('i', {
|
|
7117
|
-
staticClass: "el-icon-arrow-down"
|
|
7118
|
-
})]), _vm.showDetails && Object.keys(_vm.contextData).length !== 0 ? _c('el-card', {
|
|
7119
|
-
directives: [{
|
|
7120
|
-
name: "loading",
|
|
7121
|
-
rawName: "v-loading",
|
|
7122
|
-
value: _vm.loading,
|
|
7123
|
-
expression: "loading"
|
|
7124
|
-
}],
|
|
7125
|
-
staticClass: "context-card"
|
|
7126
|
-
}, [_c('div', {
|
|
7127
|
-
staticClass: "card-left"
|
|
7128
|
-
}, [_c('img', {
|
|
7129
|
-
staticClass: "context-image",
|
|
7130
|
-
attrs: {
|
|
7131
|
-
"src": _vm.banner
|
|
7132
|
-
}
|
|
7133
|
-
})]), _c('div', {
|
|
7134
|
-
staticClass: "card-right scrollbar"
|
|
7135
|
-
}, [_c('div', {
|
|
7136
|
-
staticClass: "title"
|
|
7137
|
-
}, [_vm._v(_vm._s(_vm.contextData.heading))]), _c('div', {
|
|
7138
|
-
domProps: {
|
|
7139
|
-
"innerHTML": _vm._s(_vm.parseMarkdown(_vm.contextData.description))
|
|
7140
|
-
}
|
|
7141
|
-
}), _c('br'), !_vm.samplesUnderViews ? [_vm.contextData.views && _vm.contextData.views.length > 0 ? _c('div', {
|
|
7142
|
-
staticClass: "subtitle"
|
|
7143
|
-
}, [_vm._v("Scaffold Views")]) : _vm._e(), _vm._l(_vm.contextData.views, function (view, i) {
|
|
7144
|
-
return [_c('div', {
|
|
7145
|
-
key: i + '_1',
|
|
7146
|
-
staticClass: "context-card-view",
|
|
7147
|
-
on: {
|
|
7148
|
-
"click": function click($event) {
|
|
7149
|
-
return _vm.openViewFile(view);
|
|
7150
|
-
}
|
|
7151
|
-
}
|
|
7152
|
-
}, [_c('img', {
|
|
7153
|
-
staticClass: "view-image",
|
|
7154
|
-
attrs: {
|
|
7155
|
-
"src": _vm.getFileFromPath(view.thumbnail)
|
|
7156
|
-
}
|
|
7157
|
-
}), _c('div', {
|
|
7158
|
-
staticClass: "view-description"
|
|
7159
|
-
}, [_vm._v(_vm._s(view.description))])]), _c('div', {
|
|
7160
|
-
key: i,
|
|
7161
|
-
staticClass: "padding"
|
|
7162
|
-
})];
|
|
7163
|
-
}), _c('div', {
|
|
7164
|
-
staticStyle: {
|
|
7165
|
-
"margin-bottom": "16px"
|
|
7166
|
-
}
|
|
7167
|
-
}), _vm.contextData.samples && _vm.contextData.samples.length > 0 ? _c('div', {
|
|
7168
|
-
staticClass: "subtitle"
|
|
7169
|
-
}, [_vm._v("Samples on Scaffold")]) : _vm._e(), _vm._l(_vm.contextData.samples, function (sample, i) {
|
|
7170
|
-
return [_c('span', {
|
|
7171
|
-
key: i + '_3',
|
|
7172
|
-
staticClass: "context-card-item cursor-pointer",
|
|
7173
|
-
on: {
|
|
7174
|
-
"click": function click($event) {
|
|
7175
|
-
return _vm.toggleSampleDetails(i);
|
|
7176
|
-
}
|
|
7177
|
-
}
|
|
7178
|
-
}, [_c('div', {
|
|
7179
|
-
key: i + '_6',
|
|
7180
|
-
staticStyle: {
|
|
7181
|
-
"display": "flex"
|
|
7182
|
-
}
|
|
7183
|
-
}, [sample.color ? _c('div', {
|
|
7184
|
-
staticClass: "color-box",
|
|
7185
|
-
style: 'background-color:' + sample.color
|
|
7186
|
-
}) : sample.thumbnail ? _c('img', {
|
|
7187
|
-
staticClass: "key-image",
|
|
7188
|
-
attrs: {
|
|
7189
|
-
"src": _vm.getFileFromPath(sample.thumbnail)
|
|
7190
|
-
}
|
|
7191
|
-
}) : _vm._e(), _vm._v(" " + _vm._s(sample.heading) + " "), _c('i', {
|
|
7192
|
-
staticClass: "el-icon-warning-outline info"
|
|
7193
|
-
})])]), _vm.sampleDetails[i] ? _c('div', {
|
|
7194
|
-
key: i + '_4',
|
|
7195
|
-
domProps: {
|
|
7196
|
-
"innerHTML": _vm._s(sample.description)
|
|
7197
|
-
}
|
|
7198
|
-
}) : _vm._e(), _vm.sampleDetails[i] && sample.path ? _c('a', {
|
|
7199
|
-
key: i + '_5',
|
|
7200
|
-
attrs: {
|
|
7201
|
-
"href": _vm.generateFileLink(sample),
|
|
7202
|
-
"target": "_blank"
|
|
7203
|
-
}
|
|
7204
|
-
}, [_vm._v("View Source")]) : _vm._e(), _c('div', {
|
|
7205
|
-
key: i + '_2',
|
|
7206
|
-
staticClass: "padding"
|
|
7207
|
-
})];
|
|
7208
|
-
})] : [_vm.contextData.views && _vm.contextData.views.length > 0 ? _c('div', {
|
|
7209
|
-
staticClass: "subtitle"
|
|
7210
|
-
}, [_vm._v("Scaffold Views")]) : _vm._e(), _vm._l(_vm.contextData.views, function (view, i) {
|
|
7211
|
-
return [_c('span', {
|
|
7212
|
-
key: i + '_1',
|
|
7213
|
-
staticClass: "context-card-view",
|
|
7214
|
-
on: {
|
|
7215
|
-
"click": function click($event) {
|
|
7216
|
-
return _vm.viewClicked(view, i);
|
|
7217
|
-
}
|
|
7218
|
-
}
|
|
7219
|
-
}, [_c('img', {
|
|
7220
|
-
staticClass: "view-image",
|
|
7221
|
-
attrs: {
|
|
7222
|
-
"src": _vm.getFileFromPath(view.thumbnail)
|
|
7223
|
-
}
|
|
7224
|
-
}), _c('div', {
|
|
7225
|
-
staticClass: "view-description"
|
|
7226
|
-
}, [_vm._v(_vm._s(view.description)), _c('i', {
|
|
7227
|
-
staticClass: "el-icon-warning-outline info"
|
|
7228
|
-
})])]), _vm.sampleDetails[i] ? _c('div', {
|
|
7229
|
-
key: i + '_2',
|
|
7230
|
-
domProps: {
|
|
7231
|
-
"innerHTML": _vm._s(_vm.samplesMatching(view.id).description)
|
|
7232
|
-
}
|
|
7233
|
-
}) : _vm._e(), _vm.sampleDetails[i] && _vm.samplesMatching(view.id).path ? _c('a', {
|
|
7234
|
-
key: i + '_5',
|
|
7235
|
-
attrs: {
|
|
7236
|
-
"href": _vm.generateFileLink(_vm.samplesMatching(view.id)),
|
|
7237
|
-
"target": "_blank"
|
|
7238
|
-
}
|
|
7239
|
-
}, [_vm._v("View Source")]) : _vm._e(), _c('div', {
|
|
7240
|
-
key: i,
|
|
7241
|
-
staticClass: "padding"
|
|
7242
|
-
}), _vm.sampleDetails[i] ? _c('div', {
|
|
7243
|
-
key: i + '_6',
|
|
7244
|
-
staticClass: "padding"
|
|
7245
|
-
}) : _vm._e()];
|
|
7246
|
-
})]], 2)]) : _vm._e()], 1)]);
|
|
7247
|
-
};
|
|
7248
|
-
var ContextCardvue_type_template_id_1221ea8f_scoped_true_staticRenderFns = [];
|
|
7249
|
-
|
|
7250
|
-
// CONCATENATED MODULE: ./src/components/ContextCard.vue?vue&type=template&id=1221ea8f&scoped=true&
|
|
7251
|
-
|
|
7252
|
-
// EXTERNAL MODULE: external "element-ui/lib/theme-chalk/link.css"
|
|
7253
|
-
var link_css_ = __webpack_require__("230a");
|
|
7254
|
-
|
|
7255
|
-
// EXTERNAL MODULE: external "element-ui/lib/link"
|
|
7256
|
-
var link_ = __webpack_require__("7db7");
|
|
7257
|
-
var link_default = /*#__PURE__*/__webpack_require__.n(link_);
|
|
7258
|
-
|
|
7259
|
-
// CONCATENATED MODULE: ./src/components/hardcoded-context-info.js
|
|
7260
|
-
/* harmony default export */ var hardcoded_context_info = ({});
|
|
7261
|
-
// //Uncomment the code below to add in hardcoded data
|
|
7262
|
-
// export default {
|
|
7263
|
-
// 77: {
|
|
7264
|
-
// "description": "This dataset contains single cell scale anatomical map of the rat intrinsic cardiac nervous system (ICNS) across four male and three female hearts. These cell clusters can be seen by the yellow data points on the image as well as spherical markers on the 3D heart scaffold. The dataset provides an integrative framework to visualise the spatial distribution of ICNS across different hearts.",
|
|
7265
|
-
// "heading": "Mapped ICN samples",
|
|
7266
|
-
// "id": "sparc.science.context_data",
|
|
7267
|
-
// "samples": [
|
|
7268
|
-
// {
|
|
7269
|
-
// "annotation": "",
|
|
7270
|
-
// "description": "Spatial location of isolated ICNS mapped onto a generic heart scaffold",
|
|
7271
|
-
// "doi": "",
|
|
7272
|
-
// "heading": "ICNS from subject M54-8",
|
|
7273
|
-
// "id": "Sample 1",
|
|
7274
|
-
// "path": "",
|
|
7275
|
-
// "view": "View 1",
|
|
7276
|
-
// "color": "#FFFF00",
|
|
7277
|
-
// "thumbnail": "https://raw.githubusercontent.com/ABI-Software/map-sidebar/main/assets/temp-pics/orange.png"
|
|
7278
|
-
// },
|
|
7279
|
-
// {
|
|
7280
|
-
// "annotation": "",
|
|
7281
|
-
// "description": "Spatial location of isolated ICNS mapped onto a generic heart scaffold",
|
|
7282
|
-
// "doi": "",
|
|
7283
|
-
// "heading": "ICNS from subject M54-5",
|
|
7284
|
-
// "id": "Sample 2",
|
|
7285
|
-
// "path": "",
|
|
7286
|
-
// "view": "View 2",
|
|
7287
|
-
// "color": "#FFA500",
|
|
7288
|
-
// "thumbnail": "https://raw.githubusercontent.com/ABI-Software/map-sidebar/main/assets/temp-pics/teal.png"
|
|
7289
|
-
// }
|
|
7290
|
-
// ],
|
|
7291
|
-
// "version": "0.1.0",
|
|
7292
|
-
// },
|
|
7293
|
-
// 221: {
|
|
7294
|
-
// "description": "3D digital tracings of the enteric plexus obtained from seven subjects (M11, M16, M162, M163, M164, M168) are mapped randomly on mouse proximal colon. The data depicts individual neural wiring patterns in enteric microcircuits, and revealed both neuron and fiber units wired in a complex organization.",
|
|
7295
|
-
// "heading": "Digital tracings of enteric plexus",
|
|
7296
|
-
// "id": "sparc.science.context_data",
|
|
7297
|
-
// "samples": [
|
|
7298
|
-
// {
|
|
7299
|
-
// "annotation": "",
|
|
7300
|
-
// "description": "Neuronal soma and fibers in a myenteric ganglion in this subject are annotated into the following groups to highlight their interactions:\n\nNeuron1,2,3 Connex: Connections between 3 neurons and cross-ganglionic fibers\n\nNeuron4_Connex: A small neuron contacts fibers passing the ganglion\n\nNeuron5: Multiple projections of a neuron in an myenteric ganglion\n\nNeuron5,3,7 Connex: Connections between 3 neurons, nerve fibers, IGNEx (complex type of intraganglionic nerve endings) and fibers in the circular muscles.\n\nNeuron8,9,10 Connex: Connections of 3 neurons with each other and with long passing fibers. \n\nIntraganglionic Nerve Ending (IGNE): Digital traces of neurites consist of complex intraganglionic nerve endings. The blue fiber has branched terminals, more likely the afferent nerve endings; the violet and cyan terminals also interweave into the fiber nest; the orange, pink and peach fibers and one process of the neuron cross the IGNE to make 1-2 conjunctions. \n",
|
|
7301
|
-
// "doi": "",
|
|
7302
|
-
// "heading": "Digital tracing for subject M11",
|
|
7303
|
-
// "id": "Sample 1",
|
|
7304
|
-
// "path": "files/derivative/sub-M11/sam-pCm11/digital-traces/pC PHPS XFP M11 20XZ 180425_180713_2_NL_20.xml",
|
|
7305
|
-
// "view": "View 1"
|
|
7306
|
-
// },
|
|
7307
|
-
// {
|
|
7308
|
-
// "annotation": "",
|
|
7309
|
-
// "description": "This digital trace demonstrates some types of wiring. A long process of the green neuron terminates in the intraganglionic nerve endings (IGNE) while in contact with a nerve fiber (cyan), soma of a neuron (peach) and processes of 3 neurons (magenta, yellow and red). Two neurons and one fiber are traced to an IGNE. ",
|
|
7310
|
-
// "doi": "",
|
|
7311
|
-
// "heading": "Digital tracing for subject M16",
|
|
7312
|
-
// "id": "Sample 2",
|
|
7313
|
-
// "path": "files/derivative/sub-M16/sam-pCm16/digital-traces/pC PHPS XFP M16 20XZ 180425_180524.xml",
|
|
7314
|
-
// "view": "View 2"
|
|
7315
|
-
// }
|
|
7316
|
-
// ],
|
|
7317
|
-
// "version": "0.1.0",
|
|
7318
|
-
// "views": [
|
|
7319
|
-
// {
|
|
7320
|
-
// "annotation": "--",
|
|
7321
|
-
// "description": "Digital tracing of neurons for subject M11.",
|
|
7322
|
-
// "id": "View 1",
|
|
7323
|
-
// "path": "files/derivative/Scaffolds/M11_view.json",
|
|
7324
|
-
// "sample": "Sample 1",
|
|
7325
|
-
// "thumbnail": "https://api.sparc.science/s3-resource/221/2/files/derivative/Scaffolds/M11_thumbnail.jpeg"
|
|
7326
|
-
// },
|
|
7327
|
-
// {
|
|
7328
|
-
// "annotation": "--",
|
|
7329
|
-
// "description": "Digital tracing of neurons for subject M16.",
|
|
7330
|
-
// "id": "View 2",
|
|
7331
|
-
// "path": "files/derivative/Scaffolds/M16_view.json",
|
|
7332
|
-
// "sample": "Sample 2",
|
|
7333
|
-
// "thumbnail": "https://api.sparc.science/s3-resource/221/2/files/derivative/Scaffolds/M16_thumbnail.jpeg"
|
|
7334
|
-
// }
|
|
7335
|
-
// ]
|
|
7336
|
-
// }
|
|
7337
|
-
// }
|
|
7338
|
-
// EXTERNAL MODULE: ./node_modules/marked/lib/marked.umd.js
|
|
7339
|
-
var marked_umd = __webpack_require__("7c5c");
|
|
7340
|
-
|
|
7341
|
-
// EXTERNAL MODULE: external "xss"
|
|
7342
|
-
var external_xss_ = __webpack_require__("efde");
|
|
7343
|
-
var external_xss_default = /*#__PURE__*/__webpack_require__.n(external_xss_);
|
|
7344
|
-
|
|
7345
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/ContextCard.vue?vue&type=script&lang=js&
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
|
|
7356
|
-
|
|
7357
|
-
|
|
7358
|
-
|
|
7359
|
-
|
|
7360
|
-
|
|
7361
|
-
|
|
7362
|
-
|
|
7363
|
-
|
|
7364
|
-
|
|
7365
|
-
|
|
7366
|
-
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
|
|
7370
|
-
|
|
7371
|
-
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
|
|
7376
|
-
/* eslint-disable no-alert, no-console */
|
|
7377
|
-
|
|
7378
|
-
|
|
7379
|
-
|
|
7380
|
-
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
//provide the s3Bucket related methods and data.
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
locale_default.a.use(en_default.a);
|
|
7388
|
-
external_vue_default.a.use(link_default.a);
|
|
7389
|
-
external_vue_default.a.use(icon_default.a);
|
|
7390
|
-
external_vue_default.a.use(card_default.a);
|
|
7391
|
-
external_vue_default.a.use(button_default.a);
|
|
7392
|
-
external_vue_default.a.use(select_default.a);
|
|
7393
|
-
external_vue_default.a.use(input_default.a);
|
|
7394
|
-
var addFilesToPathIfMissing = function addFilesToPathIfMissing(path) {
|
|
7395
|
-
if (!path.includes('files')) {
|
|
7396
|
-
return 'files/' + path;
|
|
7397
|
-
} else {
|
|
7398
|
-
return path;
|
|
7399
|
-
}
|
|
7400
|
-
};
|
|
7401
|
-
var convertBackslashToForwardSlash = function convertBackslashToForwardSlash(path) {
|
|
7402
|
-
path = path.replaceAll('\\', '/');
|
|
7403
|
-
path = path.replaceAll('\\\\', '/');
|
|
7404
|
-
return path;
|
|
7405
|
-
};
|
|
7406
|
-
|
|
7407
|
-
// const switchPathToDirectory = function(path){
|
|
7408
|
-
// let newPath = path.split('/')
|
|
7409
|
-
// newPath.pop()
|
|
7410
|
-
// return newPath.join('/')
|
|
7411
|
-
// }
|
|
7412
|
-
|
|
7413
|
-
/* harmony default export */ var ContextCardvue_type_script_lang_js_ = ({
|
|
7414
|
-
name: "contextCard",
|
|
7415
|
-
mixins: [S3Bucket],
|
|
7416
|
-
props: {
|
|
7417
|
-
/**
|
|
7418
|
-
* Object containing information for
|
|
7419
|
-
* the required viewing.
|
|
7420
|
-
*/
|
|
7421
|
-
entry: Object,
|
|
7422
|
-
envVars: Object
|
|
7423
|
-
},
|
|
7424
|
-
data: function data() {
|
|
7425
|
-
return {
|
|
7426
|
-
contextData: {},
|
|
7427
|
-
showDetails: true,
|
|
7428
|
-
showContextCard: true,
|
|
7429
|
-
sampleDetails: {},
|
|
7430
|
-
loading: false
|
|
7431
|
-
};
|
|
7432
|
-
},
|
|
7433
|
-
watch: {
|
|
7434
|
-
'entry.contextCardUrl': {
|
|
7435
|
-
handler: function handler(val) {
|
|
7436
|
-
if (val) {
|
|
7437
|
-
// used for hardcoding data
|
|
7438
|
-
if (val === true) {
|
|
7439
|
-
this.contextData = hardcoded_context_info[this.entry.discoverId];
|
|
7440
|
-
} else {
|
|
7441
|
-
this.getContextFile(val);
|
|
7442
|
-
this.showContextCard = true;
|
|
7443
|
-
}
|
|
7444
|
-
} else {
|
|
7445
|
-
this.showContextCard = false;
|
|
7446
|
-
}
|
|
7447
|
-
},
|
|
7448
|
-
immediate: true
|
|
7449
|
-
},
|
|
7450
|
-
'entry.s3uri': {
|
|
7451
|
-
handler: function handler(val) {
|
|
7452
|
-
this.updateS3Bucket(val);
|
|
7453
|
-
},
|
|
7454
|
-
immediate: true
|
|
7455
|
-
}
|
|
7456
|
-
},
|
|
7457
|
-
computed: {
|
|
7458
|
-
samplesUnderViews: function samplesUnderViews() {
|
|
7459
|
-
if (this.contextData) {
|
|
7460
|
-
if (this.contextData.samplesUnderViews) {
|
|
7461
|
-
return true;
|
|
7462
|
-
} else {
|
|
7463
|
-
var viewId = this.contextData.views.map(function (v) {
|
|
7464
|
-
return v.id;
|
|
7465
|
-
});
|
|
7466
|
-
var samplesView = this.contextData.samples.map(function (s) {
|
|
7467
|
-
return s.view;
|
|
7468
|
-
});
|
|
7469
|
-
|
|
7470
|
-
// get matching values
|
|
7471
|
-
var matching = viewId.filter(function (v) {
|
|
7472
|
-
return samplesView.includes(v);
|
|
7473
|
-
});
|
|
7474
|
-
|
|
7475
|
-
// check all arrays have the same length (which means all values are in all three)
|
|
7476
|
-
if (viewId.length === matching.length && matching.length === samplesView.length) {
|
|
7477
|
-
return true;
|
|
7478
|
-
}
|
|
7479
|
-
return false;
|
|
7480
|
-
}
|
|
7481
|
-
} else return false;
|
|
7482
|
-
},
|
|
7483
|
-
banner: function banner() {
|
|
7484
|
-
if (this.contextData.banner) {
|
|
7485
|
-
return this.getFileFromPath(this.contextData.banner);
|
|
7486
|
-
} else if (this.contextData && this.contextData.views && this.contextData.views.length > 0) {
|
|
7487
|
-
if (this.contextData.views[0].thumbnail) {
|
|
7488
|
-
return this.getFileFromPath(this.contextData.views[0].thumbnail);
|
|
7489
|
-
}
|
|
7490
|
-
}
|
|
7491
|
-
return this.entry.banner;
|
|
7492
|
-
}
|
|
7493
|
-
},
|
|
7494
|
-
methods: {
|
|
7495
|
-
samplesMatching: function samplesMatching(viewId) {
|
|
7496
|
-
if (this.contextData && this.contextData.samples) {
|
|
7497
|
-
return this.contextData.samples.filter(function (s) {
|
|
7498
|
-
return s.view == viewId;
|
|
7499
|
-
})[0];
|
|
7500
|
-
} else return [];
|
|
7501
|
-
},
|
|
7502
|
-
viewClicked: function viewClicked(view, i) {
|
|
7503
|
-
this.openViewFile(view);
|
|
7504
|
-
this.toggleSampleDetails(i);
|
|
7505
|
-
},
|
|
7506
|
-
getContextFile: function getContextFile(contextFileUrl) {
|
|
7507
|
-
var _this = this;
|
|
7508
|
-
this.loading = true;
|
|
7509
|
-
fetch(contextFileUrl).then(function (response) {
|
|
7510
|
-
if (!response.ok) {
|
|
7511
|
-
throw Error(response.statusText);
|
|
7512
|
-
} else {
|
|
7513
|
-
return response.json();
|
|
7514
|
-
}
|
|
7515
|
-
}).then(function (data) {
|
|
7516
|
-
_this.contextData = data;
|
|
7517
|
-
_this.loading = false;
|
|
7518
|
-
_this.addDiscoverIdsToContextData();
|
|
7519
|
-
}).catch(function (err) {
|
|
7520
|
-
//set defaults if we hit an error
|
|
7521
|
-
console.error('caught error!', err);
|
|
7522
|
-
_this.thumbnail = __webpack_require__("9b53");
|
|
7523
|
-
_this.discoverId = undefined;
|
|
7524
|
-
_this.loading = false;
|
|
7525
|
-
});
|
|
7526
|
-
},
|
|
7527
|
-
removeDoubleFilesPath: function removeDoubleFilesPath(path) {
|
|
7528
|
-
if (path.includes('files/')) {
|
|
7529
|
-
return path.replace('files/', '');
|
|
7530
|
-
} else if (path.includes('files\\')) {
|
|
7531
|
-
return path.replace('files\\', '');
|
|
7532
|
-
} else {
|
|
7533
|
-
return path;
|
|
7534
|
-
}
|
|
7535
|
-
},
|
|
7536
|
-
toggleSampleDetails: function toggleSampleDetails(i) {
|
|
7537
|
-
if (this.sampleDetails[i] === undefined) {
|
|
7538
|
-
external_vue_default.a.set(this.sampleDetails, i, true);
|
|
7539
|
-
} else {
|
|
7540
|
-
external_vue_default.a.set(this.sampleDetails, i, !this.sampleDetails[i]);
|
|
7541
|
-
}
|
|
7542
|
-
},
|
|
7543
|
-
getFileFromPath: function getFileFromPath(path) {
|
|
7544
|
-
// for hardcoded data
|
|
7545
|
-
if (this.entry.contextCardUrl === true) {
|
|
7546
|
-
return path;
|
|
7547
|
-
}
|
|
7548
|
-
path = this.removeDoubleFilesPath(path);
|
|
7549
|
-
return "".concat(this.envVars.API_LOCATION, "s3-resource/").concat(this.entry.discoverId, "/").concat(this.entry.version, "/files/").concat(path).concat(this.getS3Args());
|
|
7550
|
-
},
|
|
7551
|
-
// This is used later when generateing links to the resource on sparc.science (see generateFileLink)
|
|
7552
|
-
addDiscoverIdsToContextData: function addDiscoverIdsToContextData() {
|
|
7553
|
-
var _this2 = this;
|
|
7554
|
-
this.contextData.samples.forEach(function (sample, i) {
|
|
7555
|
-
if (sample && sample.doi && sample.doi !== "") {
|
|
7556
|
-
fetch("".concat(_this2.envVars.PENNSIEVE_API_LOCATION, "/discover/datasets/doi/").concat(_this2.splitDoiFromUrl(sample.doi))).then(function (response) {
|
|
7557
|
-
return response.json();
|
|
7558
|
-
}).then(function (data) {
|
|
7559
|
-
_this2.contextData.samples[i].discoverId = data.id;
|
|
7560
|
-
_this2.contextData.samples[i].version = data.version;
|
|
7561
|
-
});
|
|
7562
|
-
} else {
|
|
7563
|
-
_this2.contextData.samples[i].discoverId = _this2.entry.discoverId;
|
|
7564
|
-
_this2.contextData.samples[i].version = _this2.entry.version;
|
|
7565
|
-
}
|
|
7566
|
-
});
|
|
7567
|
-
},
|
|
7568
|
-
processPathForUrl: function processPathForUrl(path) {
|
|
7569
|
-
path = convertBackslashToForwardSlash(path);
|
|
7570
|
-
path = addFilesToPathIfMissing(path);
|
|
7571
|
-
return encodeURI(path);
|
|
7572
|
-
},
|
|
7573
|
-
splitDoiFromUrl: function splitDoiFromUrl(url) {
|
|
7574
|
-
return url.split('https://doi.org/').pop();
|
|
7575
|
-
},
|
|
7576
|
-
generateFileLink: function generateFileLink(sample) {
|
|
7577
|
-
return "".concat(this.envVars.ROOT_URL, "/file/").concat(sample.discoverId, "/").concat(sample.version, "?path=").concat(this.processPathForUrl(sample.path));
|
|
7578
|
-
},
|
|
7579
|
-
parseMarkdown: function parseMarkdown(markdown) {
|
|
7580
|
-
return external_xss_default()(marked_umd["marked"].parse(markdown));
|
|
7581
|
-
},
|
|
7582
|
-
openViewFile: function openViewFile(view) {
|
|
7583
|
-
// note that we assume that the view file is in the same directory as the scaffold (viewUrls take relative paths)
|
|
7584
|
-
this.entry.viewUrl = "".concat(this.envVars.API_LOCATION, "s3-resource/").concat(this.entry.discoverId, "/").concat(this.entry.version, "/").concat(view.path).concat(this.getS3Args());
|
|
7585
|
-
this.entry.type = 'Scaffold View';
|
|
7586
|
-
components_EventBus.$emit("PopoverActionClick", this.entry);
|
|
7587
|
-
}
|
|
7588
|
-
}
|
|
7589
|
-
});
|
|
7590
|
-
// CONCATENATED MODULE: ./src/components/ContextCard.vue?vue&type=script&lang=js&
|
|
7591
|
-
/* harmony default export */ var components_ContextCardvue_type_script_lang_js_ = (ContextCardvue_type_script_lang_js_);
|
|
7592
|
-
// EXTERNAL MODULE: ./src/components/ContextCard.vue?vue&type=style&index=0&id=1221ea8f&prod&scoped=true&lang=scss&
|
|
7593
|
-
var ContextCardvue_type_style_index_0_id_1221ea8f_prod_scoped_true_lang_scss_ = __webpack_require__("77d9");
|
|
7594
|
-
|
|
7595
|
-
// CONCATENATED MODULE: ./src/components/ContextCard.vue
|
|
7596
|
-
|
|
7597
|
-
|
|
7598
|
-
|
|
7599
|
-
|
|
7600
|
-
|
|
7601
|
-
|
|
7602
|
-
/* normalize component */
|
|
7603
|
-
|
|
7604
|
-
var ContextCard_component = normalizeComponent(
|
|
7605
|
-
components_ContextCardvue_type_script_lang_js_,
|
|
7606
|
-
ContextCardvue_type_template_id_1221ea8f_scoped_true_render,
|
|
7607
|
-
ContextCardvue_type_template_id_1221ea8f_scoped_true_staticRenderFns,
|
|
7608
|
-
false,
|
|
7609
|
-
null,
|
|
7610
|
-
"1221ea8f",
|
|
7611
|
-
null
|
|
7612
|
-
|
|
7613
|
-
)
|
|
7614
|
-
|
|
7615
|
-
/* harmony default export */ var ContextCard = (ContextCard_component.exports);
|
|
7616
3948
|
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/SidebarContent.vue?vue&type=script&lang=js&
|
|
7617
3949
|
|
|
7618
3950
|
|
|
@@ -7668,7 +4000,6 @@ var ContextCard_component = normalizeComponent(
|
|
|
7668
4000
|
|
|
7669
4001
|
|
|
7670
4002
|
|
|
7671
|
-
|
|
7672
4003
|
locale_default.a.use(en_default.a);
|
|
7673
4004
|
external_vue_default.a.use(button_default.a);
|
|
7674
4005
|
external_vue_default.a.use(card_default.a);
|
|
@@ -7725,14 +4056,12 @@ var initial_state = {
|
|
|
7725
4056
|
pageModel: 1,
|
|
7726
4057
|
start: 0,
|
|
7727
4058
|
hasSearched: false,
|
|
7728
|
-
contextCardEntry: undefined,
|
|
7729
4059
|
contextCardEnabled: false
|
|
7730
4060
|
};
|
|
7731
4061
|
/* harmony default export */ var SidebarContentvue_type_script_lang_js_ = ({
|
|
7732
4062
|
components: {
|
|
7733
4063
|
SearchFilters: SearchFilters,
|
|
7734
|
-
DatasetCard: DatasetCard
|
|
7735
|
-
ContextCard: ContextCard
|
|
4064
|
+
DatasetCard: DatasetCard
|
|
7736
4065
|
},
|
|
7737
4066
|
name: "SideBarContent",
|
|
7738
4067
|
props: {
|
|
@@ -7775,9 +4104,6 @@ var initial_state = {
|
|
|
7775
4104
|
}
|
|
7776
4105
|
},
|
|
7777
4106
|
methods: {
|
|
7778
|
-
contextCardUpdate: function contextCardUpdate(val) {
|
|
7779
|
-
this.contextCardEntry = val;
|
|
7780
|
-
},
|
|
7781
4107
|
resetSearch: function resetSearch() {
|
|
7782
4108
|
this.numberOfHits = 0;
|
|
7783
4109
|
this.discoverIds = [];
|
|
@@ -8056,8 +4382,8 @@ var initial_state = {
|
|
|
8056
4382
|
});
|
|
8057
4383
|
// CONCATENATED MODULE: ./src/components/SidebarContent.vue?vue&type=script&lang=js&
|
|
8058
4384
|
/* harmony default export */ var components_SidebarContentvue_type_script_lang_js_ = (SidebarContentvue_type_script_lang_js_);
|
|
8059
|
-
// EXTERNAL MODULE: ./src/components/SidebarContent.vue?vue&type=style&index=0&id=
|
|
8060
|
-
var
|
|
4385
|
+
// EXTERNAL MODULE: ./src/components/SidebarContent.vue?vue&type=style&index=0&id=29231cf0&prod&scoped=true&lang=scss&
|
|
4386
|
+
var SidebarContentvue_type_style_index_0_id_29231cf0_prod_scoped_true_lang_scss_ = __webpack_require__("8017");
|
|
8061
4387
|
|
|
8062
4388
|
// CONCATENATED MODULE: ./src/components/SidebarContent.vue
|
|
8063
4389
|
|
|
@@ -8070,11 +4396,11 @@ var SidebarContentvue_type_style_index_0_id_35b8b64a_prod_scoped_true_lang_scss_
|
|
|
8070
4396
|
|
|
8071
4397
|
var SidebarContent_component = normalizeComponent(
|
|
8072
4398
|
components_SidebarContentvue_type_script_lang_js_,
|
|
8073
|
-
|
|
8074
|
-
|
|
4399
|
+
SidebarContentvue_type_template_id_29231cf0_scoped_true_render,
|
|
4400
|
+
SidebarContentvue_type_template_id_29231cf0_scoped_true_staticRenderFns,
|
|
8075
4401
|
false,
|
|
8076
4402
|
null,
|
|
8077
|
-
"
|
|
4403
|
+
"29231cf0",
|
|
8078
4404
|
null
|
|
8079
4405
|
|
|
8080
4406
|
)
|