From 1f783f8e9a85e69c615a5a370df624878826764a Mon Sep 17 00:00:00 2001 From: Nasser Rafie Date: Sat, 28 Mar 2020 06:00:49 +0430 Subject: [PATCH 01/32] :up: --- CHANGELOG.md | 2 ++ lib/virastar.js | 2 +- lib/virastar.min.js | 2 +- package.json | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26bd698..f1ffb71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,6 @@ ### [develop] + +### 0.20.0 - Added: cleanup zwnj before/after ellipsis - Added: converting kashida between numbers to ndash - Added: new option for converting arabic hamzeh diff --git a/lib/virastar.js b/lib/virastar.js index b114140..d785c3b 100644 --- a/lib/virastar.js +++ b/lib/virastar.js @@ -1,5 +1,5 @@ /*! -* Virastar - v0.20.0-dev - 2020-03-23 +* Virastar - v0.21.0-dev - 2020-03-28 * https://github.com/brothersincode/virastar * Licensed: MIT */ diff --git a/lib/virastar.min.js b/lib/virastar.min.js index 5fd770e..0a56bbc 100644 --- a/lib/virastar.min.js +++ b/lib/virastar.min.js @@ -1,5 +1,5 @@ /*! -* Virastar - v0.20.0-dev - 2020-03-23 +* Virastar - v0.21.0-dev - 2020-03-28 * https://github.com/brothersincode/virastar * Licensed: MIT */ diff --git a/package.json b/package.json index 9978855..9cb2a77 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "virastar", - "version": "0.19.1", + "version": "0.21.0", "description": "Cleaning-up Persian Texts!", "author": { "name": "juvee" From e0b33da5d02e2be1e19f993195610d8767ae30f7 Mon Sep 17 00:00:00 2001 From: Nasser Rafie Date: Sat, 28 Mar 2020 06:21:23 +0430 Subject: [PATCH 02/32] :wrench: make use of newRegExp helper --- lib/virastar.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/virastar.js b/lib/virastar.js index d785c3b..587bb17 100644 --- a/lib/virastar.js +++ b/lib/virastar.js @@ -172,7 +172,7 @@ var fromChars = fromBatch.split(''); var toChars = toBatch.split(''); for (var i in fromChars) { - text = text.replace(new RegExp(fromChars[i], 'g'), toChars[i]); + text = text.replace(newRegExp(fromChars[i]), toChars[i]); } return text; }, @@ -180,7 +180,7 @@ arrReplace: function arrReplace (text, array) { for (var i in array) { if (array.hasOwnProperty(i)) { // eslint-disable-line no-prototype-builtins - text = text.replace(new RegExp('[' + array[i] + ']', 'g'), i); + text = text.replace(newRegExp('[' + array[i] + ']'), i); } } return text; @@ -270,7 +270,7 @@ // @source: https://github.com/jhermsmeier/uri.regex var pattern = "([A-Za-z][A-Za-z0-9+\\-.]*):(?:(//)(?:((?:[A-Za-z0-9\\-._~!$&'()*+,;=:]|%[0-9A-Fa-f]{2})*)@)?((?:\\[(?:(?:(?:(?:[0-9A-Fa-f]{1,4}:){6}|::(?:[0-9A-Fa-f]{1,4}:){5}|(?:[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){4}|(?:(?:[0-9A-Fa-f]{1,4}:){0,1}[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){3}|(?:(?:[0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){2}|(?:(?:[0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})?::[0-9A-Fa-f]{1,4}:|(?:(?:[0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})?::)(?:[0-9A-Fa-f]{1,4}:[0-9A-Fa-f]{1,4}|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))|(?:(?:[0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})?::[0-9A-Fa-f]{1,4}|(?:(?:[0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})?::)|[Vv][0-9A-Fa-f]+\\.[A-Za-z0-9\\-._~!$&'()*+,;=:]+)\\]|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|(?:[A-Za-z0-9\\-._~!$&'()*+,;=]|%[0-9A-Fa-f]{2})*))(?::([0-9]*))?((?:/(?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})*)*)|/((?:(?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})+(?:/(?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})*)*)?)|((?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})+(?:/(?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})*)*)|)(?:\\?((?:[A-Za-z0-9\\-._~!$&'()*+,;=:@/?]|%[0-9A-Fa-f]{2})*))?(?:\\#((?:[A-Za-z0-9\\-._~!$&'()*+,;=:@/?]|%[0-9A-Fa-f]{2})*))?"; - text = text.replace(new RegExp(pattern, 'g'), function (matched) { + text = text.replace(newRegExp(pattern), function (matched) { uris.push(matched); return ' __URI__PRESERVER__ '; }); @@ -707,13 +707,13 @@ return text // replaces english percent signs (U+066A) // props @ebraminio/persiantools - .replace(new RegExp('([' + this.digits + ']) ?%', 'g'), '$1٪') + .replace(newRegExp('([' + this.digits + ']) ?%'), '$1٪') // replaces dots between numbers into decimal separator (U+066B) // props @ebraminio/persiantools - .replace(new RegExp('([' + this.digits + '])\\.(?=[' + this.digits + '])', 'g'), '$1٫') + .replace(newRegExp('([' + this.digits + '])\\.(?=[' + this.digits + '])'), '$1٫') // replaces commas between numbers into thousands separator (U+066C) // props @languagetool-org - .replace(new RegExp('([' + this.digits + '])\\,(?=[' + this.digits + '])', 'g'), '$1٬') + .replace(newRegExp('([' + this.digits + '])\\,(?=[' + this.digits + '])'), '$1٬') ; }, @@ -943,7 +943,7 @@ for (var iStart = 0; iStart < start.length; iStart++) { var sElement = start[iStart]; - var sReg = new RegExp('^\\' + sElement, 'i'); + var sReg = newRegExp('^\\' + sElement, 'i'); if (sReg.test(text)) { text = text.replace(sReg, '').trim(); after.push(sElement); @@ -952,7 +952,7 @@ for (var iEnd = 0; iEnd < end.length; iEnd++) { var eElement = end[iEnd]; - var eReg = new RegExp('\\' + eElement + '$', 'i'); + var eReg = newRegExp('\\' + eElement + '$', 'i'); if (eReg.test(text)) { text = text.replace(eReg, '').trim(); before.push(eElement); From d63b1fa9d26185d8ae45a57276b1b38b4b2c5032 Mon Sep 17 00:00:00 2001 From: Nasser Rafie Date: Sat, 28 Mar 2020 06:40:31 +0430 Subject: [PATCH 03/32] early fix persian glyphs --- CHANGELOG.md | 1 + lib/virastar.js | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1ffb71..907d858 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ ### [develop] +- Changed: early fix persian glyphs ### 0.20.0 - Added: cleanup zwnj before/after ellipsis diff --git a/lib/virastar.js b/lib/virastar.js index 587bb17..ac827f2 100644 --- a/lib/virastar.js +++ b/lib/virastar.js @@ -303,6 +303,10 @@ text = that.normalizeEOL(text, opts); } + if (opts.fix_persian_glyphs) { + text = that.fixPersianGlyphs(text, opts); + } + if (opts.fix_dashes) { text = that.fixDashes(text, opts); } @@ -385,10 +389,6 @@ matched = that.fixPunctuations(matched, opts); } - if (opts.fix_persian_glyphs) { - matched = that.fixPersianGlyphs(matched, opts); - } - if (opts.fix_misc_non_persian_chars) { matched = that.fixMiscNonPersianChars(matched, opts); } From bf0d168407759d27106458fa49269c8fb79683e5 Mon Sep 17 00:00:00 2001 From: Nasser Rafie Date: Sat, 28 Mar 2020 07:19:33 +0430 Subject: [PATCH 04/32] :wrench: cleanup npm package --- package.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 9cb2a77..dc8c04c 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,11 @@ "persian", "text" ], - "main": "lib/virastar.js", + "main": "./lib/virastar.js", + "files": [ + "/lib", + "settings.json" + ], "scripts": { "serve": "npx http-server ./demo -c-1", "test": "mocha --require @babel/register" From 7505b00994ad9791bd3e3820172f1de9312ad723 Mon Sep 17 00:00:00 2001 From: Nasser Rafie Date: Sat, 28 Mar 2020 09:10:30 +0430 Subject: [PATCH 05/32] :wrench: code optimization --- lib/virastar.js | 1798 ++++++++++++++++++++++--------------------- lib/virastar.min.js | 7 +- 2 files changed, 929 insertions(+), 876 deletions(-) diff --git a/lib/virastar.js b/lib/virastar.js index ac827f2..7e8844f 100644 --- a/lib/virastar.js +++ b/lib/virastar.js @@ -18,15 +18,46 @@ text = text || {}; if (typeof text === 'object') { - this.opts = this.parseOptions(text); + this.opts = parseOptions(text); } else if (typeof text === 'string') { - this.opts = this.parseOptions(options || {}); - return this.cleanup(text); + this.opts = parseOptions(options || {}); + return cleanup(text); } return this; } + function parseOptions (options) { + // @ref: https://scotch.io/bar-talk/copying-objects-in-javascript + var parsed = Object.assign({}, defaults); + + for (var i in parsed) { + if (options.hasOwnProperty(i)) { // eslint-disable-line no-prototype-builtins + parsed[i] = options[i]; + } + } + + return parsed; + } + + function charReplace (text, fromBatch, toBatch) { + var fromChars = fromBatch.split(''); + var toChars = toBatch.split(''); + for (var i in fromChars) { + text = text.replace(newRegExp(fromChars[i]), toChars[i]); + } + return text; + } + + function arrReplace (text, array) { + for (var i in array) { + if (array.hasOwnProperty(i)) { // eslint-disable-line no-prototype-builtins + text = text.replace(newRegExp('[' + array[i] + ']'), i); + } + } + return text; + } + function newRegExp (pattern, flags) { return new RegExp(pattern, flags || 'g'); } @@ -35,950 +66,977 @@ var charsDiacritic = 'ًٌٍَُِّْ'; var patternAfter = '\\s.,;،؛!؟?"\'()[\\]{}“”«»'; - Virastar.prototype = { - defaults: { - // aggresive: true, // DEPRECATED - cleanup_begin_and_end: true, - cleanup_extra_marks: true, - cleanup_kashidas: true, - cleanup_line_breaks: true, - cleanup_rlm: true, - cleanup_spacing: true, - cleanup_zwnj: true, - decode_htmlentities: true, - fix_arabic_numbers: true, - fix_dashes: true, - fix_diacritics: true, - fix_english_numbers: true, - fix_english_quotes_pairs: true, - fix_english_quotes: true, - fix_hamzeh: true, - fix_hamzeh_arabic: false, - fix_misc_non_persian_chars: true, - fix_numeral_symbols: true, - fix_perfix_spacing: true, - fix_persian_glyphs: true, - fix_punctuations: true, - fix_question_mark: true, - fix_spacing_for_braces_and_quotes: true, - fix_spacing_for_punctuations: true, - fix_suffix_misc: true, - fix_suffix_spacing: true, - fix_three_dots: true, - kashidas_as_parenthetic: true, - markdown_normalize_braces: true, - markdown_normalize_lists: true, - normalize_ellipsis: true, - normalize_eol: true, - preserve_braces: false, - preserve_brackets: false, - preserve_comments: true, - preserve_entities: true, - preserve_frontmatter: true, - preserve_HTML: true, - preserve_nbsps: true, - preserve_URIs: true, - skip_markdown_ordered_lists_numbers_conversion: false - }, - - digits: '۱۲۳۴۵۶۷۸۹۰', - - /* eslint-disable */ - entities: { - 'sbquo;': '\u201a', - 'lsquo;': '\u2018', - 'lsquor;': '\u201a', - 'ldquo;': '\u201c', - 'ldquor;': '\u201e', - 'rdquo;': '\u201d', - 'rdquor;': '\u201d', - 'rsquo;': '\u2019', - 'rsquor;': '\u2019', - 'apos;': '\'', - 'QUOT;': '"', - 'QUOT': '"', - 'quot;': '"', - 'quot': '"', - 'zwj;': '\u200d', - 'ZWNJ;': '\u200c', - 'zwnj;': '\u200c', - 'shy;': '\u00ad' // wrongly used as zwnj - }, - - // props @ebraminio/persiantools - glyphs: { - // these two are for visually available ZWNJ #visualZwnj - '\u200cه': 'ﻫ', - 'ی\u200c': 'ﻰﻲ', - 'ﺃ': 'ﺄﺃ', - 'ﺁ': 'ﺁﺂ', - 'ﺇ': 'ﺇﺈ', - 'ا': 'ﺎا', - 'ب': 'ﺏﺐﺑﺒ', - 'پ': 'ﭖﭗﭘﭙ', - 'ت': 'ﺕﺖﺗﺘ', - 'ث': 'ﺙﺚﺛﺜ', - 'ج': 'ﺝﺞﺟﺠ', - 'چ': 'ﭺﭻﭼﭽ', - 'ح': 'ﺡﺢﺣﺤ', - 'خ': 'ﺥﺦﺧﺨ', - 'د': 'ﺩﺪ', - 'ذ': 'ﺫﺬ', - 'ر': 'ﺭﺮ', - 'ز': 'ﺯﺰ', - 'ژ': 'ﮊﮋ', - 'س': 'ﺱﺲﺳﺴ', - 'ش': 'ﺵﺶﺷﺸ', - 'ص': 'ﺹﺺﺻﺼ', - 'ض': 'ﺽﺾﺿﻀ', - 'ط': 'ﻁﻂﻃﻄ', - 'ظ': 'ﻅﻆﻇﻈ', - 'ع': 'ﻉﻊﻋﻌ', - 'غ': 'ﻍﻎﻏﻐ', - 'ف': 'ﻑﻒﻓﻔ', - 'ق': 'ﻕﻖﻗﻘ', - 'ک': 'ﮎﮏﮐﮑﻙﻚﻛﻜ', - 'گ': 'ﮒﮓﮔﮕ', - 'ل': 'ﻝﻞﻟﻠ', - 'م': 'ﻡﻢﻣﻤ', - 'ن': 'ﻥﻦﻧﻨ', - 'ه': 'ﻩﻪﻫﻬ', - 'هٔ': 'ﮤﮥ', - 'و': 'ﻭﻮ', - 'ﺅ': 'ﺅﺆ', - 'ی': 'ﯼﯽﯾﯿﻯﻰﻱﻲﻳﻴ', - 'ئ': 'ﺉﺊﺋﺌ', - 'لا': 'ﻼ', - 'ﻹ': 'ﻺ', - 'ﻷ': 'ﻸ', - 'ﻵ': 'ﻶ' - }, - /* eslint-enable */ - - parseOptions: function parseOptions (options) { - // @ref: https://scotch.io/bar-talk/copying-objects-in-javascript - var defaults = Object.assign({}, this.defaults); - - for (var i in defaults) { - if (options.hasOwnProperty(i)) { // eslint-disable-line no-prototype-builtins - defaults[i] = options[i]; - } - } + // @source: https://github.com/jhermsmeier/uri.regex + var patternURI = "([A-Za-z][A-Za-z0-9+\\-.]*):(?:(//)(?:((?:[A-Za-z0-9\\-._~!$&'()*+,;=:]|%[0-9A-Fa-f]{2})*)@)?((?:\\[(?:(?:(?:(?:[0-9A-Fa-f]{1,4}:){6}|::(?:[0-9A-Fa-f]{1,4}:){5}|(?:[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){4}|(?:(?:[0-9A-Fa-f]{1,4}:){0,1}[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){3}|(?:(?:[0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){2}|(?:(?:[0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})?::[0-9A-Fa-f]{1,4}:|(?:(?:[0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})?::)(?:[0-9A-Fa-f]{1,4}:[0-9A-Fa-f]{1,4}|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))|(?:(?:[0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})?::[0-9A-Fa-f]{1,4}|(?:(?:[0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})?::)|[Vv][0-9A-Fa-f]+\\.[A-Za-z0-9\\-._~!$&'()*+,;=:]+)\\]|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|(?:[A-Za-z0-9\\-._~!$&'()*+,;=]|%[0-9A-Fa-f]{2})*))(?::([0-9]*))?((?:/(?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})*)*)|/((?:(?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})+(?:/(?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})*)*)?)|((?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})+(?:/(?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})*)*)|)(?:\\?((?:[A-Za-z0-9\\-._~!$&'()*+,;=:@/?]|%[0-9A-Fa-f]{2})*))?(?:\\#((?:[A-Za-z0-9\\-._~!$&'()*+,;=:@/?]|%[0-9A-Fa-f]{2})*))?"; + + var defaults = { + // aggresive: true, // DEPRECATED + cleanup_begin_and_end: true, + cleanup_extra_marks: true, + cleanup_kashidas: true, + cleanup_line_breaks: true, + cleanup_rlm: true, + cleanup_spacing: true, + cleanup_zwnj: true, + decode_htmlentities: true, + fix_arabic_numbers: true, + fix_dashes: true, + fix_diacritics: true, + fix_english_numbers: true, + fix_english_quotes_pairs: true, + fix_english_quotes: true, + fix_hamzeh: true, + fix_hamzeh_arabic: false, + fix_misc_non_persian_chars: true, + fix_numeral_symbols: true, + fix_perfix_spacing: true, + fix_persian_glyphs: true, + fix_punctuations: true, + fix_question_mark: true, + fix_spacing_for_braces_and_quotes: true, + fix_spacing_for_punctuations: true, + fix_suffix_misc: true, + fix_suffix_spacing: true, + fix_three_dots: true, + kashidas_as_parenthetic: true, + markdown_normalize_braces: true, + markdown_normalize_lists: true, + normalize_ellipsis: true, + normalize_eol: true, + preserve_braces: false, + preserve_brackets: false, + preserve_comments: true, + preserve_entities: true, + preserve_frontmatter: true, + preserve_HTML: true, + preserve_nbsps: true, + preserve_URIs: true, + skip_markdown_ordered_lists_numbers_conversion: false + }; - return defaults; - }, + var digits = '۱۲۳۴۵۶۷۸۹۰'; + + /* eslint-disable */ + var entities = { + 'sbquo;': '\u201a', + 'lsquo;': '\u2018', + 'lsquor;': '\u201a', + 'ldquo;': '\u201c', + 'ldquor;': '\u201e', + 'rdquo;': '\u201d', + 'rdquor;': '\u201d', + 'rsquo;': '\u2019', + 'rsquor;': '\u2019', + 'apos;': '\'', + 'QUOT;': '"', + 'QUOT': '"', + 'quot;': '"', + 'quot': '"', + 'zwj;': '\u200d', + 'ZWNJ;': '\u200c', + 'zwnj;': '\u200c', + 'shy;': '\u00ad' // wrongly used as zwnj + }; - charReplace: function charReplace (text, fromBatch, toBatch) { - var fromChars = fromBatch.split(''); - var toChars = toBatch.split(''); - for (var i in fromChars) { - text = text.replace(newRegExp(fromChars[i]), toChars[i]); - } - return text; - }, + // props @ebraminio/persiantools + var glyphs = { + // these two are for visually available ZWNJ #visualZwnj + '\u200cه': 'ﻫ', + 'ی\u200c': 'ﻰﻲ', + 'ﺃ': 'ﺄﺃ', + 'ﺁ': 'ﺁﺂ', + 'ﺇ': 'ﺇﺈ', + 'ا': 'ﺎا', + 'ب': 'ﺏﺐﺑﺒ', + 'پ': 'ﭖﭗﭘﭙ', + 'ت': 'ﺕﺖﺗﺘ', + 'ث': 'ﺙﺚﺛﺜ', + 'ج': 'ﺝﺞﺟﺠ', + 'چ': 'ﭺﭻﭼﭽ', + 'ح': 'ﺡﺢﺣﺤ', + 'خ': 'ﺥﺦﺧﺨ', + 'د': 'ﺩﺪ', + 'ذ': 'ﺫﺬ', + 'ر': 'ﺭﺮ', + 'ز': 'ﺯﺰ', + 'ژ': 'ﮊﮋ', + 'س': 'ﺱﺲﺳﺴ', + 'ش': 'ﺵﺶﺷﺸ', + 'ص': 'ﺹﺺﺻﺼ', + 'ض': 'ﺽﺾﺿﻀ', + 'ط': 'ﻁﻂﻃﻄ', + 'ظ': 'ﻅﻆﻇﻈ', + 'ع': 'ﻉﻊﻋﻌ', + 'غ': 'ﻍﻎﻏﻐ', + 'ف': 'ﻑﻒﻓﻔ', + 'ق': 'ﻕﻖﻗﻘ', + 'ک': 'ﮎﮏﮐﮑﻙﻚﻛﻜ', + 'گ': 'ﮒﮓﮔﮕ', + 'ل': 'ﻝﻞﻟﻠ', + 'م': 'ﻡﻢﻣﻤ', + 'ن': 'ﻥﻦﻧﻨ', + 'ه': 'ﻩﻪﻫﻬ', + 'هٔ': 'ﮤﮥ', + 'و': 'ﻭﻮ', + 'ﺅ': 'ﺅﺆ', + 'ی': 'ﯼﯽﯾﯿﻯﻰﻱﻲﻳﻴ', + 'ئ': 'ﺉﺊﺋﺌ', + 'لا': 'ﻼ', + 'ﻹ': 'ﻺ', + 'ﻷ': 'ﻸ', + 'ﻵ': 'ﻶ' + }; + /* eslint-enable */ - arrReplace: function arrReplace (text, array) { - for (var i in array) { - if (array.hasOwnProperty(i)) { // eslint-disable-line no-prototype-builtins - text = text.replace(newRegExp('[' + array[i] + ']'), i); - } - } + function cleanup (text, options) { + if (typeof text !== 'string') { + throw new TypeError('Expected a String, but received ' + typeof text); + } + + // dont bother if its empty or whitespace + if (!text.trim()) { return text; - }, + } - cleanup: function cleanup (text, options) { - if (typeof text !== 'string') { - throw new TypeError('Expected a String, but received ' + typeof text); - } + var opts = options ? parseOptions(options) : this.opts; - // dont bother if its empty or whitespace - if (!text.trim()) { - return text; - } + // single space paddings around the string + text = ' ' + text + ' '; - var that = this; - var opts = options ? that.parseOptions(options) : that.opts; + // preserves frontmatter data in the text + if (opts.preserve_frontmatter) { + var frontmatter = []; + text = text.replace(/^ ---[\S\s]*---\s*/g, function (matched) { + frontmatter.push(matched); + return ' __FRONTMATTER__PRESERVER__ '; + }); + } - // single space paddings around the string - text = ' ' + text + ' '; + // preserves all html tags in the text + // @props: @wordpress/wordcount + if (opts.preserve_HTML) { + var html = []; + text = text.replace(/<\/?[a-z][^>]*?>/gi, function (matched) { + html.push(matched); + return ' __HTML__PRESERVER__ '; + }); + } - // preserves frontmatter data in the text - if (opts.preserve_frontmatter) { - var frontmatter = []; - text = text.replace(/^ ---[\S\s]*---\s*/g, function (matched) { - frontmatter.push(matched); - return ' __FRONTMATTER__PRESERVER__ '; - }); - } + // preserves all html comments in the text + // @props: @wordpress/wordcount + if (opts.preserve_comments) { + var comments = []; + text = text.replace(//g, function (matched) { + comments.push(matched); + return ' __COMMENT__PRESERVER__ '; + }); + } - // preserves all html tags in the text - // @props: @wordpress/wordcount - if (opts.preserve_HTML) { - var html = []; - text = text.replace(/<\/?[a-z][^>]*?>/gi, function (matched) { - html.push(matched); - return ' __HTML__PRESERVER__ '; - }); - } + // preserves strings inside square brackets (`[]`) + if (opts.preserve_brackets) { + var brackets = []; + text = text.replace(/(\[.*?\])/g, function (matched) { + brackets.push(matched); + return ' __BRACKETS__PRESERVER__ '; + }); + } - // preserves all html comments in the text - // @props: @wordpress/wordcount - if (opts.preserve_comments) { - var comments = []; - text = text.replace(//g, function (matched) { - comments.push(matched); - return ' __COMMENT__PRESERVER__ '; - }); - } + // preserves strings inside curly braces (`{}`) + if (opts.preserve_braces) { + var braces = []; + text = text.replace(/(\{.*?\})/g, function (matched) { + braces.push(matched); + return ' __BRACES__PRESERVER__ '; + }); + } - // preserves strings inside square brackets (`[]`) - if (opts.preserve_brackets) { - var brackets = []; - text = text.replace(/(\[.*?\])/g, function (matched) { - brackets.push(matched); - return ' __BRACKETS__PRESERVER__ '; - }); - } + // preserves all uri strings in the text + if (opts.preserve_URIs) { + var mdlinks = []; + var uris = []; + + // stores markdown links separetly to help space cleanup working + text = text.replace(/(!)?\[(.*[^\]])?\]\((.*[^)])\)/g, function (matched, img, title, link) { + // again checks for markdown image links within + if (title) { + title = title.replace(/!\[(.*?)\]\((.*?[^)])\)/g, function (image, alt, src) { + mdlinks.push(src.trim()); + return '![' + (alt || '') + '](__MD_LINK__PRESERVER__)'; // no padding! + }); + } - // preserves strings inside curly braces (`{}`) - if (opts.preserve_braces) { - var braces = []; - text = text.replace(/(\{.*?\})/g, function (matched) { - braces.push(matched); - return ' __BRACES__PRESERVER__ '; - }); - } + mdlinks.push(link.trim()); + return (img || '') + '[' + (title || '') + '](__MD_LINK__PRESERVER__)'; // no padding! + }); - // preserves all uri strings in the text - if (opts.preserve_URIs) { - var mdlinks = []; - var uris = []; - - // stores markdown links separetly to help space cleanup working - text = text.replace(/(!)?\[(.*[^\]])?\]\((.*[^)])\)/g, function (matched, img, title, link) { - // again checks for markdown image links within - if (title) { - title = title.replace(/!\[(.*?)\]\((.*?[^)])\)/g, function (image, alt, src) { - mdlinks.push(src.trim()); - return '![' + (alt || '') + '](__MD_LINK__PRESERVER__)'; // no padding! - }); - } - - mdlinks.push(link.trim()); - return (img || '') + '[' + (title || '') + '](__MD_LINK__PRESERVER__)'; // no padding! - }); - - // @source: https://github.com/jhermsmeier/uri.regex - var pattern = "([A-Za-z][A-Za-z0-9+\\-.]*):(?:(//)(?:((?:[A-Za-z0-9\\-._~!$&'()*+,;=:]|%[0-9A-Fa-f]{2})*)@)?((?:\\[(?:(?:(?:(?:[0-9A-Fa-f]{1,4}:){6}|::(?:[0-9A-Fa-f]{1,4}:){5}|(?:[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){4}|(?:(?:[0-9A-Fa-f]{1,4}:){0,1}[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){3}|(?:(?:[0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){2}|(?:(?:[0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})?::[0-9A-Fa-f]{1,4}:|(?:(?:[0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})?::)(?:[0-9A-Fa-f]{1,4}:[0-9A-Fa-f]{1,4}|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))|(?:(?:[0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})?::[0-9A-Fa-f]{1,4}|(?:(?:[0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})?::)|[Vv][0-9A-Fa-f]+\\.[A-Za-z0-9\\-._~!$&'()*+,;=:]+)\\]|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|(?:[A-Za-z0-9\\-._~!$&'()*+,;=]|%[0-9A-Fa-f]{2})*))(?::([0-9]*))?((?:/(?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})*)*)|/((?:(?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})+(?:/(?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})*)*)?)|((?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})+(?:/(?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})*)*)|)(?:\\?((?:[A-Za-z0-9\\-._~!$&'()*+,;=:@/?]|%[0-9A-Fa-f]{2})*))?(?:\\#((?:[A-Za-z0-9\\-._~!$&'()*+,;=:@/?]|%[0-9A-Fa-f]{2})*))?"; - text = text.replace(newRegExp(pattern), function (matched) { - uris.push(matched); - return ' __URI__PRESERVER__ '; - }); - } + text = text.replace(newRegExp(patternURI), function (matched) { + uris.push(matched); + return ' __URI__PRESERVER__ '; + }); + } - // preserves all no-break space entities in the text - if (opts.preserve_nbsps) { - var nbsps = []; - text = text.replace(/ | /gi, function (matched) { - nbsps.push(matched); - return ' __NBSPS__PRESERVER__ '; - }); - } + // preserves all no-break space entities in the text + if (opts.preserve_nbsps) { + var nbsps = []; + text = text.replace(/ | /gi, function (matched) { + nbsps.push(matched); + return ' __NBSPS__PRESERVER__ '; + }); + } - if (opts.decode_htmlentities) { - text = that.decodeHTMLEntities(text, opts); - } + if (opts.decode_htmlentities) { + text = decodeHTMLEntities(text, opts); + } - // preserves all html entities in the text - // @props: @substack/node-ent - if (opts.preserve_entities) { - var entities = []; - text = text.replace(/&(#?[^;\W]+;?)/g, function (matched) { - entities.push(matched); - return ' __ENTITIES__PRESERVER__ '; - }); - } + // preserves all html entities in the text + // @props: @substack/node-ent + if (opts.preserve_entities) { + var entities = []; + text = text.replace(/&(#?[^;\W]+;?)/g, function (matched) { + entities.push(matched); + return ' __ENTITIES__PRESERVER__ '; + }); + } - if (opts.normalize_eol) { - text = that.normalizeEOL(text, opts); - } + if (opts.normalize_eol) { + text = normalizeEOL(text, opts); + } - if (opts.fix_persian_glyphs) { - text = that.fixPersianGlyphs(text, opts); - } + if (opts.fix_persian_glyphs) { + text = fixPersianGlyphs(text, opts); + } - if (opts.fix_dashes) { - text = that.fixDashes(text, opts); - } + if (opts.fix_dashes) { + text = fixDashes(text, opts); + } - if (opts.fix_three_dots) { - text = that.fixThreeDots(text, opts); - } + if (opts.fix_three_dots) { + text = fixThreeDots(text, opts); + } - if (opts.normalize_ellipsis) { - text = that.normalizeEllipsis(text, opts); - } + if (opts.normalize_ellipsis) { + text = normalizeEllipsis(text, opts); + } - if (opts.fix_english_quotes_pairs) { - text = that.fixEnglishQuotesPairs(text, opts); + if (opts.fix_english_quotes_pairs) { + text = fixEnglishQuotesPairs(text, opts); + } + + if (opts.fix_english_quotes) { + text = fixEnglishQuotes(text, opts); + } + + if (opts.fix_hamzeh) { + if (opts.fix_hamzeh_arabic) { + text = fixHamzehArabic(text, opts); } - if (opts.fix_english_quotes) { - text = that.fixEnglishQuotes(text, opts); + text = fixHamzeh(text, opts); + } else if (opts.fix_suffix_spacing) { + if (opts.fix_hamzeh_arabic) { + text = fixHamzehArabicAlt(text, opts); } - if (opts.fix_hamzeh) { - if (opts.fix_hamzeh_arabic) { - text = that.fixHamzehArabic(text, opts); - } + text = fixSuffixSpacingHamzeh(text, opts); + } - text = that.fixHamzeh(text, opts); - } else if (opts.fix_suffix_spacing) { - if (opts.fix_hamzeh_arabic) { - text = that.fixHamzehArabicAlt(text, opts); - } + if (opts.cleanup_rlm) { + text = cleanupRLM(text, opts); + } - text = that.fixSuffixSpacingHamzeh(text, opts); - } + if (opts.cleanup_zwnj) { + text = cleanupZWNJ(text, opts); + } - if (opts.cleanup_rlm) { - text = that.cleanupRLM(text, opts); - } + if (opts.fix_arabic_numbers) { + text = fixArabicNumbers(text, opts); + } - if (opts.cleanup_zwnj) { - text = that.cleanupZWNJ(text, opts); - } + // word tokenizer + text = text.replace(/(^|\s+)([[({"'“«]?)(\S+)([\])}"'”»]?)(?=($|\s+))/g, + function (matched, before, leadings, word, trailings, after) { + // should not replace to persian chars in english phrases + if (word.match(/[a-zA-Z\-_]{2,}/g)) { + return matched; + } - if (opts.fix_arabic_numbers) { - text = that.fixArabicNumbers(text, opts); - } + // should not touch sprintf directives + // @source: https://stackoverflow.com/a/8915445/ + if (word.match(/%(?:\d+\$)?[+-]?(?:[ 0]|'.{1})?-?\d*(?:\.\d+)?[bcdeEufFgGosxX]/g)) { + return matched; + } - // word tokenizer - text = text.replace(/(^|\s+)([[({"'“«]?)(\S+)([\])}"'”»]?)(?=($|\s+))/g, - function (matched, before, leadings, word, trailings, after) { - // should not replace to persian chars in english phrases - if (word.match(/[a-zA-Z\-_]{2,}/g)) { - return matched; - } - - // should not touch sprintf directives - // @source: https://stackoverflow.com/a/8915445/ - if (word.match(/%(?:\d+\$)?[+-]?(?:[ 0]|'.{1})?-?\d*(?:\.\d+)?[bcdeEufFgGosxX]/g)) { - return matched; - } - - // should not touch numbers in html entities - if (word.match(/&#\d+;/g)) { - return matched; - } - - // skips converting english numbers of ordered lists in markdown - if (opts.skip_markdown_ordered_lists_numbers_conversion && (matched + trailings + after).match(/(?:(?:\r?\n)|(?:\r\n?)|(?:^|\n))\d+\.\s/)) { - return matched; - } - - if (opts.fix_english_numbers) { - matched = that.fixEnglishNumbers(matched, opts); - } - - if (opts.fix_numeral_symbols) { - matched = that.fixNumeralSymbols(matched, opts); - } - - if (opts.fix_punctuations) { - matched = that.fixPunctuations(matched, opts); - } - - if (opts.fix_misc_non_persian_chars) { - matched = that.fixMiscNonPersianChars(matched, opts); - } - - if (opts.fix_question_mark) { - matched = that.fixQuestionMark(matched, opts); - } + // should not touch numbers in html entities + if (word.match(/&#\d+;/g)) { + return matched; + } + // skips converting english numbers of ordered lists in markdown + if (opts.skip_markdown_ordered_lists_numbers_conversion && (matched + trailings + after).match(/(?:(?:\r?\n)|(?:\r\n?)|(?:^|\n))\d+\.\s/)) { return matched; } - ); - if (opts.fix_perfix_spacing) { - text = that.fixPerfixSpacing(text, opts); - } + if (opts.fix_english_numbers) { + matched = fixEnglishNumbers(matched, opts); + } - if (opts.fix_suffix_spacing) { - text = that.fixSuffixSpacing(text, opts); - } + if (opts.fix_numeral_symbols) { + matched = fixNumeralSymbols(matched, opts); + } - if (opts.fix_suffix_misc) { - text = that.fixSuffixMisc(text, opts); - } + if (opts.fix_punctuations) { + matched = fixPunctuations(matched, opts); + } - if (opts.fix_spacing_for_braces_and_quotes) { - text = that.fixBracesSpacing(text, opts); - } + if (opts.fix_misc_non_persian_chars) { + matched = fixMiscNonPersianChars(matched, opts); + } - if (opts.cleanup_extra_marks) { - text = that.cleanupExtraMarks(text, opts); - } + if (opts.fix_question_mark) { + matched = fixQuestionMark(matched, opts); + } - if (opts.fix_spacing_for_punctuations) { - text = that.fixPunctuationSpacing(text, opts); + return matched; } + ); - if (opts.kashidas_as_parenthetic) { - text = that.kashidasAsParenthetic(text, opts); - } + if (opts.fix_perfix_spacing) { + text = fixPerfixSpacing(text, opts); + } - if (opts.cleanup_kashidas) { - text = that.cleanupKashidas(text, opts); - } + if (opts.fix_suffix_spacing) { + text = fixSuffixSpacing(text, opts); + } - if (opts.markdown_normalize_braces) { - text = that.markdownNormalizeBraces(text, opts); - } + if (opts.fix_suffix_misc) { + text = fixSuffixMisc(text, opts); + } - if (opts.markdown_normalize_lists) { - text = that.markdownNormalizeLists(text, opts); - } + if (opts.fix_spacing_for_braces_and_quotes) { + text = fixBracesSpacing(text, opts); + } - // doing it again after `fixPunctuationSpacing()` - if (opts.fix_spacing_for_braces_and_quotes) { - text = that.fixBracesSpacingInside(text, opts); - } + if (opts.cleanup_extra_marks) { + text = cleanupExtraMarks(text, opts); + } - if (opts.fix_diacritics) { - text = that.fixDiacritics(text, opts); - } + if (opts.fix_spacing_for_punctuations) { + text = fixPunctuationSpacing(text, opts); + } - if (opts.cleanup_spacing) { - text = that.cleanupSpacing(text, opts); - } + if (opts.kashidas_as_parenthetic) { + text = kashidasAsParenthetic(text, opts); + } - if (opts.cleanup_zwnj) { - text = that.cleanupZWNJLate(text, opts); - } + if (opts.cleanup_kashidas) { + text = cleanupKashidas(text, opts); + } - if (opts.cleanup_line_breaks) { - text = that.cleanupLineBreaks(text, opts); - } + if (opts.markdown_normalize_braces) { + text = markdownNormalizeBraces(text, opts); + } - // bringing back entities - if (opts.preserve_entities) { - text = text.replace(/[ ]?__ENTITIES__PRESERVER__[ ]?/g, function () { - return entities.shift(); - }); - } + if (opts.markdown_normalize_lists) { + text = markdownNormalizeLists(text, opts); + } - // bringing back nbsps - if (opts.preserve_nbsps) { - text = text.replace(/[ ]?__NBSPS__PRESERVER__[ ]?/g, function () { - return nbsps.shift(); - }); - } + // doing it again after `fixPunctuationSpacing()` + if (opts.fix_spacing_for_braces_and_quotes) { + text = fixBracesSpacingInside(text, opts); + } - // bringing back URIs - if (opts.preserve_URIs) { - // no padding! - text = text.replace(/__MD_LINK__PRESERVER__/g, function () { - return mdlinks.shift(); - }); + if (opts.fix_diacritics) { + text = fixDiacritics(text, opts); + } - text = text.replace(/[ ]?__URI__PRESERVER__[ ]?/g, function () { - return uris.shift(); - }); - } + if (opts.cleanup_spacing) { + text = cleanupSpacing(text, opts); + } - // bringing back braces - if (opts.preserve_braces) { - text = text.replace(/[ ]?__BRACES__PRESERVER__[ ]?/g, function () { - return braces.shift(); - }); - } + if (opts.cleanup_zwnj) { + text = cleanupZWNJLate(text, opts); + } - // bringing back brackets - if (opts.preserve_brackets) { - text = text.replace(/[ ]?__BRACKETS__PRESERVER__[ ]?/g, function () { - return brackets.shift(); - }); - } + if (opts.cleanup_line_breaks) { + text = cleanupLineBreaks(text, opts); + } - // bringing back HTML comments - if (opts.preserve_comments) { - text = text.replace(/[ ]?__COMMENT__PRESERVER__[ ]?/g, function () { - return comments.shift(); - }); - } + // bringing back entities + if (opts.preserve_entities) { + text = text.replace(/[ ]?__ENTITIES__PRESERVER__[ ]?/g, function () { + return entities.shift(); + }); + } - // bringing back HTML tags - if (opts.preserve_HTML) { - text = text.replace(/[ ]?__HTML__PRESERVER__[ ]?/g, function () { - return html.shift(); - }); - } + // bringing back nbsps + if (opts.preserve_nbsps) { + text = text.replace(/[ ]?__NBSPS__PRESERVER__[ ]?/g, function () { + return nbsps.shift(); + }); + } - // bringing back frontmatter - if (opts.preserve_frontmatter) { - text = text.replace(/[ ]?__FRONTMATTER__PRESERVER__[ ]?/g, function () { - return frontmatter.shift(); - }); - } + // bringing back URIs + if (opts.preserve_URIs) { + // no padding! + text = text.replace(/__MD_LINK__PRESERVER__/g, function () { + return mdlinks.shift(); + }); - if (opts.cleanup_begin_and_end) { - text = that.cleanupBeginAndEnd(text, opts); - } else { - // removes single space paddings around the string - text = text.replace(/^[ ]/g, ''); - text = text.replace(/[ ]$/g, ''); - } + text = text.replace(/[ ]?__URI__PRESERVER__[ ]?/g, function () { + return uris.shift(); + }); + } - return text; - }, - - // props @ebraminio/persiantools - cleanupZWNJ: function cleanupZWNJ (text, options) { - return text - // converts all soft hyphens (­) into zwnj - .replace(/\u00ad/g, '\u200c') - - // removes more than one zwnj - .replace(/\u200c{2,}/g, '\u200c') - - // cleans zwnj before and after numbers, english words, spaces and punctuations - .replace(/\u200c([\w\s0-9۰-۹[\](){}«»“”.…,:;?!$%@#*=+\-/\\،؛٫٬×٪؟ـ])/g, '$1') - .replace(/([\w\s0-9۰-۹[\](){}«»“”.…,:;?!$%@#*=+\-/\\،؛٫٬×٪؟ـ])\u200c/g, '$1') - - // removes unnecessary zwnj on start/end of each line - .replace(/(^\u200c|\u200c$)/gm, '') - ; - }, - - // late checks for zwnjs - cleanupZWNJLate: function cleanupZWNJLate (text, options) { - return text - // cleans zwnj after characters that don't conncet to the next - .replace(/([إأةؤورزژاآدذ،؛,:«»\\/@#$٪×*()ـ\-=|])\u200c/g, '$1') - ; - }, - - // converts numeral and selected html character-sets into original characters - // @props: @substack/node-ent - decodeHTMLEntities: function decodeHTMLEntities (text, options) { - var that = this; - return text.replace(/&(#?[^;\W]+;?)/g, function (matched, match) { - var n; - if ((n = /^#(\d+);?$/.exec(match))) { - return String.fromCharCode(parseInt(n[1], 10)); - } else if ((n = /^#[Xx]([A-Fa-f0-9]+);?/.exec(match))) { - return String.fromCharCode(parseInt(n[1], 16)); - } else { - var hasSemi = /;$/.test(match); - var withoutSemi = hasSemi ? match.replace(/;$/, '') : match; - var target = that.entities[withoutSemi] || (hasSemi && that.entities[match]); - - if (typeof target === 'number') { - return String.fromCharCode(target); - } else if (typeof target === 'string') { - return target; - } else { - return '&' + match; - } - } + // bringing back braces + if (opts.preserve_braces) { + text = text.replace(/[ ]?__BRACES__PRESERVER__[ ]?/g, function () { + return braces.shift(); }); - }, - - // replaces windows end of lines with unix eol (`\n`) - normalizeEOL: function normalizeEOL (text, options) { - return text - .replace(/(\r?\n)|(\r\n?)/g, '\n') - ; - }, - - fixDashes: function fixDashes (text, options) { - return text - // replaces triple dash to mdash - .replace(/-{3}/g, '—') - // replaces double dash to ndash - .replace(/-{2}/g, '–') - ; - }, - - // replaces three dots with ellipsis character - fixThreeDots: function fixThreeDots (text, options) { - return text - .replace(/\s*\.{3,}/g, '…') - ; - }, - - normalizeEllipsis: function normalizeEllipsis (text, options) { - return text - // replaces more than one ellipsis with one - .replace(/(…){2,}/g, '…') - // replaces (space|tab|zwnj) after ellipsis with one space - // NOTE: allows for space before ellipsis - .replace(/([ ]{1,})*…[ \t\u200c]*/g, '$1… ') - ; - }, - - // replaces english quote pairs with their persian equivalent - fixEnglishQuotesPairs: function fixEnglishQuotesPairs (text, options) { - return text - .replace(/(“)(.+?)(”)/g, '«$2»') - ; - }, - - // replaces english quote marks with their persian equivalent - fixEnglishQuotes: function fixEnglishQuotes (text, options) { - return text - .replace(/(["'`]+)(.+?)(\1)/g, '«$2»') - ; - }, - - fixHamzeh: function fixHamzeh (text, options) { - return text - // replaces ه followed by (space|ZWNJ|lrm) follow by ی with هٔ - .replace(/(\S)(ه[\s\u200c\u200e]+[یي])([\s\u200c\u200e])/g, '$1هٔ$3') // heh + ye - // replaces ه followed by (space|ZWNJ|lrm|nothing) follow by ء with هٔ - .replace(/(\S)(ه[\s\u200c\u200e]?\u0621)([\s\u200c\u200e])/g, '$1هٔ$3') // heh + standalone hamza - // replaces هٓ or single-character ۀ with the standard هٔ - // props @ebraminio/persiantools - .replace(/(ۀ|هٓ)/g, 'هٔ') - ; - }, - - fixHamzehArabic: function fixHamzehArabic (text, options) { - return text - // converts arabic hamzeh ة to هٔ - .replace(/(\S)ة([\s\u200c\u200e])/g, '$1هٔ$2') - ; - }, - - fixHamzehArabicAlt: function fixHamzehArabicAlt (text, options) { - return text - // converts arabic hamzeh ة to ه‌ی - .replace(/(\S)ة([\s\u200c\u200e])/g, '$1ه‌ی$2') - ; - }, - - cleanupRLM: function cleanupRLM (text, options) { - return text - // converts Right-to-left marks followed by persian characters to - // zero-width non-joiners (ZWNJ) - .replace(/([^a-zA-Z\-_])(\u200F)/g, '$1\u200c') - ; - }, - - // converts incorrect persian glyphs to standard characters - fixPersianGlyphs: function fixPersianGlyphs (text, options) { - return this.arrReplace(text, this.glyphs); - }, - - // props @ebraminio/persiantools - fixMiscNonPersianChars: function fixMiscNonPersianChars (text, options) { - return this.charReplace(text, 'كڪيىۍېہە', 'ککییییههه'); - // return text - // .replace(/ك/g, 'ک') // arabic kaf - // .replace(/ڪ/g, 'ک') // arabic letter swash kaf - // .replace(/ي/g, 'ی') // arabic - // .replace(/ى/g, 'ی') // urdu - // .replace(/ۍ/g, 'ی') // pushtu - // .replace(/ې/g, 'ی') // uyghur - // .replace(/ہ/g, 'ه') // converts ہ to ه ہہہہ to ههه - // .replace(/[ەھ]/g, 'ه'); // kurdish - }, - - // replaces english numbers with their persian equivalent - fixEnglishNumbers: function fixEnglishNumbers (text, options) { - return this.charReplace(text, '1234567890', this.digits); - }, - - // replaces arabic numbers with their persian equivalent - fixArabicNumbers: function fixArabicNumbers (text, options) { - return this.charReplace(text, '١٢٣٤٥٦٧٨٩٠', this.digits); - }, - - // @REF: https://github.com/shkarimpour/pholiday/pull/5/files - convertPersianNumbers: function convertPersianNumbers (text, options) { - return text.replace(/[\u0660-\u0669\u06f0-\u06f9]/g, function (char) { - return char.charCodeAt(0) & 0xf; + } + + // bringing back brackets + if (opts.preserve_brackets) { + text = text.replace(/[ ]?__BRACKETS__PRESERVER__[ ]?/g, function () { + return brackets.shift(); }); - }, - - fixNumeralSymbols: function fixNumeralSymbols (text, options) { - return text - // replaces english percent signs (U+066A) - // props @ebraminio/persiantools - .replace(newRegExp('([' + this.digits + ']) ?%'), '$1٪') - // replaces dots between numbers into decimal separator (U+066B) - // props @ebraminio/persiantools - .replace(newRegExp('([' + this.digits + '])\\.(?=[' + this.digits + '])'), '$1٫') - // replaces commas between numbers into thousands separator (U+066C) - // props @languagetool-org - .replace(newRegExp('([' + this.digits + '])\\,(?=[' + this.digits + '])'), '$1٬') - ; - }, - - fixPunctuations: function fixPunctuations (text, options) { - return this.charReplace(text, ',;', '،؛'); - }, - - // replaces question marks with its persian equivalent - fixQuestionMark: function fixQuestionMark (text, options) { - return text - .replace(/(\?)/g, '\u061F') // \u061F = ؟ - ; - }, - - // puts zwnj between the word and the prefix: - // - mi* nemi* bi* - // NOTE: there's a possible bug here: prefixes could be separate nouns - fixPerfixSpacing: function fixPerfixSpacing (text, options) { - return text - .replace(/((\s|^)ن?می) ([^ ])/g, '$1\u200c$3') - .replace(/((\s|^)بی) ([^ ])/g, '$1\u200c$3') // props @zoghal - ; - }, - - // puts zwnj between the word and the suffix - // NOTE: possible bug: suffixes could be nouns - fixSuffixSpacing: function fixSuffixSpacing (text, options) { - var replacement = '$1\u200c$2'; - return text - - // must done before others - // *ha *haye - .replace(newRegExp('([' + charsPersian + charsDiacritic + ']) (ها(ی)?[' + patternAfter + '])'), replacement) - - // *am *at *ash *ei *eid *eem *and *man *tan *shan - .replace(newRegExp('([' + charsPersian + charsDiacritic + ']) ((ام|ات|اش|ای|اید|ایم|اند|مان|تان|شان)[' + patternAfter + '])'), replacement) - - // *tar *tari *tarin - .replace(newRegExp('([' + charsPersian + charsDiacritic + ']) (تر((ی)|(ین))?[' + patternAfter + '])'), replacement) - - // *hayee *hayam *hayat *hayash *hayetan *hayeman *hayeshan - .replace(newRegExp('([' + charsPersian + charsDiacritic + ']) ((هایی|هایم|هایت|هایش|هایمان|هایتان|هایشان)[' + patternAfter + '])'), replacement) - ; - }, - - fixSuffixSpacingHamzeh: function fixSuffixSpacingHamzeh (text, options) { - text = text.replace(/(\S)(ه[\s\u200c]+[یي])([\s\u200c])/g, '$1\u0647\u200c\u06cc$3'); // heh + ye - text = text.replace(/(\S)(ه[\s\u200c]?\u0621)([\s\u200c])/g, '$1\u0647\u200c\u06cc$3'); // heh + standalone hamza - text = text.replace(/(\S)(ه[\s\u200c]?\u0654)([\s\u200c])/g, '$1\u0647\u200c\u06cc$3'); // heh + hamza above + } - return text; - }, - - fixSuffixMisc: function fixSuffixMisc (text, options) { - return text - // replaces ه followed by ئ or ی, and then by ی, with ه\u200cای, - // EXAMPLE: خانه‌ئی becomes خانه‌ای - // props @ebraminio/persiantools - .replace(/(\S)ه[\u200c\u200e][ئی]ی([\s\u200c\u200e])/g, '$1ه\u200cای$2'); - }, - - cleanupExtraMarks: function cleanupExtraMarks (text, options) { - return text - // replaces more than one exclamation mark with just one - .replace(/(!){2,}/g, '$1') - // replaces more than one english or persian question mark with just one - .replace(/(\u061F|\?){2,}/g, '$1') // \u061F = `؟` - // re-orders consecutive marks - .replace(/(!)([\s]*)([\u061F?])/g, '$3$1') // `?!` --> `!?` - ; - }, - - // replaces kashidas to ndash in parenthetic - kashidasAsParenthetic: function kashidasAsParenthetic (text, options) { - return text - .replace(/(\s)\u0640+/g, '$1–') - .replace(/\u0640+(\s)/g, '–$1') - ; - }, - - cleanupKashidas: function cleanupKashidas (text, options) { - return text - // converts kashida between numbers to ndash - .replace(/([0-9۰-۹]+)ـ+([0-9۰-۹]+)/g, '$1–$2') - - // removes all kashidas between non-whitespace characters - // NOTE: strange that we have to do this twice! - .replace(/(\S)\u0640+(\S)/g, '$1$2') - .replace(/(\S)\u0640+(\S)/g, '$1$2') - ; - }, - - fixPunctuationSpacing: function fixPunctuationSpacing (text, options) { - return text - // : ; , . ! ? and their persian equivalents should have - // one space after and no space before - .replace(/[ \t\u200c]*([:;,؛،.؟?!]{1})[ \t\u200c]*/g, '$1 ') - - // removes space after colon that separates time parts - .replace(/([0-9۰-۹]+):\s+([0-9۰-۹]+)/g, '$1:$2') - - // removes space after dots in numbers - .replace(/([0-9۰-۹]+)\. ([0-9۰-۹]+)/g, '$1.$2') - - // removes space before common domain tlds - .replace(/([\w\-_]+)\. (ir|com|org|net|info|edu|me)([\s/\\\])»:;.])/g, '$1.$2$3') - - // removes space between question and exclamation marks - .replace(/([\u061F?!])\s+([\u061F?!])/g, '$1$2') - - // removes space between same marks (in case `cleanup_extra_marks` disabled) - .replace(/!\s{1,}!/g, '!!') - .replace(/\?\s{1,}\?/g, '??') - .replace(/؟\s{1,}؟/g, '؟؟') - ; - }, - - fixBracesSpacing: function fixBracesSpacing (text, options) { - return text - // removes inside spaces and more than one outside - // for `()`, `[]`, `{}`, `“”` and `«»` - .replace(/[ \t\u200c]*(\()\s*([^)]+?)\s*?(\))[ \t\u200c]*/g, ' $1$2$3 ') - .replace(/[ \t\u200c]*(\[)\s*([^\]]+?)\s*?(\])[ \t\u200c]*/g, ' $1$2$3 ') - .replace(/[ \t\u200c]*(\{)\s*([^}]+?)\s*?(\})[ \t\u200c]*/g, ' $1$2$3 ') - .replace(/[ \t\u200c]*(“)\s*([^”]+?)\s*?(”)[ \t\u200c]*/g, ' $1$2$3 ') - .replace(/[ \t\u200c]*(«)\s*([^»]+?)\s*?(»)[ \t\u200c]*/g, ' $1$2$3 ') - ; - }, - - fixBracesSpacingInside: function fixBracesSpacingInside (text, options) { - return text - // removes inside spaces for `()`, `[]`, `{}`, `“”` and `«»` - .replace(/(\()\s*([^)]+?)\s*?(\))/g, '$1$2$3') - .replace(/(\[)\s*([^\]]+?)\s*?(\])/g, '$1$2$3') - .replace(/(\{)\s*([^}]+?)\s*?(\})/g, '$1$2$3') - .replace(/(“)\s*([^”]+?)\s*?(”)/g, '$1$2$3') - .replace(/(«)\s*([^»]+?)\s*?(»)/g, '$1$2$3') - ; - }, - - markdownNormalizeBraces: function markdownNormalizeBraces (text, options) { - return text - // removes space between ! and opening brace on markdown images - // EXAMPLE: `! [alt] (src)` --> `![alt](src)` - // .replace(/! (\[.*?\])(\(.*?\))[ ]?/g, '!$1$2') - .replace(/! (\[.*?\])\s?(\(.*?\))[ ]?/g, '!$1$2') - - // removes spaces between [] and () - // EXAMPLE: `[text] (link)` --> `[text](link)` - .replace(/(\[.*?\])\s+(\(.*?\))/g, '$1$2') - - // removes spaces inside double () [] {} - // EXAMPLE: `[[ text ]]` --> `[[text]]` - .replace(/\(\(\s*(.*?)\s*\)\)/g, '(($1))') - .replace(/\[\[\s*(.*?)\s*\]\]/g, '[[$1]]') - .replace(/\{\{\s*(.*?)\s*\}\}/g, '{{$1}}') - .replace(/\{\{\{\s*(.*?)\s*\}\}\}/g, '{{{$1}}}') // mustache escape - - // removes spaces between double () [] {} - // EXAMPLE: `[[text] ]` --> `[[text]]` - .replace(/(\(\(.*\))\s+(\))/g, '$1$2') - .replace(/(\[\[.*\])\s+(\])/g, '$1$2') - .replace(/(\{\{.*\})\s+(\})/g, '$1$2') - ; - }, - - markdownNormalizeLists: function markdownNormalizeLists (text, options) { - return text - // removes extra line between two items list - .replace(/((\n|^)\*.*?)\n+(?=\n\*)/g, '$1') - .replace(/((\n|^)-.*?)\n+(?=\n-)/g, '$1') - .replace(/((\n|^)#.*?)\n+(?=\n#)/g, '$1') - ; - }, - - // @REF: https://en.wikipedia.org/wiki/Persian_alphabet#Diacritics - // `\u064e\u0650\u064f\u064b\u064d\u064c\u0651\u06c0` - fixDiacritics: function fixDiacritics (text, options) { - return text - // cleans zwnj before diacritic characters - // .replace(/\u200c([\u064e\u0650\u064f\u064b\u064d\u064c\u0651\u06c0])/g, '$1') - .replace(/\u200c([ًٌٍَُِّْ])/g, '$1') - - // cleans more than one diacritic characters - // props @languagetool-org - // .replace(/(.*)([\u064e\u0650\u064f\u064b\u064d\u064c\u0651\u06c0]){2,}(.*)/, '$1$2$3') - .replace(/(.*)([ًٌٍَُِّْ]){2,}(.*)/, '$1$2$3') - - // cleans spaces before diacritic characters - // .replace(/(\S)[ ]+([\u064e\u0650\u064f\u064b\u064d\u064C\u0651\u06C0])/g, '$1$2') - .replace(/(\S)[ ]+([ًٌٍَُِّْ])/g, '$1$2') - ; - }, - - cleanupSpacing: function cleanupSpacing (text, options) { - return text - // replaces more than one space with just a single one - .replace(/[ ]+/g, ' ') - - // cleans whitespace/zwnj between new-lines - // @REF: https://stackoverflow.com/a/10965543/ - .replace(/\n[\s\u200c]*\n/g, '\n\n'); - }, - - // cleans more than two contiguous line breaks - cleanupLineBreaks: function cleanupLineBreaks (text, options) { - return text.replace(/(\n{2,})/g, '\n\n'); - }, - - cleanupBeginAndEnd: function cleanupBeginAndEnd (text, options) { - return text - // removes space/tab/zwnj/nbsp from the beginning of the new-lines - .replace(/([\n]+)[ \t\u200c\u00a0]*/g, '$1') - // removes spaces, tabs, zwnj, direction marks and new lines from - // the beginning and end of text - // @REF: http://stackoverflow.com/a/38490203 - .replace(/^[\s\u200c\u200e\u200f]+|[\s\u200c\u200e\u200f]+$/g, ''); - }, - - flipPunctuations: function flipPunctuations (text, options) { - var end = ['-']; - var start = ['!', '.', '،', '…', '"']; - var before = []; - var after = []; - - text = this.fixThreeDots(text, options); - - for (var iStart = 0; iStart < start.length; iStart++) { - var sElement = start[iStart]; - var sReg = newRegExp('^\\' + sElement, 'i'); - if (sReg.test(text)) { - text = text.replace(sReg, '').trim(); - after.push(sElement); - } - } + // bringing back HTML comments + if (opts.preserve_comments) { + text = text.replace(/[ ]?__COMMENT__PRESERVER__[ ]?/g, function () { + return comments.shift(); + }); + } + + // bringing back HTML tags + if (opts.preserve_HTML) { + text = text.replace(/[ ]?__HTML__PRESERVER__[ ]?/g, function () { + return html.shift(); + }); + } + + // bringing back frontmatter + if (opts.preserve_frontmatter) { + text = text.replace(/[ ]?__FRONTMATTER__PRESERVER__[ ]?/g, function () { + return frontmatter.shift(); + }); + } + + if (opts.cleanup_begin_and_end) { + text = cleanupBeginAndEnd(text, opts); + } else { + // removes single space paddings around the string + text = text.replace(/^[ ]/g, ''); + text = text.replace(/[ ]$/g, ''); + } + + return text; + } + + // props @ebraminio/persiantools + function cleanupZWNJ (text, options) { + return text + // converts all soft hyphens (­) into zwnj + .replace(/\u00ad/g, '\u200c') + + // removes more than one zwnj + .replace(/\u200c{2,}/g, '\u200c') + + // cleans zwnj before and after numbers, english words, spaces and punctuations + .replace(/\u200c([\w\s0-9۰-۹[\](){}«»“”.…,:;?!$%@#*=+\-/\\،؛٫٬×٪؟ـ])/g, '$1') + .replace(/([\w\s0-9۰-۹[\](){}«»“”.…,:;?!$%@#*=+\-/\\،؛٫٬×٪؟ـ])\u200c/g, '$1') + + // removes unnecessary zwnj on start/end of each line + .replace(/(^\u200c|\u200c$)/gm, '') + ; + } + + // late checks for zwnjs + function cleanupZWNJLate (text, options) { + return text + // cleans zwnj after characters that don't conncet to the next + .replace(/([إأةؤورزژاآدذ،؛,:«»\\/@#$٪×*()ـ\-=|])\u200c/g, '$1') + ; + } - for (var iEnd = 0; iEnd < end.length; iEnd++) { - var eElement = end[iEnd]; - var eReg = newRegExp('\\' + eElement + '$', 'i'); - if (eReg.test(text)) { - text = text.replace(eReg, '').trim(); - before.push(eElement); + // converts numeral and selected html character-sets into original characters + // @props: @substack/node-ent + function decodeHTMLEntities (text, options) { + return text.replace(/&(#?[^;\W]+;?)/g, function (matched, match) { + var n; + if ((n = /^#(\d+);?$/.exec(match))) { + return String.fromCharCode(parseInt(n[1], 10)); + } else if ((n = /^#[Xx]([A-Fa-f0-9]+);?/.exec(match))) { + return String.fromCharCode(parseInt(n[1], 16)); + } else { + var hasSemi = /;$/.test(match); + var withoutSemi = hasSemi ? match.replace(/;$/, '') : match; + var target = entities[withoutSemi] || (hasSemi && entities[match]); + + if (typeof target === 'number') { + return String.fromCharCode(target); + } else if (typeof target === 'string') { + return target; + } else { + return '&' + match; } } + }); + } + + // replaces windows end of lines with unix eol (`\n`) + function normalizeEOL (text, options) { + return text + .replace(/(\r?\n)|(\r\n?)/g, '\n') + ; + } + + function fixDashes (text, options) { + return text + // replaces triple dash to mdash + .replace(/-{3}/g, '—') + // replaces double dash to ndash + .replace(/-{2}/g, '–') + ; + } + + // replaces three dots with ellipsis character + function fixThreeDots (text, options) { + return text + .replace(/\s*\.{3,}/g, '…') + ; + } + + function normalizeEllipsis (text, options) { + return text + // replaces more than one ellipsis with one + .replace(/(…){2,}/g, '…') + // replaces (space|tab|zwnj) after ellipsis with one space + // NOTE: allows for space before ellipsis + .replace(/([ ]{1,})*…[ \t\u200c]*/g, '$1… ') + ; + } + + // replaces english quote pairs with their persian equivalent + function fixEnglishQuotesPairs (text, options) { + return text + .replace(/(“)(.+?)(”)/g, '«$2»') + ; + } + + // replaces english quote marks with their persian equivalent + function fixEnglishQuotes (text, options) { + return text + .replace(/(["'`]+)(.+?)(\1)/g, '«$2»') + ; + } + + function fixHamzeh (text, options) { + return text + // replaces ه followed by (space|ZWNJ|lrm) follow by ی with هٔ + .replace(/(\S)(ه[\s\u200c\u200e]+[یي])([\s\u200c\u200e])/g, '$1هٔ$3') // heh + ye + // replaces ه followed by (space|ZWNJ|lrm|nothing) follow by ء with هٔ + .replace(/(\S)(ه[\s\u200c\u200e]?\u0621)([\s\u200c\u200e])/g, '$1هٔ$3') // heh + standalone hamza + // replaces هٓ or single-character ۀ with the standard هٔ + // props @ebraminio/persiantools + .replace(/(ۀ|هٓ)/g, 'هٔ') + ; + } + + function fixHamzehArabic (text, options) { + return text + // converts arabic hamzeh ة to هٔ + .replace(/(\S)ة([\s\u200c\u200e])/g, '$1هٔ$2') + ; + } + + function fixHamzehArabicAlt (text, options) { + return text + // converts arabic hamzeh ة to ه‌ی + .replace(/(\S)ة([\s\u200c\u200e])/g, '$1ه‌ی$2') + ; + } + + function cleanupRLM (text, options) { + return text + // converts Right-to-left marks followed by persian characters to + // zero-width non-joiners (ZWNJ) + .replace(/([^a-zA-Z\-_])(\u200F)/g, '$1\u200c') + ; + } + + // converts incorrect persian glyphs to standard characters + function fixPersianGlyphs (text, options) { + return arrReplace(text, glyphs); + } + + // props @ebraminio/persiantools + function fixMiscNonPersianChars (text, options) { + return charReplace(text, 'كڪيىۍېہە', 'ککییییههه'); + // return text + // .replace(/ك/g, 'ک') // arabic kaf + // .replace(/ڪ/g, 'ک') // arabic letter swash kaf + // .replace(/ي/g, 'ی') // arabic + // .replace(/ى/g, 'ی') // urdu + // .replace(/ۍ/g, 'ی') // pushtu + // .replace(/ې/g, 'ی') // uyghur + // .replace(/ہ/g, 'ه') // converts ہ to ه ہہہہ to ههه + // .replace(/[ەھ]/g, 'ه'); // kurdish + } + + // replaces english numbers with their persian equivalent + function fixEnglishNumbers (text, options) { + return charReplace(text, '1234567890', digits); + } + + // replaces arabic numbers with their persian equivalent + function fixArabicNumbers (text, options) { + return charReplace(text, '١٢٣٤٥٦٧٨٩٠', digits); + } + + // @REF: https://github.com/shkarimpour/pholiday/pull/5/files + function convertPersianNumbers (text, options) { + return text.replace(/[\u0660-\u0669\u06f0-\u06f9]/g, function (char) { + return char.charCodeAt(0) & 0xf; + }); + } - for (var iBefore = 0; iBefore < before.length; iBefore++) { - text = before[iBefore] + ' ' + text; + function fixNumeralSymbols (text, options) { + return text + // replaces english percent signs (U+066A) + // props @ebraminio/persiantools + .replace(newRegExp('([' + digits + ']) ?%'), '$1٪') + // replaces dots between numbers into decimal separator (U+066B) + // props @ebraminio/persiantools + .replace(newRegExp('([' + digits + '])\\.(?=[' + digits + '])'), '$1٫') + // replaces commas between numbers into thousands separator (U+066C) + // props @languagetool-org + .replace(newRegExp('([' + digits + '])\\,(?=[' + digits + '])'), '$1٬') + ; + } + + function fixPunctuations (text, options) { + return charReplace(text, ',;', '،؛'); + } + + // replaces question marks with its persian equivalent + function fixQuestionMark (text, options) { + return text + .replace(/(\?)/g, '\u061F') // \u061F = ؟ + ; + } + + // puts zwnj between the word and the prefix: + // - mi* nemi* bi* + // NOTE: there's a possible bug here: prefixes could be separate nouns + function fixPerfixSpacing (text, options) { + var replacement = '$1\u200c$3'; + return text + .replace(/((\s|^)ن?می) ([^ ])/g, replacement) + .replace(/((\s|^)بی) ([^ ])/g, replacement) // props @zoghal + ; + } + + // puts zwnj between the word and the suffix + // NOTE: possible bug: suffixes could be nouns + function fixSuffixSpacing (text, options) { + var replacement = '$1\u200c$2'; + return text + + // must done before others + // *ha *haye + .replace(newRegExp('([' + charsPersian + charsDiacritic + ']) (ها(ی)?[' + patternAfter + '])'), replacement) + + // *am *at *ash *ei *eid *eem *and *man *tan *shan + .replace(newRegExp('([' + charsPersian + charsDiacritic + ']) ((ام|ات|اش|ای|اید|ایم|اند|مان|تان|شان)[' + patternAfter + '])'), replacement) + + // *tar *tari *tarin + .replace(newRegExp('([' + charsPersian + charsDiacritic + ']) (تر((ی)|(ین))?[' + patternAfter + '])'), replacement) + + // *hayee *hayam *hayat *hayash *hayetan *hayeman *hayeshan + .replace(newRegExp('([' + charsPersian + charsDiacritic + ']) ((هایی|هایم|هایت|هایش|هایمان|هایتان|هایشان)[' + patternAfter + '])'), replacement) + ; + } + + function fixSuffixSpacingHamzeh (text, options) { + var replacement = '$1\u0647\u200c\u06cc$3'; + return text + + // heh + ye + .replace(/(\S)(ه[\s\u200c]+[یي])([\s\u200c])/g, replacement) + + // heh + standalone hamza + .replace(/(\S)(ه[\s\u200c]?\u0621)([\s\u200c])/g, replacement) + + // heh + hamza above + .replace(/(\S)(ه[\s\u200c]?\u0654)([\s\u200c])/g, replacement) + ; + } + + function fixSuffixMisc (text, options) { + return text + // replaces ه followed by ئ or ی, and then by ی, with ه\u200cای, + // EXAMPLE: خانه‌ئی becomes خانه‌ای + // props @ebraminio/persiantools + .replace(/(\S)ه[\u200c\u200e][ئی]ی([\s\u200c\u200e])/g, '$1ه\u200cای$2') + ; + } + + function cleanupExtraMarks (text, options) { + return text + // replaces more than one exclamation mark with just one + .replace(/(!){2,}/g, '$1') + // replaces more than one english or persian question mark with just one + .replace(/(\u061F|\?){2,}/g, '$1') // \u061F = `؟` + // re-orders consecutive marks + .replace(/(!)([\s]*)([\u061F?])/g, '$3$1') // `?!` --> `!?` + ; + } + + // replaces kashidas to ndash in parenthetic + function kashidasAsParenthetic (text, options) { + return text + .replace(/(\s)\u0640+/g, '$1–') + .replace(/\u0640+(\s)/g, '–$1') + ; + } + + function cleanupKashidas (text, options) { + return text + // converts kashida between numbers to ndash + .replace(/([0-9۰-۹]+)ـ+([0-9۰-۹]+)/g, '$1–$2') + + // removes all kashidas between non-whitespace characters + // NOTE: strange that we have to do this twice! + .replace(/(\S)\u0640+(\S)/g, '$1$2') + .replace(/(\S)\u0640+(\S)/g, '$1$2') + ; + } + + function fixPunctuationSpacing (text, options) { + return text + // : ; , . ! ? and their persian equivalents should have + // one space after and no space before + .replace(/[ \t\u200c]*([:;,؛،.؟?!]{1})[ \t\u200c]*/g, '$1 ') + + // removes space after colon that separates time parts + .replace(/([0-9۰-۹]+):\s+([0-9۰-۹]+)/g, '$1:$2') + + // removes space after dots in numbers + .replace(/([0-9۰-۹]+)\. ([0-9۰-۹]+)/g, '$1.$2') + + // removes space before common domain tlds + .replace(/([\w\-_]+)\. (ir|com|org|net|info|edu|me)([\s/\\\])»:;.])/g, '$1.$2$3') + + // removes space between question and exclamation marks + .replace(/([\u061F?!])\s+([\u061F?!])/g, '$1$2') + + // removes space between same marks (in case `cleanup_extra_marks` disabled) + .replace(/!\s{1,}!/g, '!!') + .replace(/\?\s{1,}\?/g, '??') + .replace(/؟\s{1,}؟/g, '؟؟') + ; + } + + function fixBracesSpacing (text, options) { + var replacement = ' $1$2$3 '; + return text + // removes inside spaces and more than one outside + // for `()`, `[]`, `{}`, `“”` and `«»` + .replace(/[ \t\u200c]*(\()\s*([^)]+?)\s*?(\))[ \t\u200c]*/g, replacement) + .replace(/[ \t\u200c]*(\[)\s*([^\]]+?)\s*?(\])[ \t\u200c]*/g, replacement) + .replace(/[ \t\u200c]*(\{)\s*([^}]+?)\s*?(\})[ \t\u200c]*/g, replacement) + .replace(/[ \t\u200c]*(“)\s*([^”]+?)\s*?(”)[ \t\u200c]*/g, replacement) + .replace(/[ \t\u200c]*(«)\s*([^»]+?)\s*?(»)[ \t\u200c]*/g, replacement) + ; + } + + function fixBracesSpacingInside (text, options) { + var replacement = '$1$2$3'; + return text + // removes inside spaces for `()`, `[]`, `{}`, `“”` and `«»` + .replace(/(\()\s*([^)]+?)\s*?(\))/g, replacement) + .replace(/(\[)\s*([^\]]+?)\s*?(\])/g, replacement) + .replace(/(\{)\s*([^}]+?)\s*?(\})/g, replacement) + .replace(/(“)\s*([^”]+?)\s*?(”)/g, replacement) + .replace(/(«)\s*([^»]+?)\s*?(»)/g, replacement) + ; + } + + function markdownNormalizeBraces (text, options) { + return text + // removes space between ! and opening brace on markdown images + // EXAMPLE: `! [alt] (src)` --> `![alt](src)` + // .replace(/! (\[.*?\])(\(.*?\))[ ]?/g, '!$1$2') + .replace(/! (\[.*?\])\s?(\(.*?\))[ ]?/g, '!$1$2') + + // removes spaces between [] and () + // EXAMPLE: `[text] (link)` --> `[text](link)` + .replace(/(\[.*?\])\s+(\(.*?\))/g, '$1$2') + + // removes spaces inside double () [] {} + // EXAMPLE: `[[ text ]]` --> `[[text]]` + .replace(/\(\(\s*(.*?)\s*\)\)/g, '(($1))') + .replace(/\[\[\s*(.*?)\s*\]\]/g, '[[$1]]') + .replace(/\{\{\s*(.*?)\s*\}\}/g, '{{$1}}') + .replace(/\{\{\{\s*(.*?)\s*\}\}\}/g, '{{{$1}}}') // mustache escape + + // removes spaces between double () [] {} + // EXAMPLE: `[[text] ]` --> `[[text]]` + .replace(/(\(\(.*\))\s+(\))/g, '$1$2') + .replace(/(\[\[.*\])\s+(\])/g, '$1$2') + .replace(/(\{\{.*\})\s+(\})/g, '$1$2') + ; + } + + function markdownNormalizeLists (text, options) { + return text + // removes extra line between two items list + .replace(/((\n|^)\*.*?)\n+(?=\n\*)/g, '$1') + .replace(/((\n|^)-.*?)\n+(?=\n-)/g, '$1') + .replace(/((\n|^)#.*?)\n+(?=\n#)/g, '$1') + ; + } + + // @REF: https://en.wikipedia.org/wiki/Persian_alphabet#Diacritics + // `\u064e\u0650\u064f\u064b\u064d\u064c\u0651\u06c0` + function fixDiacritics (text, options) { + return text + // cleans zwnj before diacritic characters + // .replace(/\u200c([\u064e\u0650\u064f\u064b\u064d\u064c\u0651\u06c0])/g, '$1') + .replace(/\u200c([ًٌٍَُِّْ])/g, '$1') + + // cleans more than one diacritic characters + // props @languagetool-org + // .replace(/(.*)([\u064e\u0650\u064f\u064b\u064d\u064c\u0651\u06c0]){2,}(.*)/, '$1$2$3') + .replace(/(.*)([ًٌٍَُِّْ]){2,}(.*)/, '$1$2$3') + + // cleans spaces before diacritic characters + // .replace(/(\S)[ ]+([\u064e\u0650\u064f\u064b\u064d\u064C\u0651\u06C0])/g, '$1$2') + .replace(/(\S)[ ]+([ًٌٍَُِّْ])/g, '$1$2') + ; + } + + function cleanupSpacing (text, options) { + return text + // replaces more than one space with just a single one + .replace(/[ ]+/g, ' ') + + // cleans whitespace/zwnj between new-lines + // @REF: https://stackoverflow.com/a/10965543/ + .replace(/\n[\s\u200c]*\n/g, '\n\n') + ; + } + + // cleans more than two contiguous line breaks + function cleanupLineBreaks (text, options) { + return text.replace(/(\n{2,})/g, '\n\n'); + } + + function cleanupBeginAndEnd (text, options) { + return text + // removes space/tab/zwnj/nbsp from the beginning of the new-lines + .replace(/([\n]+)[ \t\u200c\u00a0]*/g, '$1') + // removes spaces, tabs, zwnj, direction marks and new lines from + // the beginning and end of text + // @REF: http://stackoverflow.com/a/38490203 + .replace(/^[\s\u200c\u200e\u200f]+|[\s\u200c\u200e\u200f]+$/g, '') + ; + } + + function flipPunctuations (text, options) { + var end = ['-']; + var start = ['!', '.', '،', '…', '"']; + var before = []; + var after = []; + + text = fixThreeDots(text, options); + + for (var iStart = 0; iStart < start.length; iStart++) { + var sElement = start[iStart]; + var sReg = newRegExp('^\\' + sElement, 'i'); + if (sReg.test(text)) { + text = text.replace(sReg, '').trim(); + after.push(sElement); } + } - for (var iAfter = 0; iAfter < after.length; iAfter++) { - text += after[iAfter]; + for (var iEnd = 0; iEnd < end.length; iEnd++) { + var eElement = end[iEnd]; + var eReg = newRegExp('\\' + eElement + '$', 'i'); + if (eReg.test(text)) { + text = text.replace(eReg, '').trim(); + before.push(eElement); } + } - text = this.normalizeEllipsis(text, options); + for (var iBefore = 0; iBefore < before.length; iBefore++) { + text = before[iBefore] + ' ' + text; + } - return text; - }, + for (var iAfter = 0; iAfter < after.length; iAfter++) { + text += after[iAfter]; + } - // swap incorrect quotes pairs `»«` to `«»` and `”“` to `“”` - swapQuotes: function swapQuotes (text, options) { - text = text.replace(/(»)(.+?)(«)/g, '«$2»'); - text = text.replace(/(”)(.+?)(“)/g, '“$2”'); + return normalizeEllipsis(text, options); + } - return text; - } + // swap incorrect quotes pairs `»«` to `«»` and `”“` to `“”` + function swapQuotes (text, options) { + return text + .replace(/(»)(.+?)(«)/g, '«$2»') + .replace(/(”)(.+?)(“)/g, '“$2”') + ; + } + + Virastar.prototype = { + + // public methods + defaults: defaults, + cleanup: cleanup, + + // internal methods + // cleanupZWNJ: cleanupZWNJ, + // cleanupZWNJLate: cleanupZWNJLate, + // decodeHTMLEntities: decodeHTMLEntities, + // normalizeEOL: normalizeEOL, + // fixDashes: fixDashes, + // fixThreeDots: fixThreeDots, + // normalizeEllipsis: normalizeEllipsis, + // fixEnglishQuotesPairs: fixEnglishQuotesPairs, + // fixEnglishQuotes: fixEnglishQuotes, + // fixHamzeh: fixHamzeh, + // fixHamzehArabic: fixHamzehArabic, + // fixHamzehArabicAlt: fixHamzehArabicAlt, + // cleanupRLM: cleanupRLM, + // fixPersianGlyphs: fixPersianGlyphs, + // fixMiscNonPersianChars: fixMiscNonPersianChars, + // fixEnglishNumbers: fixEnglishNumbers, + // fixArabicNumbers: fixArabicNumbers, + // fixNumeralSymbols: fixNumeralSymbols, + // fixPunctuations: fixPunctuations, + // fixQuestionMark: fixQuestionMark, + // fixPerfixSpacing: fixPerfixSpacing, + // fixSuffixSpacing: fixSuffixSpacing, + // fixSuffixSpacingHamzeh: fixSuffixSpacingHamzeh, + // fixSuffixMisc: fixSuffixMisc, + // cleanupExtraMarks: cleanupExtraMarks, + // kashidasAsParenthetic: kashidasAsParenthetic, + // cleanupKashidas: cleanupKashidas, + // fixPunctuationSpacing: fixPunctuationSpacing, + // fixBracesSpacing: fixBracesSpacing, + // fixBracesSpacingInside: fixBracesSpacingInside, + // markdownNormalizeBraces: markdownNormalizeBraces, + // markdownNormalizeLists: markdownNormalizeLists, + // fixDiacritics: fixDiacritics, + // cleanupSpacing: cleanupSpacing, + // cleanupLineBreaks: cleanupLineBreaks, + // cleanupBeginAndEnd: cleanupBeginAndEnd, + + // extra methods + convertPersianNumbers: convertPersianNumbers, + flipPunctuations: flipPunctuations, + swapQuotes: swapQuotes }; return Virastar; diff --git a/lib/virastar.min.js b/lib/virastar.min.js index 0a56bbc..8561a99 100644 --- a/lib/virastar.min.js +++ b/lib/virastar.min.js @@ -1,6 +1 @@ -/*! -* Virastar - v0.21.0-dev - 2020-03-28 -* https://github.com/brothersincode/virastar -* Licensed: MIT -*/ -!function(e,r,n){"undefined"!=typeof module?module.exports=n():"function"==typeof define&&"object"==typeof define.amd?define(n):"undefined"!=typeof window?window[e]=n():r[e]=n()}("Virastar",this,function(){function e(r,n){if(!(this instanceof e))return new e(r,n);if(r=r||{},"object"==typeof r)this.opts=this.parseOptions(r);else if("string"==typeof r)return this.opts=this.parseOptions(n||{}),this.cleanup(r);return this}return e.prototype={defaults:{cleanup_begin_and_end:!0,cleanup_extra_marks:!0,cleanup_kashidas:!0,cleanup_line_breaks:!0,cleanup_rlm:!0,cleanup_spacing:!0,cleanup_zwnj:!0,decode_htmlentities:!0,fix_arabic_numbers:!0,fix_dashes:!0,fix_diacritics:!0,fix_english_numbers:!0,fix_english_quotes_pairs:!0,fix_english_quotes:!0,fix_hamzeh:!0,fix_hamzeh_arabic:!1,fix_misc_non_persian_chars:!0,fix_numeral_symbols:!0,fix_perfix_spacing:!0,fix_persian_glyphs:!0,fix_punctuations:!0,fix_question_mark:!0,fix_spacing_for_braces_and_quotes:!0,fix_spacing_for_punctuations:!0,fix_suffix_misc:!0,fix_suffix_spacing:!0,fix_three_dots:!0,kashidas_as_parenthetic:!0,markdown_normalize_braces:!0,markdown_normalize_lists:!0,normalize_ellipsis:!0,normalize_eol:!0,preserve_braces:!1,preserve_brackets:!1,preserve_comments:!0,preserve_entities:!0,preserve_frontmatter:!0,preserve_HTML:!0,preserve_nbsps:!0,preserve_URIs:!0,skip_markdown_ordered_lists_numbers_conversion:!1},digits:"۱۲۳۴۵۶۷۸۹۰",entities:{"sbquo;":"‚","lsquo;":"‘","lsquor;":"‚","ldquo;":"“","ldquor;":"„","rdquo;":"”","rdquor;":"”","rsquo;":"’","rsquor;":"’","apos;":"'","QUOT;":'"',QUOT:'"',"quot;":'"',quot:'"',"zwj;":"‍","ZWNJ;":"‌","zwnj;":"‌","shy;":"­"},glyphs:{"‌ه":"ﻫ","ی‌":"ﻰﻲ","ﺃ":"ﺄﺃ","ﺁ":"ﺁﺂ","ﺇ":"ﺇﺈ","ا":"ﺎا","ب":"ﺏﺐﺑﺒ","پ":"ﭖﭗﭘﭙ","ت":"ﺕﺖﺗﺘ","ث":"ﺙﺚﺛﺜ","ج":"ﺝﺞﺟﺠ","چ":"ﭺﭻﭼﭽ","ح":"ﺡﺢﺣﺤ","خ":"ﺥﺦﺧﺨ","د":"ﺩﺪ","ذ":"ﺫﺬ","ر":"ﺭﺮ","ز":"ﺯﺰ","ژ":"ﮊﮋ","س":"ﺱﺲﺳﺴ","ش":"ﺵﺶﺷﺸ","ص":"ﺹﺺﺻﺼ","ض":"ﺽﺾﺿﻀ","ط":"ﻁﻂﻃﻄ","ظ":"ﻅﻆﻇﻈ","ع":"ﻉﻊﻋﻌ","غ":"ﻍﻎﻏﻐ","ف":"ﻑﻒﻓﻔ","ق":"ﻕﻖﻗﻘ","ک":"ﮎﮏﮐﮑﻙﻚﻛﻜ","گ":"ﮒﮓﮔﮕ","ل":"ﻝﻞﻟﻠ","م":"ﻡﻢﻣﻤ","ن":"ﻥﻦﻧﻨ","ه":"ﻩﻪﻫﻬ","هٔ":"ﮤﮥ","و":"ﻭﻮ","ﺅ":"ﺅﺆ","ی":"ﯼﯽﯾﯿﻯﻰﻱﻲﻳﻴ","ئ":"ﺉﺊﺋﺌ","لا":"ﻼ","ﻹ":"ﻺ","ﻷ":"ﻸ","ﻵ":"ﻶ"},parseOptions:function(e){var r=Object.assign({},this.defaults);for(var n in r)e.hasOwnProperty(n)&&(r[n]=e[n]);return r},charReplace:function(e,r,n){var i=r.split(""),a=n.split("");for(var s in i)e=e.replace(new RegExp(i[s],"g"),a[s]);return e},arrReplace:function(e,r){for(var n in r)r.hasOwnProperty(n)&&(e=e.replace(new RegExp("["+r[n]+"]","g"),n));return e},cleanup:function(e,r){if("string"!=typeof e)throw new TypeError("Expected a String, but received "+typeof e);if(!e.trim())return e;var n=this,i=r?n.parseOptions(r):n.opts;if(e=" "+e+" ",i.preserve_frontmatter){var a=[];e=e.replace(/^ ---[\S\s]*---\s*/g,function(e){return a.push(e)," __FRONTMATTER__PRESERVER__ "})}if(i.preserve_HTML){var s=[];e=e.replace(/<\/?[a-z][^>]*?>/gi,function(e){return s.push(e)," __HTML__PRESERVER__ "})}if(i.preserve_comments){var c=[];e=e.replace(//g,function(e){return c.push(e)," __COMMENT__PRESERVER__ "})}if(i.preserve_brackets){var t=[];e=e.replace(/(\[.*?\])/g,function(e){return t.push(e)," __BRACKETS__PRESERVER__ "})}if(i.preserve_braces){var u=[];e=e.replace(/(\{.*?\})/g,function(e){return u.push(e)," __BRACES__PRESERVER__ "})}if(i.preserve_URIs){var _=[],p=[];e=e.replace(/(!)?\[(.*[^\]])?\]\((.*[^)])\)/g,function(e,r,n,i){return n&&(n=n.replace(/!\[(.*?)\]\((.*?[^)])\)/g,function(e,r,n){return _.push(n.trim()),"!["+(r||"")+"](__MD_LINK__PRESERVER__)"})),_.push(i.trim()),(r||"")+"["+(n||"")+"](__MD_LINK__PRESERVER__)"});var f="([A-Za-z][A-Za-z0-9+\\-.]*):(?:(//)(?:((?:[A-Za-z0-9\\-._~!$&'()*+,;=:]|%[0-9A-Fa-f]{2})*)@)?((?:\\[(?:(?:(?:(?:[0-9A-Fa-f]{1,4}:){6}|::(?:[0-9A-Fa-f]{1,4}:){5}|(?:[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){4}|(?:(?:[0-9A-Fa-f]{1,4}:){0,1}[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){3}|(?:(?:[0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){2}|(?:(?:[0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})?::[0-9A-Fa-f]{1,4}:|(?:(?:[0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})?::)(?:[0-9A-Fa-f]{1,4}:[0-9A-Fa-f]{1,4}|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))|(?:(?:[0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})?::[0-9A-Fa-f]{1,4}|(?:(?:[0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})?::)|[Vv][0-9A-Fa-f]+\\.[A-Za-z0-9\\-._~!$&'()*+,;=:]+)\\]|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|(?:[A-Za-z0-9\\-._~!$&'()*+,;=]|%[0-9A-Fa-f]{2})*))(?::([0-9]*))?((?:/(?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})*)*)|/((?:(?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})+(?:/(?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})*)*)?)|((?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})+(?:/(?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})*)*)|)(?:\\?((?:[A-Za-z0-9\\-._~!$&'()*+,;=:@/?]|%[0-9A-Fa-f]{2})*))?(?:\\#((?:[A-Za-z0-9\\-._~!$&'()*+,;=:@/?]|%[0-9A-Fa-f]{2})*))?";e=e.replace(new RegExp(f,"g"),function(e){return p.push(e)," __URI__PRESERVER__ "})}if(i.preserve_nbsps){var l=[];e=e.replace(/ | /gi,function(e){return l.push(e)," __NBSPS__PRESERVER__ "})}if(i.decode_htmlentities&&(e=n.decodeHTMLEntities(e,i)),i.preserve_entities){var o=[];e=e.replace(/&(#?[^;\W]+;?)/g,function(e){return o.push(e)," __ENTITIES__PRESERVER__ "})}return i.normalize_eol&&(e=n.normalizeEOL(e,i)),i.fix_dashes&&(e=n.fixDashes(e,i)),i.fix_three_dots&&(e=n.fixThreeDots(e,i)),i.normalize_ellipsis&&(e=n.normalizeEllipsis(e,i)),i.fix_english_quotes_pairs&&(e=n.fixEnglishQuotesPairs(e,i)),i.fix_english_quotes&&(e=n.fixEnglishQuotes(e,i)),i.fix_hamzeh?(i.fix_hamzeh_arabic&&(e=n.fixHamzehArabic(e,i)),e=n.fixHamzeh(e,i)):i.fix_suffix_spacing&&(i.fix_hamzeh_arabic&&(e=n.fixHamzehArabicAlt(e,i)),e=n.fixSuffixSpacingHamzeh(e,i)),i.cleanup_rlm&&(e=n.cleanupRLM(e,i)),i.cleanup_zwnj&&(e=n.cleanupZWNJ(e,i)),i.fix_arabic_numbers&&(e=n.fixArabicNumbers(e,i)),e=e.replace(/(^|\s+)([[({"'“«]?)(\S+)([\])}"'”»]?)(?=($|\s+))/g,function(e,r,a,s,c,t){return s.match(/[a-zA-Z\-_]{2,}/g)?e:s.match(/%(?:\d+\$)?[+-]?(?:[ 0]|'.{1})?-?\d*(?:\.\d+)?[bcdeEufFgGosxX]/g)?e:s.match(/&#\d+;/g)?e:i.skip_markdown_ordered_lists_numbers_conversion&&(e+c+t).match(/(?:(?:\r?\n)|(?:\r\n?)|(?:^|\n))\d+\.\s/)?e:(i.fix_english_numbers&&(e=n.fixEnglishNumbers(e,i)),i.fix_numeral_symbols&&(e=n.fixNumeralSymbols(e,i)),i.fix_punctuations&&(e=n.fixPunctuations(e,i)),i.fix_persian_glyphs&&(e=n.fixPersianGlyphs(e,i)),i.fix_misc_non_persian_chars&&(e=n.fixMiscNonPersianChars(e,i)),i.fix_question_mark&&(e=n.fixQuestionMark(e,i)),e)}),i.fix_perfix_spacing&&(e=n.fixPerfixSpacing(e,i)),i.fix_suffix_spacing&&(e=n.fixSuffixSpacing(e,i)),i.fix_suffix_misc&&(e=n.fixSuffixMisc(e,i)),i.fix_spacing_for_braces_and_quotes&&(e=n.fixBracesSpacing(e,i)),i.cleanup_extra_marks&&(e=n.cleanupExtraMarks(e,i)),i.fix_spacing_for_punctuations&&(e=n.fixPunctuationSpacing(e,i)),i.kashidas_as_parenthetic&&(e=n.kashidasAsParenthetic(e,i)),i.cleanup_kashidas&&(e=n.cleanupKashidas(e,i)),i.markdown_normalize_braces&&(e=n.markdownNormalizeBraces(e,i)),i.markdown_normalize_lists&&(e=n.markdownNormalizeLists(e,i)),i.fix_spacing_for_braces_and_quotes&&(e=n.fixBracesSpacingInside(e,i)),i.fix_diacritics&&(e=n.fixDiacritics(e,i)),i.cleanup_spacing&&(e=n.cleanupSpacing(e,i)),i.cleanup_zwnj&&(e=n.cleanupZWNJLate(e,i)),i.cleanup_line_breaks&&(e=n.cleanupLineBreaks(e,i)),i.preserve_entities&&(e=e.replace(/[ ]?__ENTITIES__PRESERVER__[ ]?/g,function(){return o.shift()})),i.preserve_nbsps&&(e=e.replace(/[ ]?__NBSPS__PRESERVER__[ ]?/g,function(){return l.shift()})),i.preserve_URIs&&(e=e.replace(/__MD_LINK__PRESERVER__/g,function(){return _.shift()}),e=e.replace(/[ ]?__URI__PRESERVER__[ ]?/g,function(){return p.shift()})),i.preserve_braces&&(e=e.replace(/[ ]?__BRACES__PRESERVER__[ ]?/g,function(){return u.shift()})),i.preserve_brackets&&(e=e.replace(/[ ]?__BRACKETS__PRESERVER__[ ]?/g,function(){return t.shift()})),i.preserve_comments&&(e=e.replace(/[ ]?__COMMENT__PRESERVER__[ ]?/g,function(){return c.shift()})),i.preserve_HTML&&(e=e.replace(/[ ]?__HTML__PRESERVER__[ ]?/g,function(){return s.shift()})),i.preserve_frontmatter&&(e=e.replace(/[ ]?__FRONTMATTER__PRESERVER__[ ]?/g,function(){return a.shift()})),i.cleanup_begin_and_end?e=n.cleanupBeginAndEnd(e,i):(e=e.replace(/^[ ]/g,""),e=e.replace(/[ ]$/g,"")),e},cleanupZWNJ:function(e,r){return e.replace(/\u00ad/g,"‌").replace(/\u200c{2,}/g,"‌").replace(/\u200c([\w\s0-9۰-۹[\](){}«»“”.…,:;?!$%@#*=+\-\/\\،؛٫٬×٪؟ـ])/g,"$1").replace(/([\w\s0-9۰-۹[\](){}«»“”.…,:;?!$%@#*=+\-\/\\،؛٫٬×٪؟ـ])\u200c/g,"$1").replace(/(^\u200c|\u200c$)/gm,"")},cleanupZWNJLate:function(e,r){return e.replace(/([إأةؤورزژاآدذ،؛,:«»\\\/@#$٪×*()ـ\-=|])\u200c/g,"$1")},decodeHTMLEntities:function(e,r){var n=this;return e.replace(/&(#?[^;\W]+;?)/g,function(e,r){var i;if(i=/^#(\d+);?$/.exec(r))return String.fromCharCode(parseInt(i[1],10));if(i=/^#[Xx]([A-Fa-f0-9]+);?/.exec(r))return String.fromCharCode(parseInt(i[1],16));var a=/;$/.test(r),s=a?r.replace(/;$/,""):r,c=n.entities[s]||a&&n.entities[r];return"number"==typeof c?String.fromCharCode(c):"string"==typeof c?c:"&"+r})},normalizeEOL:function(e,r){return e.replace(/(\r?\n)|(\r\n?)/g,"\n")},fixDashes:function(e,r){return e.replace(/-{3}/g,"—").replace(/-{2}/g,"–")},fixThreeDots:function(e,r){return e.replace(/\s*\.{3,}/g,"…")},normalizeEllipsis:function(e,r){return e.replace(/(…){2,}/g,"…").replace(/([ ]{1,})*…[ \t\u200c]*/g,"$1… ")},fixEnglishQuotesPairs:function(e,r){return e.replace(/(“)(.+?)(”)/g,"«$2»")},fixEnglishQuotes:function(e,r){return e.replace(/(["'`]+)(.+?)(\1)/g,"«$2»")},fixHamzeh:function(e,r){return e.replace(/(\S)(ه[\s\u200c\u200e]+[یي])([\s\u200c\u200e])/g,"$1هٔ$3").replace(/(\S)(ه[\s\u200c\u200e]?\u0621)([\s\u200c\u200e])/g,"$1هٔ$3").replace(/(ۀ|هٓ)/g,"هٔ")},fixHamzehArabic:function(e,r){return e.replace(/(\S)ة([\s\u200c\u200e])/g,"$1هٔ$2")},fixHamzehArabicAlt:function(e,r){return e.replace(/(\S)ة([\s\u200c\u200e])/g,"$1ه‌ی$2")},cleanupRLM:function(e,r){return e.replace(/([^a-zA-Z\-_])(\u200F)/g,"$1‌")},fixPersianGlyphs:function(e,r){return this.arrReplace(e,this.glyphs)},fixMiscNonPersianChars:function(e,r){return this.charReplace(e,"كڪيىۍېہە","ککییییههه")},fixEnglishNumbers:function(e,r){return this.charReplace(e,"1234567890",this.digits)},fixArabicNumbers:function(e,r){return this.charReplace(e,"١٢٣٤٥٦٧٨٩٠",this.digits)},convertPersianNumbers:function(e,r){return e.replace(/[\u0660-\u0669\u06f0-\u06f9]/g,function(e){return 15&e.charCodeAt(0)})},fixNumeralSymbols:function(e,r){return e.replace(new RegExp("(["+this.digits+"]) ?%","g"),"$1٪").replace(new RegExp("(["+this.digits+"])\\.(?=["+this.digits+"])","g"),"$1٫").replace(new RegExp("(["+this.digits+"])\\,(?=["+this.digits+"])","g"),"$1٬")},fixPunctuations:function(e,r){return this.charReplace(e,",;","،؛")},fixQuestionMark:function(e,r){return e.replace(/(\?)/g,"؟")},fixPerfixSpacing:function(e,r){return e.replace(/((\s|^)ن?می) ([^ ])/g,"$1‌$3").replace(/((\s|^)بی) ([^ ])/g,"$1‌$3")},fixSuffixSpacing:function(e,r){return e.replace(/ (ها(ی)?[\s.,;،؛!؟?"'()[\]{}“”«»])/g,"‌$1").replace(/ ((ام|ات|اش|ای|اید|ایم|اند|مان|تان|شان)[\s.,;،؛!؟?"'()[\]{}“”«»])/g,"‌$1").replace(/ (تر((ی)|(ین))?[\s.,;،؛!؟?"'()[\]{}“”«»])/g,"‌$1").replace(/ ((هایی|هایم|هایت|هایش|هایمان|هایتان|هایشان)[\s.,;،؛!؟?"'()[\]{}“”«»])/g,"‌$1")},fixSuffixSpacingHamzeh:function(e,r){return e=e.replace(/(\S)(ه[\s\u200c]+[یي])([\s\u200c])/g,"$1ه‌ی$3"),e=e.replace(/(\S)(ه[\s\u200c]?\u0621)([\s\u200c])/g,"$1ه‌ی$3"),e=e.replace(/(\S)(ه[\s\u200c]?\u0654)([\s\u200c])/g,"$1ه‌ی$3")},fixSuffixMisc:function(e,r){return e.replace(/(\S)ه[\u200c\u200e][ئی]ی([\s\u200c\u200e])/g,"$1ه‌ای$2")},cleanupExtraMarks:function(e,r){return e.replace(/(!){2,}/g,"$1").replace(/(\u061F|\?){2,}/g,"$1").replace(/(!)([\s]*)([\u061F?])/g,"$3$1")},kashidasAsParenthetic:function(e,r){return e.replace(/(\s)\u0640+/g,"$1–").replace(/\u0640+(\s)/g,"–$1")},cleanupKashidas:function(e,r){return e.replace(/([0-9۰-۹]+)ـ+([0-9۰-۹]+)/g,"$1–$2").replace(/(\S)\u0640+(\S)/g,"$1$2").replace(/(\S)\u0640+(\S)/g,"$1$2")},fixPunctuationSpacing:function(e,r){return e.replace(/[ \t\u200c]*([:;,؛،.؟?!]{1})[ \t\u200c]*/g,"$1 ").replace(/([0-9۰-۹]+):\s+([0-9۰-۹]+)/g,"$1:$2").replace(/([0-9۰-۹]+)\. ([0-9۰-۹]+)/g,"$1.$2").replace(/([\w\-_]+)\. (ir|com|org|net|info|edu|me)([\s\/\\\])»:;.])/g,"$1.$2$3").replace(/([\u061F?!])\s+([\u061F?!])/g,"$1$2").replace(/!\s{1,}!/g,"!!").replace(/\?\s{1,}\?/g,"??").replace(/؟\s{1,}؟/g,"؟؟")},fixBracesSpacing:function(e,r){return e.replace(/[ \t\u200c]*(\()\s*([^)]+?)\s*?(\))[ \t\u200c]*/g," $1$2$3 ").replace(/[ \t\u200c]*(\[)\s*([^\]]+?)\s*?(\])[ \t\u200c]*/g," $1$2$3 ").replace(/[ \t\u200c]*(\{)\s*([^}]+?)\s*?(\})[ \t\u200c]*/g," $1$2$3 ").replace(/[ \t\u200c]*(“)\s*([^”]+?)\s*?(”)[ \t\u200c]*/g," $1$2$3 ").replace(/[ \t\u200c]*(«)\s*([^»]+?)\s*?(»)[ \t\u200c]*/g," $1$2$3 ")},fixBracesSpacingInside:function(e,r){return e.replace(/(\()\s*([^)]+?)\s*?(\))/g,"$1$2$3").replace(/(\[)\s*([^\]]+?)\s*?(\])/g,"$1$2$3").replace(/(\{)\s*([^}]+?)\s*?(\})/g,"$1$2$3").replace(/(“)\s*([^”]+?)\s*?(”)/g,"$1$2$3").replace(/(«)\s*([^»]+?)\s*?(»)/g,"$1$2$3")},markdownNormalizeBraces:function(e,r){return e.replace(/! (\[.*?\])\s?(\(.*?\))[ ]?/g,"!$1$2").replace(/(\[.*?\])\s+(\(.*?\))/g,"$1$2").replace(/\(\(\s*(.*?)\s*\)\)/g,"(($1))").replace(/\[\[\s*(.*?)\s*\]\]/g,"[[$1]]").replace(/\{\{\s*(.*?)\s*\}\}/g,"{{$1}}").replace(/\{\{\{\s*(.*?)\s*\}\}\}/g,"{{{$1}}}").replace(/(\(\(.*\))\s+(\))/g,"$1$2").replace(/(\[\[.*\])\s+(\])/g,"$1$2").replace(/(\{\{.*\})\s+(\})/g,"$1$2")},markdownNormalizeLists:function(e,r){return e.replace(/((\n|^)\*.*?)\n+(?=\n\*)/g,"$1").replace(/((\n|^)-.*?)\n+(?=\n-)/g,"$1").replace(/((\n|^)#.*?)\n+(?=\n#)/g,"$1")},fixDiacritics:function(e,r){return e.replace(/\u200c([ًٌٍَُِّْ])/g,"$1").replace(/(.*)([ًٌٍَُِّْ]){2,}(.*)/,"$1$2$3").replace(/(\S)[ ]+([ًٌٍَُِّْ])/g,"$1$2")},cleanupSpacing:function(e,r){return e.replace(/[ ]+/g," ").replace(/\n[\s\u200c]*\n/g,"\n\n")},cleanupLineBreaks:function(e,r){return e.replace(/(\n{2,})/g,"\n\n")},cleanupBeginAndEnd:function(e,r){return e.replace(/([\n]+)[ \t\u200c\u00a0]*/g,"$1").replace(/^[\s\u200c\u200e\u200f]+|[\s\u200c\u200e\u200f]+$/g,"")},flipPunctuations:function(e,r){var n=["-"],i=["!",".","،","…",'"'],a=[],s=[];e=this.fixThreeDots(e,r);for(var c=0;c]*?>/gi,function(e){return A.push(e)," __HTML__PRESERVER__ "})}if(a.preserve_comments){var U=[];e=e.replace(//g,function(e){return U.push(e)," __COMMENT__PRESERVER__ "})}if(a.preserve_brackets){var B=[];e=e.replace(/(\[.*?\])/g,function(e){return B.push(e)," __BRACKETS__PRESERVER__ "})}if(a.preserve_braces){var H=[];e=e.replace(/(\{.*?\})/g,function(e){return H.push(e)," __BRACES__PRESERVER__ "})}if(a.preserve_URIs){var K=[],D=[];e=e.replace(/(!)?\[(.*[^\]])?\]\((.*[^)])\)/g,function(e,r,n,a){return n&&(n=n.replace(/!\[(.*?)\]\((.*?[^)])\)/g,function(e,r,n){return K.push(n.trim()),"!["+(r||"")+"](__MD_LINK__PRESERVER__)"})),K.push(a.trim()),(r||"")+"["+(n||"")+"](__MD_LINK__PRESERVER__)"}),e=e.replace(c(Q),function(e){return D.push(e)," __URI__PRESERVER__ "})}if(a.preserve_nbsps){var W=[];e=e.replace(/ | /gi,function(e){return W.push(e)," __NBSPS__PRESERVER__ "})}if(a.decode_htmlentities&&(e=s(e,a)),a.preserve_entities){var X=[];e=e.replace(/&(#?[^;\W]+;?)/g,function(e){return X.push(e)," __ENTITIES__PRESERVER__ "})}return a.normalize_eol&&(e=i(e,a)),a.fix_persian_glyphs&&(e=m(e,a)),a.fix_dashes&&(e=p(e,a)),a.fix_three_dots&&(e=f(e,a)),a.normalize_ellipsis&&(e=o(e,a)),a.fix_english_quotes_pairs&&(e=l(e,a)),a.fix_english_quotes&&(e=g(e,a)),a.fix_hamzeh?(a.fix_hamzeh_arabic&&(e=h(e,a)),e=$(e,a)):a.fix_suffix_spacing&&(a.fix_hamzeh_arabic&&(e=E(e,a)),e=P(e,a)),a.cleanup_rlm&&(e=R(e,a)),a.cleanup_zwnj&&(e=_(e,a)),a.fix_arabic_numbers&&(e=x(e,a)),e=e.replace(/(^|\s+)([[({"'“«]?)(\S+)([\])}"'”»]?)(?=($|\s+))/g,function(e,r,n,c,t,_){return c.match(/[a-zA-Z\-_]{2,}/g)?e:c.match(/%(?:\d+\$)?[+-]?(?:[ 0]|'.{1})?-?\d*(?:\.\d+)?[bcdeEufFgGosxX]/g)?e:c.match(/&#\d+;/g)?e:a.skip_markdown_ordered_lists_numbers_conversion&&(e+t+_).match(/(?:(?:\r?\n)|(?:\r\n?)|(?:^|\n))\d+\.\s/)?e:(a.fix_english_numbers&&(e=v(e,a)),a.fix_numeral_symbols&&(e=S(e,a)),a.fix_punctuations&&(e=F(e,a)),a.fix_misc_non_persian_chars&&(e=d(e,a)),a.fix_question_mark&&(e=b(e,a)),e)}),a.fix_perfix_spacing&&(e=z(e,a)),a.fix_suffix_spacing&&(e=w(e,a)),a.fix_suffix_misc&&(e=T(e,a)),a.fix_spacing_for_braces_and_quotes&&(e=Z(e,a)),a.cleanup_extra_marks&&(e=k(e,a)),a.fix_spacing_for_punctuations&&(e=y(e,a)),a.kashidas_as_parenthetic&&(e=V(e,a)),a.cleanup_kashidas&&(e=q(e,a)),a.markdown_normalize_braces&&(e=M(e,a)),a.markdown_normalize_lists&&(e=C(e,a)),a.fix_spacing_for_braces_and_quotes&&(e=I(e,a)),a.fix_diacritics&&(e=N(e,a)),a.cleanup_spacing&&(e=O(e,a)),a.cleanup_zwnj&&(e=u(e,a)),a.cleanup_line_breaks&&(e=j(e,a)),a.preserve_entities&&(e=e.replace(/[ ]?__ENTITIES__PRESERVER__[ ]?/g,function(){return X.shift()})),a.preserve_nbsps&&(e=e.replace(/[ ]?__NBSPS__PRESERVER__[ ]?/g,function(){return W.shift()})),a.preserve_URIs&&(e=e.replace(/__MD_LINK__PRESERVER__/g,function(){return K.shift()}),e=e.replace(/[ ]?__URI__PRESERVER__[ ]?/g,function(){return D.shift()})),a.preserve_braces&&(e=e.replace(/[ ]?__BRACES__PRESERVER__[ ]?/g,function(){return H.shift()})),a.preserve_brackets&&(e=e.replace(/[ ]?__BRACKETS__PRESERVER__[ ]?/g,function(){return B.shift()})),a.preserve_comments&&(e=e.replace(/[ ]?__COMMENT__PRESERVER__[ ]?/g,function(){return U.shift()})),a.preserve_HTML&&(e=e.replace(/[ ]?__HTML__PRESERVER__[ ]?/g,function(){return A.shift()})),a.preserve_frontmatter&&(e=e.replace(/[ ]?__FRONTMATTER__PRESERVER__[ ]?/g,function(){return t.shift()})),a.cleanup_begin_and_end?e=L(e,a):(e=e.replace(/^[ ]/g,""),e=e.replace(/[ ]$/g,"")),e}function _(e,r){return e.replace(/\u00ad/g,"‌").replace(/\u200c{2,}/g,"‌").replace(/\u200c([\w\s0-9۰-۹[\](){}«»“”.…,:;?!$%@#*=+\-\/\\،؛٫٬×٪؟ـ])/g,"$1").replace(/([\w\s0-9۰-۹[\](){}«»“”.…,:;?!$%@#*=+\-\/\\،؛٫٬×٪؟ـ])\u200c/g,"$1").replace(/(^\u200c|\u200c$)/gm,"")}function u(e,r){return e.replace(/([إأةؤورزژاآدذ،؛,:«»\\\/@#$٪×*()ـ\-=|])\u200c/g,"$1")}function s(e,r){return e.replace(/&(#?[^;\W]+;?)/g,function(e,r){var n;if(n=/^#(\d+);?$/.exec(r))return String.fromCharCode(parseInt(n[1],10));if(n=/^#[Xx]([A-Fa-f0-9]+);?/.exec(r))return String.fromCharCode(parseInt(n[1],16));var a=/;$/.test(r),c=a?r.replace(/;$/,""):r,t=G[c]||a&&G[r];return"number"==typeof t?String.fromCharCode(t):"string"==typeof t?t:"&"+r})}function i(e,r){return e.replace(/(\r?\n)|(\r\n?)/g,"\n")}function p(e,r){return e.replace(/-{3}/g,"—").replace(/-{2}/g,"–")}function f(e,r){return e.replace(/\s*\.{3,}/g,"…")}function o(e,r){return e.replace(/(…){2,}/g,"…").replace(/([ ]{1,})*…[ \t\u200c]*/g,"$1… ")}function l(e,r){return e.replace(/(“)(.+?)(”)/g,"«$2»")}function g(e,r){return e.replace(/(["'`]+)(.+?)(\1)/g,"«$2»")}function $(e,r){return e.replace(/(\S)(ه[\s\u200c\u200e]+[یي])([\s\u200c\u200e])/g,"$1هٔ$3").replace(/(\S)(ه[\s\u200c\u200e]?\u0621)([\s\u200c\u200e])/g,"$1هٔ$3").replace(/(ۀ|هٓ)/g,"هٔ")}function h(e,r){return e.replace(/(\S)ة([\s\u200c\u200e])/g,"$1هٔ$2")}function E(e,r){return e.replace(/(\S)ة([\s\u200c\u200e])/g,"$1ه‌ی$2")}function R(e,r){return e.replace(/([^a-zA-Z\-_])(\u200F)/g,"$1‌")}function m(e,r){return a(e,J)}function d(e,r){return n(e,"كڪيىۍېہە","ککییییههه")}function v(e,r){return n(e,"1234567890",X)}function x(e,r){return n(e,"١٢٣٤٥٦٧٨٩٠",X)}function A(e,r){return e.replace(/[\u0660-\u0669\u06f0-\u06f9]/g,function(e){return 15&e.charCodeAt(0)})}function S(e,r){return e.replace(c("(["+X+"]) ?%"),"$1٪").replace(c("(["+X+"])\\.(?=["+X+"])"),"$1٫").replace(c("(["+X+"])\\,(?=["+X+"])"),"$1٬")}function F(e,r){return n(e,",;","،؛")}function b(e,r){return e.replace(/(\?)/g,"؟")}function z(e,r){var n="$1‌$3";return e.replace(/((\s|^)ن?می) ([^ ])/g,n).replace(/((\s|^)بی) ([^ ])/g,n)}function w(e,r){var n="$1‌$2";return e.replace(c("(["+H+K+"]) (ها(ی)?["+D+"])"),n).replace(c("(["+H+K+"]) ((ام|ات|اش|ای|اید|ایم|اند|مان|تان|شان)["+D+"])"),n).replace(c("(["+H+K+"]) (تر((ی)|(ین))?["+D+"])"),n).replace(c("(["+H+K+"]) ((هایی|هایم|هایت|هایش|هایمان|هایتان|هایشان)["+D+"])"),n)}function P(e,r){var n="$1ه‌ی$3";return e.replace(/(\S)(ه[\s\u200c]+[یي])([\s\u200c])/g,n).replace(/(\S)(ه[\s\u200c]?\u0621)([\s\u200c])/g,n).replace(/(\S)(ه[\s\u200c]?\u0654)([\s\u200c])/g,n)}function T(e,r){return e.replace(/(\S)ه[\u200c\u200e][ئی]ی([\s\u200c\u200e])/g,"$1ه‌ای$2")}function k(e,r){return e.replace(/(!){2,}/g,"$1").replace(/(\u061F|\?){2,}/g,"$1").replace(/(!)([\s]*)([\u061F?])/g,"$3$1")}function V(e,r){return e.replace(/(\s)\u0640+/g,"$1–").replace(/\u0640+(\s)/g,"–$1")}function q(e,r){return e.replace(/([0-9۰-۹]+)ـ+([0-9۰-۹]+)/g,"$1–$2").replace(/(\S)\u0640+(\S)/g,"$1$2").replace(/(\S)\u0640+(\S)/g,"$1$2")}function y(e,r){return e.replace(/[ \t\u200c]*([:;,؛،.؟?!]{1})[ \t\u200c]*/g,"$1 ").replace(/([0-9۰-۹]+):\s+([0-9۰-۹]+)/g,"$1:$2").replace(/([0-9۰-۹]+)\. ([0-9۰-۹]+)/g,"$1.$2").replace(/([\w\-_]+)\. (ir|com|org|net|info|edu|me)([\s\/\\\])»:;.])/g,"$1.$2$3").replace(/([\u061F?!])\s+([\u061F?!])/g,"$1$2").replace(/!\s{1,}!/g,"!!").replace(/\?\s{1,}\?/g,"??").replace(/؟\s{1,}؟/g,"؟؟")}function Z(e,r){var n=" $1$2$3 ";return e.replace(/[ \t\u200c]*(\()\s*([^)]+?)\s*?(\))[ \t\u200c]*/g,n).replace(/[ \t\u200c]*(\[)\s*([^\]]+?)\s*?(\])[ \t\u200c]*/g,n).replace(/[ \t\u200c]*(\{)\s*([^}]+?)\s*?(\})[ \t\u200c]*/g,n).replace(/[ \t\u200c]*(“)\s*([^”]+?)\s*?(”)[ \t\u200c]*/g,n).replace(/[ \t\u200c]*(«)\s*([^»]+?)\s*?(»)[ \t\u200c]*/g,n)}function I(e,r){var n="$1$2$3";return e.replace(/(\()\s*([^)]+?)\s*?(\))/g,n).replace(/(\[)\s*([^\]]+?)\s*?(\])/g,n).replace(/(\{)\s*([^}]+?)\s*?(\})/g,n).replace(/(“)\s*([^”]+?)\s*?(”)/g,n).replace(/(«)\s*([^»]+?)\s*?(»)/g,n)}function M(e,r){return e.replace(/! (\[.*?\])\s?(\(.*?\))[ ]?/g,"!$1$2").replace(/(\[.*?\])\s+(\(.*?\))/g,"$1$2").replace(/\(\(\s*(.*?)\s*\)\)/g,"(($1))").replace(/\[\[\s*(.*?)\s*\]\]/g,"[[$1]]").replace(/\{\{\s*(.*?)\s*\}\}/g,"{{$1}}").replace(/\{\{\{\s*(.*?)\s*\}\}\}/g,"{{{$1}}}").replace(/(\(\(.*\))\s+(\))/g,"$1$2").replace(/(\[\[.*\])\s+(\])/g,"$1$2").replace(/(\{\{.*\})\s+(\})/g,"$1$2")}function C(e,r){return e.replace(/((\n|^)\*.*?)\n+(?=\n\*)/g,"$1").replace(/((\n|^)-.*?)\n+(?=\n-)/g,"$1").replace(/((\n|^)#.*?)\n+(?=\n#)/g,"$1")}function N(e,r){return e.replace(/\u200c([ًٌٍَُِّْ])/g,"$1").replace(/(.*)([ًٌٍَُِّْ]){2,}(.*)/,"$1$2$3").replace(/(\S)[ ]+([ًٌٍَُِّْ])/g,"$1$2")}function O(e,r){return e.replace(/[ ]+/g," ").replace(/\n[\s\u200c]*\n/g,"\n\n")}function j(e,r){return e.replace(/(\n{2,})/g,"\n\n")}function L(e,r){return e.replace(/([\n]+)[ \t\u200c\u00a0]*/g,"$1").replace(/^[\s\u200c\u200e\u200f]+|[\s\u200c\u200e\u200f]+$/g,"")}function U(e,r){var n=["-"],a=["!",".","،","…",'"'],t=[],_=[];e=f(e,r);for(var u=0;u Date: Sat, 28 Mar 2020 09:35:19 +0430 Subject: [PATCH 06/32] :wrench: code optimization --- lib/virastar.js | 52 ++++++++++++++++++++++++++++----------------- lib/virastar.min.js | 2 +- 2 files changed, 34 insertions(+), 20 deletions(-) diff --git a/lib/virastar.js b/lib/virastar.js index 7e8844f..b37e508 100644 --- a/lib/virastar.js +++ b/lib/virastar.js @@ -63,11 +63,14 @@ } var charsPersian = 'ءاآأإئؤبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهیةيك'; + + // @REF: https://en.wikipedia.org/wiki/Persian_alphabet#Diacritics + // `\u064e\u0650\u064f\u064b\u064d\u064c\u0651\u06c0` var charsDiacritic = 'ًٌٍَُِّْ'; - var patternAfter = '\\s.,;،؛!؟?"\'()[\\]{}“”«»'; // @source: https://github.com/jhermsmeier/uri.regex var patternURI = "([A-Za-z][A-Za-z0-9+\\-.]*):(?:(//)(?:((?:[A-Za-z0-9\\-._~!$&'()*+,;=:]|%[0-9A-Fa-f]{2})*)@)?((?:\\[(?:(?:(?:(?:[0-9A-Fa-f]{1,4}:){6}|::(?:[0-9A-Fa-f]{1,4}:){5}|(?:[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){4}|(?:(?:[0-9A-Fa-f]{1,4}:){0,1}[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){3}|(?:(?:[0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){2}|(?:(?:[0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})?::[0-9A-Fa-f]{1,4}:|(?:(?:[0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})?::)(?:[0-9A-Fa-f]{1,4}:[0-9A-Fa-f]{1,4}|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))|(?:(?:[0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})?::[0-9A-Fa-f]{1,4}|(?:(?:[0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})?::)|[Vv][0-9A-Fa-f]+\\.[A-Za-z0-9\\-._~!$&'()*+,;=:]+)\\]|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|(?:[A-Za-z0-9\\-._~!$&'()*+,;=]|%[0-9A-Fa-f]{2})*))(?::([0-9]*))?((?:/(?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})*)*)|/((?:(?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})+(?:/(?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})*)*)?)|((?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})+(?:/(?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})*)*)|)(?:\\?((?:[A-Za-z0-9\\-._~!$&'()*+,;=:@/?]|%[0-9A-Fa-f]{2})*))?(?:\\#((?:[A-Za-z0-9\\-._~!$&'()*+,;=:@/?]|%[0-9A-Fa-f]{2})*))?"; + var patternAfter = '\\s.,;،؛!؟?"\'()[\\]{}“”«»'; var defaults = { // aggresive: true, // DEPRECATED @@ -526,8 +529,7 @@ text = cleanupBeginAndEnd(text, opts); } else { // removes single space paddings around the string - text = text.replace(/^[ ]/g, ''); - text = text.replace(/[ ]$/g, ''); + text = text.replace(/^[ ]/g, '').replace(/[ ]$/g, ''); } return text; @@ -536,6 +538,7 @@ // props @ebraminio/persiantools function cleanupZWNJ (text, options) { return text + // converts all soft hyphens (­) into zwnj .replace(/\u00ad/g, '\u200c') @@ -554,6 +557,7 @@ // late checks for zwnjs function cleanupZWNJLate (text, options) { return text + // cleans zwnj after characters that don't conncet to the next .replace(/([إأةؤورزژاآدذ،؛,:«»\\/@#$٪×*()ـ\-=|])\u200c/g, '$1') ; @@ -584,42 +588,49 @@ }); } - // replaces windows end of lines with unix eol (`\n`) function normalizeEOL (text, options) { return text + + // replaces windows end of lines with unix eol (`\n`) .replace(/(\r?\n)|(\r\n?)/g, '\n') ; } function fixDashes (text, options) { return text + // replaces triple dash to mdash .replace(/-{3}/g, '—') + // replaces double dash to ndash .replace(/-{2}/g, '–') ; } - // replaces three dots with ellipsis character function fixThreeDots (text, options) { return text + + // replaces three dots with ellipsis character .replace(/\s*\.{3,}/g, '…') ; } function normalizeEllipsis (text, options) { return text + // replaces more than one ellipsis with one .replace(/(…){2,}/g, '…') + // replaces (space|tab|zwnj) after ellipsis with one space // NOTE: allows for space before ellipsis .replace(/([ ]{1,})*…[ \t\u200c]*/g, '$1… ') ; } - // replaces english quote pairs with their persian equivalent function fixEnglishQuotesPairs (text, options) { return text + + // replaces english quote pairs with their persian equivalent .replace(/(“)(.+?)(”)/g, '«$2»') ; } @@ -632,11 +643,15 @@ } function fixHamzeh (text, options) { + var replacement = '$1هٔ$3'; return text + // replaces ه followed by (space|ZWNJ|lrm) follow by ی with هٔ - .replace(/(\S)(ه[\s\u200c\u200e]+[یي])([\s\u200c\u200e])/g, '$1هٔ$3') // heh + ye + .replace(/(\S)(ه[\s\u200c\u200e]+[یي])([\s\u200c\u200e])/g, replacement) // heh + ye + // replaces ه followed by (space|ZWNJ|lrm|nothing) follow by ء with هٔ - .replace(/(\S)(ه[\s\u200c\u200e]?\u0621)([\s\u200c\u200e])/g, '$1هٔ$3') // heh + standalone hamza + .replace(/(\S)(ه[\s\u200c\u200e]?\u0621)([\s\u200c\u200e])/g, replacement) // heh + standalone hamza + // replaces هٓ or single-character ۀ with the standard هٔ // props @ebraminio/persiantools .replace(/(ۀ|هٓ)/g, 'هٔ') @@ -645,6 +660,7 @@ function fixHamzehArabic (text, options) { return text + // converts arabic hamzeh ة to هٔ .replace(/(\S)ة([\s\u200c\u200e])/g, '$1هٔ$2') ; @@ -703,15 +719,18 @@ function fixNumeralSymbols (text, options) { return text + // replaces english percent signs (U+066A) // props @ebraminio/persiantools - .replace(newRegExp('([' + digits + ']) ?%'), '$1٪') + .replace(/([۰-۹]) ?%/g, '$1٪') + // replaces dots between numbers into decimal separator (U+066B) // props @ebraminio/persiantools - .replace(newRegExp('([' + digits + '])\\.(?=[' + digits + '])'), '$1٫') + .replace(/([۰-۹])\.(?=[۰-۹])/g, '$1٫') + // replaces commas between numbers into thousands separator (U+066C) // props @languagetool-org - .replace(newRegExp('([' + digits + '])\\,(?=[' + digits + '])'), '$1٬') + .replace(/([۰-۹]),(?=[۰-۹])/g, '$1٬') ; } @@ -898,22 +917,17 @@ ; } - // @REF: https://en.wikipedia.org/wiki/Persian_alphabet#Diacritics - // `\u064e\u0650\u064f\u064b\u064d\u064c\u0651\u06c0` function fixDiacritics (text, options) { return text // cleans zwnj before diacritic characters - // .replace(/\u200c([\u064e\u0650\u064f\u064b\u064d\u064c\u0651\u06c0])/g, '$1') - .replace(/\u200c([ًٌٍَُِّْ])/g, '$1') + .replace(newRegExp('\u200c([' + charsDiacritic + '])'), '$1') // cleans more than one diacritic characters // props @languagetool-org - // .replace(/(.*)([\u064e\u0650\u064f\u064b\u064d\u064c\u0651\u06c0]){2,}(.*)/, '$1$2$3') - .replace(/(.*)([ًٌٍَُِّْ]){2,}(.*)/, '$1$2$3') + .replace(newRegExp('(.*)([' + charsDiacritic + ']){2,}(.*)'), '$1$2$3') // cleans spaces before diacritic characters - // .replace(/(\S)[ ]+([\u064e\u0650\u064f\u064b\u064d\u064C\u0651\u06C0])/g, '$1$2') - .replace(/(\S)[ ]+([ًٌٍَُِّْ])/g, '$1$2') + .replace(newRegExp('(\\S)[ ]+([' + charsDiacritic + '])'), '$1$2') ; } diff --git a/lib/virastar.min.js b/lib/virastar.min.js index 8561a99..1ad61b3 100644 --- a/lib/virastar.min.js +++ b/lib/virastar.min.js @@ -1 +1 @@ -!function(e,r,n){"undefined"!=typeof module?module.exports=n():"function"==typeof define&&"object"==typeof define.amd?define(n):"undefined"!=typeof window?window[e]=n():r[e]=n()}("Virastar",this,function(){function e(n,a){if(!(this instanceof e))return new e(n,a);if(n=n||{},"object"==typeof n)this.opts=r(n);else if("string"==typeof n)return this.opts=r(a||{}),t(n);return this}function r(e){var r=Object.assign({},W);for(var n in r)e.hasOwnProperty(n)&&(r[n]=e[n]);return r}function n(e,r,n){var a=r.split(""),t=n.split("");for(var _ in a)e=e.replace(c(a[_]),t[_]);return e}function a(e,r){for(var n in r)r.hasOwnProperty(n)&&(e=e.replace(c("["+r[n]+"]"),n));return e}function c(e,r){return new RegExp(e,r||"g")}function t(e,n){if("string"!=typeof e)throw new TypeError("Expected a String, but received "+typeof e);if(!e.trim())return e;var a=n?r(n):this.opts;if(e=" "+e+" ",a.preserve_frontmatter){var t=[];e=e.replace(/^ ---[\S\s]*---\s*/g,function(e){return t.push(e)," __FRONTMATTER__PRESERVER__ "})}if(a.preserve_HTML){var A=[];e=e.replace(/<\/?[a-z][^>]*?>/gi,function(e){return A.push(e)," __HTML__PRESERVER__ "})}if(a.preserve_comments){var U=[];e=e.replace(//g,function(e){return U.push(e)," __COMMENT__PRESERVER__ "})}if(a.preserve_brackets){var B=[];e=e.replace(/(\[.*?\])/g,function(e){return B.push(e)," __BRACKETS__PRESERVER__ "})}if(a.preserve_braces){var H=[];e=e.replace(/(\{.*?\})/g,function(e){return H.push(e)," __BRACES__PRESERVER__ "})}if(a.preserve_URIs){var K=[],D=[];e=e.replace(/(!)?\[(.*[^\]])?\]\((.*[^)])\)/g,function(e,r,n,a){return n&&(n=n.replace(/!\[(.*?)\]\((.*?[^)])\)/g,function(e,r,n){return K.push(n.trim()),"!["+(r||"")+"](__MD_LINK__PRESERVER__)"})),K.push(a.trim()),(r||"")+"["+(n||"")+"](__MD_LINK__PRESERVER__)"}),e=e.replace(c(Q),function(e){return D.push(e)," __URI__PRESERVER__ "})}if(a.preserve_nbsps){var W=[];e=e.replace(/ | /gi,function(e){return W.push(e)," __NBSPS__PRESERVER__ "})}if(a.decode_htmlentities&&(e=s(e,a)),a.preserve_entities){var X=[];e=e.replace(/&(#?[^;\W]+;?)/g,function(e){return X.push(e)," __ENTITIES__PRESERVER__ "})}return a.normalize_eol&&(e=i(e,a)),a.fix_persian_glyphs&&(e=m(e,a)),a.fix_dashes&&(e=p(e,a)),a.fix_three_dots&&(e=f(e,a)),a.normalize_ellipsis&&(e=o(e,a)),a.fix_english_quotes_pairs&&(e=l(e,a)),a.fix_english_quotes&&(e=g(e,a)),a.fix_hamzeh?(a.fix_hamzeh_arabic&&(e=h(e,a)),e=$(e,a)):a.fix_suffix_spacing&&(a.fix_hamzeh_arabic&&(e=E(e,a)),e=P(e,a)),a.cleanup_rlm&&(e=R(e,a)),a.cleanup_zwnj&&(e=_(e,a)),a.fix_arabic_numbers&&(e=x(e,a)),e=e.replace(/(^|\s+)([[({"'“«]?)(\S+)([\])}"'”»]?)(?=($|\s+))/g,function(e,r,n,c,t,_){return c.match(/[a-zA-Z\-_]{2,}/g)?e:c.match(/%(?:\d+\$)?[+-]?(?:[ 0]|'.{1})?-?\d*(?:\.\d+)?[bcdeEufFgGosxX]/g)?e:c.match(/&#\d+;/g)?e:a.skip_markdown_ordered_lists_numbers_conversion&&(e+t+_).match(/(?:(?:\r?\n)|(?:\r\n?)|(?:^|\n))\d+\.\s/)?e:(a.fix_english_numbers&&(e=v(e,a)),a.fix_numeral_symbols&&(e=S(e,a)),a.fix_punctuations&&(e=F(e,a)),a.fix_misc_non_persian_chars&&(e=d(e,a)),a.fix_question_mark&&(e=b(e,a)),e)}),a.fix_perfix_spacing&&(e=z(e,a)),a.fix_suffix_spacing&&(e=w(e,a)),a.fix_suffix_misc&&(e=T(e,a)),a.fix_spacing_for_braces_and_quotes&&(e=Z(e,a)),a.cleanup_extra_marks&&(e=k(e,a)),a.fix_spacing_for_punctuations&&(e=y(e,a)),a.kashidas_as_parenthetic&&(e=V(e,a)),a.cleanup_kashidas&&(e=q(e,a)),a.markdown_normalize_braces&&(e=M(e,a)),a.markdown_normalize_lists&&(e=C(e,a)),a.fix_spacing_for_braces_and_quotes&&(e=I(e,a)),a.fix_diacritics&&(e=N(e,a)),a.cleanup_spacing&&(e=O(e,a)),a.cleanup_zwnj&&(e=u(e,a)),a.cleanup_line_breaks&&(e=j(e,a)),a.preserve_entities&&(e=e.replace(/[ ]?__ENTITIES__PRESERVER__[ ]?/g,function(){return X.shift()})),a.preserve_nbsps&&(e=e.replace(/[ ]?__NBSPS__PRESERVER__[ ]?/g,function(){return W.shift()})),a.preserve_URIs&&(e=e.replace(/__MD_LINK__PRESERVER__/g,function(){return K.shift()}),e=e.replace(/[ ]?__URI__PRESERVER__[ ]?/g,function(){return D.shift()})),a.preserve_braces&&(e=e.replace(/[ ]?__BRACES__PRESERVER__[ ]?/g,function(){return H.shift()})),a.preserve_brackets&&(e=e.replace(/[ ]?__BRACKETS__PRESERVER__[ ]?/g,function(){return B.shift()})),a.preserve_comments&&(e=e.replace(/[ ]?__COMMENT__PRESERVER__[ ]?/g,function(){return U.shift()})),a.preserve_HTML&&(e=e.replace(/[ ]?__HTML__PRESERVER__[ ]?/g,function(){return A.shift()})),a.preserve_frontmatter&&(e=e.replace(/[ ]?__FRONTMATTER__PRESERVER__[ ]?/g,function(){return t.shift()})),a.cleanup_begin_and_end?e=L(e,a):(e=e.replace(/^[ ]/g,""),e=e.replace(/[ ]$/g,"")),e}function _(e,r){return e.replace(/\u00ad/g,"‌").replace(/\u200c{2,}/g,"‌").replace(/\u200c([\w\s0-9۰-۹[\](){}«»“”.…,:;?!$%@#*=+\-\/\\،؛٫٬×٪؟ـ])/g,"$1").replace(/([\w\s0-9۰-۹[\](){}«»“”.…,:;?!$%@#*=+\-\/\\،؛٫٬×٪؟ـ])\u200c/g,"$1").replace(/(^\u200c|\u200c$)/gm,"")}function u(e,r){return e.replace(/([إأةؤورزژاآدذ،؛,:«»\\\/@#$٪×*()ـ\-=|])\u200c/g,"$1")}function s(e,r){return e.replace(/&(#?[^;\W]+;?)/g,function(e,r){var n;if(n=/^#(\d+);?$/.exec(r))return String.fromCharCode(parseInt(n[1],10));if(n=/^#[Xx]([A-Fa-f0-9]+);?/.exec(r))return String.fromCharCode(parseInt(n[1],16));var a=/;$/.test(r),c=a?r.replace(/;$/,""):r,t=G[c]||a&&G[r];return"number"==typeof t?String.fromCharCode(t):"string"==typeof t?t:"&"+r})}function i(e,r){return e.replace(/(\r?\n)|(\r\n?)/g,"\n")}function p(e,r){return e.replace(/-{3}/g,"—").replace(/-{2}/g,"–")}function f(e,r){return e.replace(/\s*\.{3,}/g,"…")}function o(e,r){return e.replace(/(…){2,}/g,"…").replace(/([ ]{1,})*…[ \t\u200c]*/g,"$1… ")}function l(e,r){return e.replace(/(“)(.+?)(”)/g,"«$2»")}function g(e,r){return e.replace(/(["'`]+)(.+?)(\1)/g,"«$2»")}function $(e,r){return e.replace(/(\S)(ه[\s\u200c\u200e]+[یي])([\s\u200c\u200e])/g,"$1هٔ$3").replace(/(\S)(ه[\s\u200c\u200e]?\u0621)([\s\u200c\u200e])/g,"$1هٔ$3").replace(/(ۀ|هٓ)/g,"هٔ")}function h(e,r){return e.replace(/(\S)ة([\s\u200c\u200e])/g,"$1هٔ$2")}function E(e,r){return e.replace(/(\S)ة([\s\u200c\u200e])/g,"$1ه‌ی$2")}function R(e,r){return e.replace(/([^a-zA-Z\-_])(\u200F)/g,"$1‌")}function m(e,r){return a(e,J)}function d(e,r){return n(e,"كڪيىۍېہە","ککییییههه")}function v(e,r){return n(e,"1234567890",X)}function x(e,r){return n(e,"١٢٣٤٥٦٧٨٩٠",X)}function A(e,r){return e.replace(/[\u0660-\u0669\u06f0-\u06f9]/g,function(e){return 15&e.charCodeAt(0)})}function S(e,r){return e.replace(c("(["+X+"]) ?%"),"$1٪").replace(c("(["+X+"])\\.(?=["+X+"])"),"$1٫").replace(c("(["+X+"])\\,(?=["+X+"])"),"$1٬")}function F(e,r){return n(e,",;","،؛")}function b(e,r){return e.replace(/(\?)/g,"؟")}function z(e,r){var n="$1‌$3";return e.replace(/((\s|^)ن?می) ([^ ])/g,n).replace(/((\s|^)بی) ([^ ])/g,n)}function w(e,r){var n="$1‌$2";return e.replace(c("(["+H+K+"]) (ها(ی)?["+D+"])"),n).replace(c("(["+H+K+"]) ((ام|ات|اش|ای|اید|ایم|اند|مان|تان|شان)["+D+"])"),n).replace(c("(["+H+K+"]) (تر((ی)|(ین))?["+D+"])"),n).replace(c("(["+H+K+"]) ((هایی|هایم|هایت|هایش|هایمان|هایتان|هایشان)["+D+"])"),n)}function P(e,r){var n="$1ه‌ی$3";return e.replace(/(\S)(ه[\s\u200c]+[یي])([\s\u200c])/g,n).replace(/(\S)(ه[\s\u200c]?\u0621)([\s\u200c])/g,n).replace(/(\S)(ه[\s\u200c]?\u0654)([\s\u200c])/g,n)}function T(e,r){return e.replace(/(\S)ه[\u200c\u200e][ئی]ی([\s\u200c\u200e])/g,"$1ه‌ای$2")}function k(e,r){return e.replace(/(!){2,}/g,"$1").replace(/(\u061F|\?){2,}/g,"$1").replace(/(!)([\s]*)([\u061F?])/g,"$3$1")}function V(e,r){return e.replace(/(\s)\u0640+/g,"$1–").replace(/\u0640+(\s)/g,"–$1")}function q(e,r){return e.replace(/([0-9۰-۹]+)ـ+([0-9۰-۹]+)/g,"$1–$2").replace(/(\S)\u0640+(\S)/g,"$1$2").replace(/(\S)\u0640+(\S)/g,"$1$2")}function y(e,r){return e.replace(/[ \t\u200c]*([:;,؛،.؟?!]{1})[ \t\u200c]*/g,"$1 ").replace(/([0-9۰-۹]+):\s+([0-9۰-۹]+)/g,"$1:$2").replace(/([0-9۰-۹]+)\. ([0-9۰-۹]+)/g,"$1.$2").replace(/([\w\-_]+)\. (ir|com|org|net|info|edu|me)([\s\/\\\])»:;.])/g,"$1.$2$3").replace(/([\u061F?!])\s+([\u061F?!])/g,"$1$2").replace(/!\s{1,}!/g,"!!").replace(/\?\s{1,}\?/g,"??").replace(/؟\s{1,}؟/g,"؟؟")}function Z(e,r){var n=" $1$2$3 ";return e.replace(/[ \t\u200c]*(\()\s*([^)]+?)\s*?(\))[ \t\u200c]*/g,n).replace(/[ \t\u200c]*(\[)\s*([^\]]+?)\s*?(\])[ \t\u200c]*/g,n).replace(/[ \t\u200c]*(\{)\s*([^}]+?)\s*?(\})[ \t\u200c]*/g,n).replace(/[ \t\u200c]*(“)\s*([^”]+?)\s*?(”)[ \t\u200c]*/g,n).replace(/[ \t\u200c]*(«)\s*([^»]+?)\s*?(»)[ \t\u200c]*/g,n)}function I(e,r){var n="$1$2$3";return e.replace(/(\()\s*([^)]+?)\s*?(\))/g,n).replace(/(\[)\s*([^\]]+?)\s*?(\])/g,n).replace(/(\{)\s*([^}]+?)\s*?(\})/g,n).replace(/(“)\s*([^”]+?)\s*?(”)/g,n).replace(/(«)\s*([^»]+?)\s*?(»)/g,n)}function M(e,r){return e.replace(/! (\[.*?\])\s?(\(.*?\))[ ]?/g,"!$1$2").replace(/(\[.*?\])\s+(\(.*?\))/g,"$1$2").replace(/\(\(\s*(.*?)\s*\)\)/g,"(($1))").replace(/\[\[\s*(.*?)\s*\]\]/g,"[[$1]]").replace(/\{\{\s*(.*?)\s*\}\}/g,"{{$1}}").replace(/\{\{\{\s*(.*?)\s*\}\}\}/g,"{{{$1}}}").replace(/(\(\(.*\))\s+(\))/g,"$1$2").replace(/(\[\[.*\])\s+(\])/g,"$1$2").replace(/(\{\{.*\})\s+(\})/g,"$1$2")}function C(e,r){return e.replace(/((\n|^)\*.*?)\n+(?=\n\*)/g,"$1").replace(/((\n|^)-.*?)\n+(?=\n-)/g,"$1").replace(/((\n|^)#.*?)\n+(?=\n#)/g,"$1")}function N(e,r){return e.replace(/\u200c([ًٌٍَُِّْ])/g,"$1").replace(/(.*)([ًٌٍَُِّْ]){2,}(.*)/,"$1$2$3").replace(/(\S)[ ]+([ًٌٍَُِّْ])/g,"$1$2")}function O(e,r){return e.replace(/[ ]+/g," ").replace(/\n[\s\u200c]*\n/g,"\n\n")}function j(e,r){return e.replace(/(\n{2,})/g,"\n\n")}function L(e,r){return e.replace(/([\n]+)[ \t\u200c\u00a0]*/g,"$1").replace(/^[\s\u200c\u200e\u200f]+|[\s\u200c\u200e\u200f]+$/g,"")}function U(e,r){var n=["-"],a=["!",".","،","…",'"'],t=[],_=[];e=f(e,r);for(var u=0;u]*?>/gi,function(e){return A.push(e)," __HTML__PRESERVER__ "})}if(a.preserve_comments){var U=[];e=e.replace(//g,function(e){return U.push(e)," __COMMENT__PRESERVER__ "})}if(a.preserve_brackets){var B=[];e=e.replace(/(\[.*?\])/g,function(e){return B.push(e)," __BRACKETS__PRESERVER__ "})}if(a.preserve_braces){var H=[];e=e.replace(/(\{.*?\})/g,function(e){return H.push(e)," __BRACES__PRESERVER__ "})}if(a.preserve_URIs){var K=[],Q=[];e=e.replace(/(!)?\[(.*[^\]])?\]\((.*[^)])\)/g,function(e,r,n,a){return n&&(n=n.replace(/!\[(.*?)\]\((.*?[^)])\)/g,function(e,r,n){return K.push(n.trim()),"!["+(r||"")+"](__MD_LINK__PRESERVER__)"})),K.push(a.trim()),(r||"")+"["+(n||"")+"](__MD_LINK__PRESERVER__)"}),e=e.replace(c(D),function(e){return Q.push(e)," __URI__PRESERVER__ "})}if(a.preserve_nbsps){var W=[];e=e.replace(/ | /gi,function(e){return W.push(e)," __NBSPS__PRESERVER__ "})}if(a.decode_htmlentities&&(e=s(e,a)),a.preserve_entities){var X=[];e=e.replace(/&(#?[^;\W]+;?)/g,function(e){return X.push(e)," __ENTITIES__PRESERVER__ "})}return a.normalize_eol&&(e=i(e,a)),a.fix_persian_glyphs&&(e=m(e,a)),a.fix_dashes&&(e=p(e,a)),a.fix_three_dots&&(e=f(e,a)),a.normalize_ellipsis&&(e=o(e,a)),a.fix_english_quotes_pairs&&(e=l(e,a)),a.fix_english_quotes&&(e=g(e,a)),a.fix_hamzeh?(a.fix_hamzeh_arabic&&(e=h(e,a)),e=$(e,a)):a.fix_suffix_spacing&&(a.fix_hamzeh_arabic&&(e=E(e,a)),e=P(e,a)),a.cleanup_rlm&&(e=R(e,a)),a.cleanup_zwnj&&(e=_(e,a)),a.fix_arabic_numbers&&(e=x(e,a)),e=e.replace(/(^|\s+)([[({"'“«]?)(\S+)([\])}"'”»]?)(?=($|\s+))/g,function(e,r,n,c,t,_){return c.match(/[a-zA-Z\-_]{2,}/g)?e:c.match(/%(?:\d+\$)?[+-]?(?:[ 0]|'.{1})?-?\d*(?:\.\d+)?[bcdeEufFgGosxX]/g)?e:c.match(/&#\d+;/g)?e:a.skip_markdown_ordered_lists_numbers_conversion&&(e+t+_).match(/(?:(?:\r?\n)|(?:\r\n?)|(?:^|\n))\d+\.\s/)?e:(a.fix_english_numbers&&(e=v(e,a)),a.fix_numeral_symbols&&(e=S(e,a)),a.fix_punctuations&&(e=F(e,a)),a.fix_misc_non_persian_chars&&(e=d(e,a)),a.fix_question_mark&&(e=b(e,a)),e)}),a.fix_perfix_spacing&&(e=z(e,a)),a.fix_suffix_spacing&&(e=w(e,a)),a.fix_suffix_misc&&(e=T(e,a)),a.fix_spacing_for_braces_and_quotes&&(e=Z(e,a)),a.cleanup_extra_marks&&(e=k(e,a)),a.fix_spacing_for_punctuations&&(e=y(e,a)),a.kashidas_as_parenthetic&&(e=V(e,a)),a.cleanup_kashidas&&(e=q(e,a)),a.markdown_normalize_braces&&(e=M(e,a)),a.markdown_normalize_lists&&(e=C(e,a)),a.fix_spacing_for_braces_and_quotes&&(e=I(e,a)),a.fix_diacritics&&(e=N(e,a)),a.cleanup_spacing&&(e=O(e,a)),a.cleanup_zwnj&&(e=u(e,a)),a.cleanup_line_breaks&&(e=j(e,a)),a.preserve_entities&&(e=e.replace(/[ ]?__ENTITIES__PRESERVER__[ ]?/g,function(){return X.shift()})),a.preserve_nbsps&&(e=e.replace(/[ ]?__NBSPS__PRESERVER__[ ]?/g,function(){return W.shift()})),a.preserve_URIs&&(e=e.replace(/__MD_LINK__PRESERVER__/g,function(){return K.shift()}),e=e.replace(/[ ]?__URI__PRESERVER__[ ]?/g,function(){return Q.shift()})),a.preserve_braces&&(e=e.replace(/[ ]?__BRACES__PRESERVER__[ ]?/g,function(){return H.shift()})),a.preserve_brackets&&(e=e.replace(/[ ]?__BRACKETS__PRESERVER__[ ]?/g,function(){return B.shift()})),a.preserve_comments&&(e=e.replace(/[ ]?__COMMENT__PRESERVER__[ ]?/g,function(){return U.shift()})),a.preserve_HTML&&(e=e.replace(/[ ]?__HTML__PRESERVER__[ ]?/g,function(){return A.shift()})),a.preserve_frontmatter&&(e=e.replace(/[ ]?__FRONTMATTER__PRESERVER__[ ]?/g,function(){return t.shift()})),e=a.cleanup_begin_and_end?L(e,a):e.replace(/^[ ]/g,"").replace(/[ ]$/g,"")}function _(e,r){return e.replace(/\u00ad/g,"‌").replace(/\u200c{2,}/g,"‌").replace(/\u200c([\w\s0-9۰-۹[\](){}«»“”.…,:;?!$%@#*=+\-\/\\،؛٫٬×٪؟ـ])/g,"$1").replace(/([\w\s0-9۰-۹[\](){}«»“”.…,:;?!$%@#*=+\-\/\\،؛٫٬×٪؟ـ])\u200c/g,"$1").replace(/(^\u200c|\u200c$)/gm,"")}function u(e,r){return e.replace(/([إأةؤورزژاآدذ،؛,:«»\\\/@#$٪×*()ـ\-=|])\u200c/g,"$1")}function s(e,r){return e.replace(/&(#?[^;\W]+;?)/g,function(e,r){var n;if(n=/^#(\d+);?$/.exec(r))return String.fromCharCode(parseInt(n[1],10));if(n=/^#[Xx]([A-Fa-f0-9]+);?/.exec(r))return String.fromCharCode(parseInt(n[1],16));var a=/;$/.test(r),c=a?r.replace(/;$/,""):r,t=G[c]||a&&G[r];return"number"==typeof t?String.fromCharCode(t):"string"==typeof t?t:"&"+r})}function i(e,r){return e.replace(/(\r?\n)|(\r\n?)/g,"\n")}function p(e,r){return e.replace(/-{3}/g,"—").replace(/-{2}/g,"–")}function f(e,r){return e.replace(/\s*\.{3,}/g,"…")}function o(e,r){return e.replace(/(…){2,}/g,"…").replace(/([ ]{1,})*…[ \t\u200c]*/g,"$1… ")}function l(e,r){return e.replace(/(“)(.+?)(”)/g,"«$2»")}function g(e,r){return e.replace(/(["'`]+)(.+?)(\1)/g,"«$2»")}function $(e,r){var n="$1هٔ$3";return e.replace(/(\S)(ه[\s\u200c\u200e]+[یي])([\s\u200c\u200e])/g,n).replace(/(\S)(ه[\s\u200c\u200e]?\u0621)([\s\u200c\u200e])/g,n).replace(/(ۀ|هٓ)/g,"هٔ")}function h(e,r){return e.replace(/(\S)ة([\s\u200c\u200e])/g,"$1هٔ$2")}function E(e,r){return e.replace(/(\S)ة([\s\u200c\u200e])/g,"$1ه‌ی$2")}function R(e,r){return e.replace(/([^a-zA-Z\-_])(\u200F)/g,"$1‌")}function m(e,r){return a(e,J)}function d(e,r){return n(e,"كڪيىۍېہە","ککییییههه")}function v(e,r){return n(e,"1234567890",X)}function x(e,r){return n(e,"١٢٣٤٥٦٧٨٩٠",X)}function A(e,r){return e.replace(/[\u0660-\u0669\u06f0-\u06f9]/g,function(e){return 15&e.charCodeAt(0)})}function S(e,r){return e.replace(/([۰-۹]) ?%/g,"$1٪").replace(/([۰-۹])\.(?=[۰-۹])/g,"$1٫").replace(/([۰-۹]),(?=[۰-۹])/g,"$1٬")}function F(e,r){return n(e,",;","،؛")}function b(e,r){return e.replace(/(\?)/g,"؟")}function z(e,r){var n="$1‌$3";return e.replace(/((\s|^)ن?می) ([^ ])/g,n).replace(/((\s|^)بی) ([^ ])/g,n)}function w(e,r){var n="$1‌$2";return e.replace(c("(["+H+K+"]) (ها(ی)?["+Q+"])"),n).replace(c("(["+H+K+"]) ((ام|ات|اش|ای|اید|ایم|اند|مان|تان|شان)["+Q+"])"),n).replace(c("(["+H+K+"]) (تر((ی)|(ین))?["+Q+"])"),n).replace(c("(["+H+K+"]) ((هایی|هایم|هایت|هایش|هایمان|هایتان|هایشان)["+Q+"])"),n)}function P(e,r){var n="$1ه‌ی$3";return e.replace(/(\S)(ه[\s\u200c]+[یي])([\s\u200c])/g,n).replace(/(\S)(ه[\s\u200c]?\u0621)([\s\u200c])/g,n).replace(/(\S)(ه[\s\u200c]?\u0654)([\s\u200c])/g,n)}function T(e,r){return e.replace(/(\S)ه[\u200c\u200e][ئی]ی([\s\u200c\u200e])/g,"$1ه‌ای$2")}function k(e,r){return e.replace(/(!){2,}/g,"$1").replace(/(\u061F|\?){2,}/g,"$1").replace(/(!)([\s]*)([\u061F?])/g,"$3$1")}function V(e,r){return e.replace(/(\s)\u0640+/g,"$1–").replace(/\u0640+(\s)/g,"–$1")}function q(e,r){return e.replace(/([0-9۰-۹]+)ـ+([0-9۰-۹]+)/g,"$1–$2").replace(/(\S)\u0640+(\S)/g,"$1$2").replace(/(\S)\u0640+(\S)/g,"$1$2")}function y(e,r){return e.replace(/[ \t\u200c]*([:;,؛،.؟?!]{1})[ \t\u200c]*/g,"$1 ").replace(/([0-9۰-۹]+):\s+([0-9۰-۹]+)/g,"$1:$2").replace(/([0-9۰-۹]+)\. ([0-9۰-۹]+)/g,"$1.$2").replace(/([\w\-_]+)\. (ir|com|org|net|info|edu|me)([\s\/\\\])»:;.])/g,"$1.$2$3").replace(/([\u061F?!])\s+([\u061F?!])/g,"$1$2").replace(/!\s{1,}!/g,"!!").replace(/\?\s{1,}\?/g,"??").replace(/؟\s{1,}؟/g,"؟؟")}function Z(e,r){var n=" $1$2$3 ";return e.replace(/[ \t\u200c]*(\()\s*([^)]+?)\s*?(\))[ \t\u200c]*/g,n).replace(/[ \t\u200c]*(\[)\s*([^\]]+?)\s*?(\])[ \t\u200c]*/g,n).replace(/[ \t\u200c]*(\{)\s*([^}]+?)\s*?(\})[ \t\u200c]*/g,n).replace(/[ \t\u200c]*(“)\s*([^”]+?)\s*?(”)[ \t\u200c]*/g,n).replace(/[ \t\u200c]*(«)\s*([^»]+?)\s*?(»)[ \t\u200c]*/g,n)}function I(e,r){var n="$1$2$3";return e.replace(/(\()\s*([^)]+?)\s*?(\))/g,n).replace(/(\[)\s*([^\]]+?)\s*?(\])/g,n).replace(/(\{)\s*([^}]+?)\s*?(\})/g,n).replace(/(“)\s*([^”]+?)\s*?(”)/g,n).replace(/(«)\s*([^»]+?)\s*?(»)/g,n)}function M(e,r){return e.replace(/! (\[.*?\])\s?(\(.*?\))[ ]?/g,"!$1$2").replace(/(\[.*?\])\s+(\(.*?\))/g,"$1$2").replace(/\(\(\s*(.*?)\s*\)\)/g,"(($1))").replace(/\[\[\s*(.*?)\s*\]\]/g,"[[$1]]").replace(/\{\{\s*(.*?)\s*\}\}/g,"{{$1}}").replace(/\{\{\{\s*(.*?)\s*\}\}\}/g,"{{{$1}}}").replace(/(\(\(.*\))\s+(\))/g,"$1$2").replace(/(\[\[.*\])\s+(\])/g,"$1$2").replace(/(\{\{.*\})\s+(\})/g,"$1$2")}function C(e,r){return e.replace(/((\n|^)\*.*?)\n+(?=\n\*)/g,"$1").replace(/((\n|^)-.*?)\n+(?=\n-)/g,"$1").replace(/((\n|^)#.*?)\n+(?=\n#)/g,"$1")}function N(e,r){return e.replace(c("‌(["+K+"])"),"$1").replace(c("(.*)(["+K+"]){2,}(.*)"),"$1$2$3").replace(c("(\\S)[ ]+(["+K+"])"),"$1$2")}function O(e,r){return e.replace(/[ ]+/g," ").replace(/\n[\s\u200c]*\n/g,"\n\n")}function j(e,r){return e.replace(/(\n{2,})/g,"\n\n")}function L(e,r){return e.replace(/([\n]+)[ \t\u200c\u00a0]*/g,"$1").replace(/^[\s\u200c\u200e\u200f]+|[\s\u200c\u200e\u200f]+$/g,"")}function U(e,r){var n=["-"],a=["!",".","،","…",'"'],t=[],_=[];e=f(e,r);for(var u=0;u Date: Fri, 3 Apr 2020 04:42:50 +0430 Subject: [PATCH 07/32] demo: copy in clipboard --- demo/clipboard.min.js | 7 +++++++ demo/index.html | 2 ++ demo/script.js | 15 ++++++++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 demo/clipboard.min.js diff --git a/demo/clipboard.min.js b/demo/clipboard.min.js new file mode 100644 index 0000000..28650f3 --- /dev/null +++ b/demo/clipboard.min.js @@ -0,0 +1,7 @@ +/*! + * clipboard.js v2.0.6 + * https://clipboardjs.com/ + * + * Licensed MIT © Zeno Rocha + */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ClipboardJS=e():t.ClipboardJS=e()}(this,function(){return o={},r.m=n=[function(t,e){t.exports=function(t){var e;if("SELECT"===t.nodeName)t.focus(),e=t.value;else if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName){var n=t.hasAttribute("readonly");n||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),n||t.removeAttribute("readonly"),e=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var o=window.getSelection(),r=document.createRange();r.selectNodeContents(t),o.removeAllRanges(),o.addRange(r),e=o.toString()}return e}},function(t,e){function n(){}n.prototype={on:function(t,e,n){var o=this.e||(this.e={});return(o[t]||(o[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){var o=this;function r(){o.off(t,r),e.apply(n,arguments)}return r._=e,this.on(t,r,n)},emit:function(t){for(var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),o=0,r=n.length;oویراستار (نگارش در حال توسعه) @@ -35,6 +36,7 @@

ویراستار (نگارش var html=document.querySelector("html");html.classList.remove("no-js"); + diff --git a/demo/script.js b/demo/script.js index e92208b..c4aea3f 100644 --- a/demo/script.js +++ b/demo/script.js @@ -1,7 +1,8 @@ -/* global Virastar, Diff, syncscroll */ +/* global Virastar, ClipboardJS, Diff, syncscroll */ (function (w) { var virastar; + var clipboard; var app = { settings: undefined, @@ -189,6 +190,18 @@ } else { this.doVirastar(initial, options); } + }, + + initClipboard: function () { + clipboard = new ClipboardJS('.copy'); + + clipboard.on('success', function (e) { + console.log(e); + }); + + clipboard.on('error', function (e) { + console.log(e); + }); } }; From e7fdd062c79564a808de7db7589c34765b57f5fb Mon Sep 17 00:00:00 2001 From: Nasser Rafie Date: Fri, 3 Apr 2020 11:00:19 +0430 Subject: [PATCH 08/32] demo: copy in clipboard (missed) --- demo/script.js | 1 + 1 file changed, 1 insertion(+) diff --git a/demo/script.js b/demo/script.js index c4aea3f..c8a6059 100644 --- a/demo/script.js +++ b/demo/script.js @@ -165,6 +165,7 @@ this.initSettings(); this.initVirastar(); + this.initClipboard(); syncscroll.reset(); }, From 13b4d9d014908f10a9151a8611d3eaae1aede261 Mon Sep 17 00:00:00 2001 From: Nasser Rafie Date: Sat, 11 Apr 2020 01:34:54 +0430 Subject: [PATCH 09/32] lazy seek before dashes on frontmatter preserving --- CHANGELOG.md | 1 + lib/virastar.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 907d858..56a9aa3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ### [develop] - Changed: early fix persian glyphs +- Fixed: lazy seek before dashes on frontmatter preserving ### 0.20.0 - Added: cleanup zwnj before/after ellipsis diff --git a/lib/virastar.js b/lib/virastar.js index b37e508..22033e1 100644 --- a/lib/virastar.js +++ b/lib/virastar.js @@ -209,7 +209,7 @@ // preserves frontmatter data in the text if (opts.preserve_frontmatter) { var frontmatter = []; - text = text.replace(/^ ---[\S\s]*---\s*/g, function (matched) { + text = text.replace(/^ ---[\S\s]*?---\n/g, function (matched) { frontmatter.push(matched); return ' __FRONTMATTER__PRESERVER__ '; }); From 5e474aa91e91b0a89b91369032e7deed1dc05e46 Mon Sep 17 00:00:00 2001 From: Nasser Rafie Date: Sat, 11 Apr 2020 01:38:53 +0430 Subject: [PATCH 10/32] combined preserving markdown links --- CHANGELOG.md | 1 + lib/virastar.js | 17 ++++++----------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 56a9aa3..9191a3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ### [develop] - Changed: early fix persian glyphs - Fixed: lazy seek before dashes on frontmatter preserving +- Fixed: combined preserving markdown links ### 0.20.0 - Added: cleanup zwnj before/after ellipsis diff --git a/lib/virastar.js b/lib/virastar.js index 22033e1..fa5d257 100644 --- a/lib/virastar.js +++ b/lib/virastar.js @@ -258,18 +258,13 @@ var mdlinks = []; var uris = []; - // stores markdown links separetly to help space cleanup working - text = text.replace(/(!)?\[(.*[^\]])?\]\((.*[^)])\)/g, function (matched, img, title, link) { - // again checks for markdown image links within - if (title) { - title = title.replace(/!\[(.*?)\]\((.*?[^)])\)/g, function (image, alt, src) { - mdlinks.push(src.trim()); - return '![' + (alt || '') + '](__MD_LINK__PRESERVER__)'; // no padding! - }); + // stores markdown links separetly + text = text.replace(/]\((.*?)\)/g, function (matched, link) { + if (link) { + mdlinks.push(link.trim()); + return '](__MD_LINK__PRESERVER__)'; // no padding! } - - mdlinks.push(link.trim()); - return (img || '') + '[' + (title || '') + '](__MD_LINK__PRESERVER__)'; // no padding! + return matched; }); text = text.replace(newRegExp(patternURI), function (matched) { From 409c9baf9dcc9ad5f8a159730add5165abc3308f Mon Sep 17 00:00:00 2001 From: Nasser Rafie Date: Sat, 11 Apr 2020 01:51:36 +0430 Subject: [PATCH 11/32] avoid new-lines as whitespaces --- CHANGELOG.md | 1 + lib/virastar.js | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9191a3e..55321ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ - Changed: early fix persian glyphs - Fixed: lazy seek before dashes on frontmatter preserving - Fixed: combined preserving markdown links +- Fixed: avoid new-lines as whitespaces ### 0.20.0 - Added: cleanup zwnj before/after ellipsis diff --git a/lib/virastar.js b/lib/virastar.js index fa5d257..ba2cfa4 100644 --- a/lib/virastar.js +++ b/lib/virastar.js @@ -606,7 +606,7 @@ return text // replaces three dots with ellipsis character - .replace(/\s*\.{3,}/g, '…') + .replace(/[ \t]*\.{3,}/g, '…') ; } @@ -803,7 +803,7 @@ // replaces more than one english or persian question mark with just one .replace(/(\u061F|\?){2,}/g, '$1') // \u061F = `؟` // re-orders consecutive marks - .replace(/(!)([\s]*)([\u061F?])/g, '$3$1') // `?!` --> `!?` + .replace(/(!)([ \t]*)([\u061F?])/g, '$3$1') // `?!` --> `!?` ; } @@ -881,8 +881,7 @@ return text // removes space between ! and opening brace on markdown images // EXAMPLE: `! [alt] (src)` --> `![alt](src)` - // .replace(/! (\[.*?\])(\(.*?\))[ ]?/g, '!$1$2') - .replace(/! (\[.*?\])\s?(\(.*?\))[ ]?/g, '!$1$2') + .replace(/! (\[.*?\])[ ]?(\(.*?\))[ ]?/g, '!$1$2') // removes spaces between [] and () // EXAMPLE: `[text] (link)` --> `[text](link)` From f4f6052ee137a2771281f8aa25b42dfe7f462227 Mon Sep 17 00:00:00 2001 From: Nasser Rafie Date: Sat, 11 Apr 2020 01:52:26 +0430 Subject: [PATCH 12/32] :wrench: maintenance --- lib/virastar.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/virastar.js b/lib/virastar.js index ba2cfa4..d2a2690 100644 --- a/lib/virastar.js +++ b/lib/virastar.js @@ -927,6 +927,7 @@ function cleanupSpacing (text, options) { return text + // replaces more than one space with just a single one .replace(/[ ]+/g, ' ') @@ -936,15 +937,20 @@ ; } - // cleans more than two contiguous line breaks function cleanupLineBreaks (text, options) { - return text.replace(/(\n{2,})/g, '\n\n'); + return text + + // cleans more than two contiguous line-breaks + .replace(/\n{2,}/g, '\n\n') + ; } function cleanupBeginAndEnd (text, options) { return text + // removes space/tab/zwnj/nbsp from the beginning of the new-lines .replace(/([\n]+)[ \t\u200c\u00a0]*/g, '$1') + // removes spaces, tabs, zwnj, direction marks and new lines from // the beginning and end of text // @REF: http://stackoverflow.com/a/38490203 From 0911203ee5db8835b456b71fc3914c0d5bf6eeb0 Mon Sep 17 00:00:00 2001 From: Nasser Rafie Date: Sat, 11 Apr 2020 01:58:11 +0430 Subject: [PATCH 13/32] removing spaces between dots --- CHANGELOG.md | 1 + README.md | 1 + lib/virastar.js | 3 +++ settings.json | 1 + test/virastar.js | 14 +++++++------- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55321ae..4072940 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ ### [develop] +- Added: removes spaces between dots on `fix_three_dots` - Changed: early fix persian glyphs - Fixed: lazy seek before dashes on frontmatter preserving - Fixed: combined preserving markdown links diff --git a/README.md b/README.md index 5e727d2..e419239 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,7 @@ Virastar comes with a list of options to control its behavior. * `fix_three_dots`, (_default_: `true`) + - removes spaces between dots - replaces three dots with ellipsis character diff --git a/lib/virastar.js b/lib/virastar.js index d2a2690..100b637 100644 --- a/lib/virastar.js +++ b/lib/virastar.js @@ -605,6 +605,9 @@ function fixThreeDots (text, options) { return text + // removes spaces between dots + .replace(/\.([ ]+)(?=[.])/g, '.') + // replaces three dots with ellipsis character .replace(/[ \t]*\.{3,}/g, '…') ; diff --git a/settings.json b/settings.json index 129d190..f53b176 100644 --- a/settings.json +++ b/settings.json @@ -28,6 +28,7 @@ "key": "fix_three_dots", "label": "Fix three dots", "description": [ + "removes spaces between dots", "replaces three dots with ellipsis character" ], "default": true diff --git a/test/virastar.js b/test/virastar.js index ae45c5d..8efc6d1 100644 --- a/test/virastar.js +++ b/test/virastar.js @@ -173,13 +173,6 @@ describe('Virastar.js', function () { assert.strictEqual(virastar.cleanup('"این" یا "آن"'), '«این» یا «آن»'); // not greedy }); - it('should replace three dots with ellipsis', function () { - assert.strictEqual(virastar.cleanup('...'), '…'); - assert.strictEqual(virastar.cleanup('....'), '…'); - assert.strictEqual(virastar.cleanup('.........'), '…'); - assert.strictEqual(virastar.cleanup('خداحافظ ... به به'), 'خداحافظ… به به'); - }); - it('should convert ه ی to هٔ', function () { assert.strictEqual(virastar.cleanup('خانه ی ما'), 'خانهٔ ما'); assert.strictEqual(virastar.cleanup('خانه ی ما'), 'خانهٔ ما'); @@ -434,5 +427,12 @@ describe('Virastar.js', function () { assert.strictEqual(virastar.cleanup('آن دسته از علایم که مشخص‌کنندة انتهای جمله', { fix_hamzeh_arabic: true }), 'آن دسته از علایم که مشخص‌کنندهٔ انتهای جمله'); assert.strictEqual(virastar.cleanup('آن دسته از علایم که مشخص‌کنندة انتهای جمله', { fix_hamzeh_arabic: true, fix_hamzeh: false }), 'آن دسته از علایم که مشخص‌کننده‌ی انتهای جمله'); }); + + it('extra: fixThreeDots(): removes space between dots/replaces three dots with ellipsis character', function () { + assert.strictEqual(virastar.cleanup('...'), '…'); + assert.strictEqual(virastar.cleanup('......'), '…'); + assert.strictEqual(virastar.cleanup('. . . . ... ..... . . . .'), '…'); + assert.strictEqual(virastar.cleanup('خداحافظ ... به به'), 'خداحافظ… به به'); + }); }); }); From cadfb9f4f1e9cfc081c9a500caeadd980f145543 Mon Sep 17 00:00:00 2001 From: Nasser Rafie Date: Sat, 11 Apr 2020 06:03:33 +0430 Subject: [PATCH 14/32] combined pattern for removing kashidas --- CHANGELOG.md | 1 + lib/virastar.js | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4072940..01a6781 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Fixed: lazy seek before dashes on frontmatter preserving - Fixed: combined preserving markdown links - Fixed: avoid new-lines as whitespaces +- Fixed: combined pattern for removing kashidas ### 0.20.0 - Added: cleanup zwnj before/after ellipsis diff --git a/lib/virastar.js b/lib/virastar.js index 100b637..97dbf99 100644 --- a/lib/virastar.js +++ b/lib/virastar.js @@ -824,9 +824,8 @@ .replace(/([0-9۰-۹]+)ـ+([0-9۰-۹]+)/g, '$1–$2') // removes all kashidas between non-whitespace characters - // NOTE: strange that we have to do this twice! - .replace(/(\S)\u0640+(\S)/g, '$1$2') - .replace(/(\S)\u0640+(\S)/g, '$1$2') + // MAYBE: more punctuations + .replace(/([^\s.])\u0640+(?![\s.])/g, '$1') ; } From b3eefd94f089ffab7c9732ce77e523c45c34eded Mon Sep 17 00:00:00 2001 From: Nasser Rafie Date: Sat, 11 Apr 2020 06:08:42 +0430 Subject: [PATCH 15/32] :new: option: normalize dates --- CHANGELOG.md | 1 + README.md | 4 ++++ lib/virastar.js | 15 +++++++++++++++ settings.json | 8 ++++++++ test/virastar.js | 5 +++++ 5 files changed, 33 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 01a6781..c5899ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ### [develop] - Added: removes spaces between dots on `fix_three_dots` +- Added: new option `normalize_dates` to re-order date parts with slash as delimiter - Changed: early fix persian glyphs - Fixed: lazy seek before dashes on frontmatter preserving - Fixed: combined preserving markdown links diff --git a/README.md b/README.md index e419239..99973ad 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,10 @@ Virastar comes with a list of options to control its behavior. - replaces (space|tab|zwnj) after ellipsis with one space +* `normalize_dates`, (_default_: `true`) + - re-orders date parts with slash as delimiter + + * `fix_english_quotes_pairs`, (_default_: `true`) - replaces english quote pairs (`“”`) with their persian equivalent (`«»`) diff --git a/lib/virastar.js b/lib/virastar.js index 97dbf99..8ed57fc 100644 --- a/lib/virastar.js +++ b/lib/virastar.js @@ -104,6 +104,7 @@ kashidas_as_parenthetic: true, markdown_normalize_braces: true, markdown_normalize_lists: true, + normalize_dates: true, normalize_ellipsis: true, normalize_eol: true, preserve_braces: false, @@ -398,6 +399,10 @@ } ); + if (opts.normalize_dates) { + text = normalizeDates(text, opts); + } + if (opts.fix_perfix_spacing) { text = fixPerfixSpacing(text, opts); } @@ -732,6 +737,16 @@ ; } + function normalizeDates (text) { + return text + + // re-orders date parts with slash as delimiter + .replace(/([0-9۰-۹]{1,2})([/-])([0-9۰-۹]{1,2})\2([0-9۰-۹]{4})/g, function (matched, day, delimiter, month, year) { + return year + '/' + month + '/' + day; + }) + ; + } + function fixPunctuations (text, options) { return charReplace(text, ',;', '،؛'); } diff --git a/settings.json b/settings.json index f53b176..36d73a0 100644 --- a/settings.json +++ b/settings.json @@ -42,6 +42,14 @@ ], "default": true }, + { + "key": "normalize_dates", + "label": "Normalize Dates", + "description": [ + "re-orders date parts with slash as delimiter" + ], + "default": true + }, { "key": "fix_english_quotes_pairs", "label": "Fix English Quotes Pairs", diff --git a/test/virastar.js b/test/virastar.js index 8efc6d1..8086208 100644 --- a/test/virastar.js +++ b/test/virastar.js @@ -434,5 +434,10 @@ describe('Virastar.js', function () { assert.strictEqual(virastar.cleanup('. . . . ... ..... . . . .'), '…'); assert.strictEqual(virastar.cleanup('خداحافظ ... به به'), 'خداحافظ… به به'); }); + + it('extra: normalizeDates(): reorders date parts with slash as delimiter', function () { + assert.strictEqual(virastar.cleanup('23/10/1355'), '۱۳۵۵/۱۰/۲۳'); + assert.strictEqual(virastar.cleanup('3/1/1355'), '۱۳۵۵/۱/۳'); + }); }); }); From bd7c95d6f7df41da7463c33b07c8aa9cd8446cce Mon Sep 17 00:00:00 2001 From: Nasser Rafie Date: Sat, 11 Apr 2020 06:18:55 +0430 Subject: [PATCH 16/32] demo: skip if new-lines removed --- demo/script.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/demo/script.js b/demo/script.js index c8a6059..8aa5854 100644 --- a/demo/script.js +++ b/demo/script.js @@ -122,6 +122,7 @@ var diff = Diff.diffChars(this.input.value, this.output.value, { ignoreWhitespace: false }); var fragment = document.createDocumentFragment(); var pre = document.createElement('pre'); + var newLine = new RegExp(/[^\n]/, 'g'); var span = null; var status = ''; @@ -131,6 +132,15 @@ status = part.added ? '-added' : part.removed ? '-removed' : '-none'; span.classList.add(status); + // skip if new-lines removed + if (part.removed) { + if (!newLine.test(part.value)) { + return; + } + + part.value = part.value.replace(/\n/g, ''); + } + // zwnj if (part.value === '‌') { span.classList.add('-zwnj'); From bf82d8a65f7aa2e5cc018834d75f211e99ba0a3d Mon Sep 17 00:00:00 2001 From: Nasser Rafie Date: Sat, 11 Apr 2020 06:24:13 +0430 Subject: [PATCH 17/32] prevent removing spaces after punctuations on the end of lines --- CHANGELOG.md | 1 + lib/virastar.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5899ef..a6cc6c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Fixed: combined preserving markdown links - Fixed: avoid new-lines as whitespaces - Fixed: combined pattern for removing kashidas +- Fixed: prevent removing spaces after punctuations on the end of lines ### 0.20.0 - Added: cleanup zwnj before/after ellipsis diff --git a/lib/virastar.js b/lib/virastar.js index 8ed57fc..2513423 100644 --- a/lib/virastar.js +++ b/lib/virastar.js @@ -847,8 +847,8 @@ function fixPunctuationSpacing (text, options) { return text // : ; , . ! ? and their persian equivalents should have - // one space after and no space before - .replace(/[ \t\u200c]*([:;,؛،.؟?!]{1})[ \t\u200c]*/g, '$1 ') + // no space before and one space after except followed by new-lines or preservers + .replace(/[ \t\u200c]*([:;,؛،.؟?!]{1})[ \t\u200c]*(?!\n|_{2})/g, '$1 ') // removes space after colon that separates time parts .replace(/([0-9۰-۹]+):\s+([0-9۰-۹]+)/g, '$1:$2') From 4b02589f0c44e85c08d7e6340e979d5c9a31e28f Mon Sep 17 00:00:00 2001 From: Nasser Rafie Date: Sat, 11 Apr 2020 06:25:46 +0430 Subject: [PATCH 18/32] prevent removing double spaces on the end of lines --- CHANGELOG.md | 1 + lib/virastar.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a6cc6c8..ccc05e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Fixed: avoid new-lines as whitespaces - Fixed: combined pattern for removing kashidas - Fixed: prevent removing spaces after punctuations on the end of lines +- Fixed: prevent removing double spaces on the end of lines ### 0.20.0 - Added: cleanup zwnj before/after ellipsis diff --git a/lib/virastar.js b/lib/virastar.js index 2513423..36d420f 100644 --- a/lib/virastar.js +++ b/lib/virastar.js @@ -946,7 +946,9 @@ return text // replaces more than one space with just a single one - .replace(/[ ]+/g, ' ') + // except before/after preservers and before new-lines + // .replace(/(? Date: Sat, 11 Apr 2020 06:30:13 +0430 Subject: [PATCH 19/32] removing space between different/same marks --- CHANGELOG.md | 1 + lib/virastar.js | 13 ++++++------- settings.json | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ccc05e7..d6eb723 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ - Added: removes spaces between dots on `fix_three_dots` - Added: new option `normalize_dates` to re-order date parts with slash as delimiter - Changed: early fix persian glyphs +- Changed: removing space between different/same marks - Fixed: lazy seek before dashes on frontmatter preserving - Fixed: combined preserving markdown links - Fixed: avoid new-lines as whitespaces diff --git a/lib/virastar.js b/lib/virastar.js index 36d420f..59b6ed6 100644 --- a/lib/virastar.js +++ b/lib/virastar.js @@ -816,6 +816,10 @@ function cleanupExtraMarks (text, options) { return text + + // removes space between different/same marks (combining for cleanup) + .replace(/([؟?!])([ ]+)(?=[؟?!])/g, '$1') + // replaces more than one exclamation mark with just one .replace(/(!){2,}/g, '$1') // replaces more than one english or persian question mark with just one @@ -859,13 +863,8 @@ // removes space before common domain tlds .replace(/([\w\-_]+)\. (ir|com|org|net|info|edu|me)([\s/\\\])»:;.])/g, '$1.$2$3') - // removes space between question and exclamation marks - .replace(/([\u061F?!])\s+([\u061F?!])/g, '$1$2') - - // removes space between same marks (in case `cleanup_extra_marks` disabled) - .replace(/!\s{1,}!/g, '!!') - .replace(/\?\s{1,}\?/g, '??') - .replace(/؟\s{1,}؟/g, '؟؟') + // removes space between different/same marks (double-check) + .replace(/([؟?!])([ ]+)(?=[؟?!])/g, '$1') ; } diff --git a/settings.json b/settings.json index 36d73a0..f3c1e49 100644 --- a/settings.json +++ b/settings.json @@ -207,6 +207,7 @@ "key": "cleanup_extra_marks", "label": "Cleanup Extra Marks", "description": [ + "removes space between different/same marks", "replaces more than one exclamation mark with just one", "replaces more than one english or persian question mark with just one", "re-orders consecutive marks: `?!` into `!?`" @@ -339,8 +340,7 @@ "removes space after colon that separates time parts", "removes space after dots in numbers", "removes space before some common domain tlds", - "removes space between question and exclamation marks", - "removes space between same marks" + "removes space between different/same marks" ], "default": true }, From 62cceaefbf1848dafc95e28174f1e3f69be7274b Mon Sep 17 00:00:00 2001 From: Nasser Rafie Date: Sat, 11 Apr 2020 06:30:23 +0430 Subject: [PATCH 20/32] :wrench: --- package.json | 4 +- yarn.lock | 591 +++++++++++++++++++++++++-------------------------- 2 files changed, 290 insertions(+), 305 deletions(-) diff --git a/package.json b/package.json index dc8c04c..5641b04 100644 --- a/package.json +++ b/package.json @@ -21,12 +21,12 @@ "dependencies": {}, "devDependencies": { "@babel/core": "^7.9.0", - "@babel/preset-env": "^7.9.0", + "@babel/preset-env": "^7.9.5", "@babel/register": "^7.9.0", "mocha": "^7.1.1", "semistandard": "^14.2.0", "sprintf-js": "^1.1.2", - "stylelint": "^13.2.1" + "stylelint": "^13.3.1" }, "semistandard": { "ignore": [ diff --git a/yarn.lock b/yarn.lock index c551a7a..0dd7fd5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -18,7 +18,7 @@ invariant "^2.2.4" semver "^5.5.0" -"@babel/core@>=7.2.2", "@babel/core@^7.9.0": +"@babel/core@>=7.9.0", "@babel/core@^7.9.0": version "7.9.0" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.9.0.tgz#ac977b538b77e132ff706f3b8a4dbad09c03c56e" integrity sha512-kWc7L0fw1xwvI0zi8OKVBuxRVefwGOrKSQMvrQ3dW+bIIavBY3/NpXmpjMy7bQnLgwgzWQZ8TlM57YHpHNHz4w== @@ -40,12 +40,12 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/generator@^7.9.0": - version "7.9.4" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.9.4.tgz#12441e90c3b3c4159cdecf312075bf1a8ce2dbce" - integrity sha512-rjP8ahaDy/ouhrvCoU1E5mqaitWrxwuNGU+dy1EpaoK48jZay4MdkskKGIMHLZNewg8sAsqpGSREJwP0zH3YQA== +"@babel/generator@^7.9.0", "@babel/generator@^7.9.5": + version "7.9.5" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.9.5.tgz#27f0917741acc41e6eaaced6d68f96c3fa9afaf9" + integrity sha512-GbNIxVB3ZJe3tLeDm1HSn2AhuD/mVcyLDpgtLXa5tplmWrJdF/elxB56XNqCuD6szyNkDi6wuoKXln3QeBmCHQ== dependencies: - "@babel/types" "^7.9.0" + "@babel/types" "^7.9.5" jsesc "^2.5.1" lodash "^4.17.13" source-map "^0.5.0" @@ -102,14 +102,14 @@ "@babel/traverse" "^7.8.3" "@babel/types" "^7.8.3" -"@babel/helper-function-name@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.8.3.tgz#eeeb665a01b1f11068e9fb86ad56a1cb1a824cca" - integrity sha512-BCxgX1BC2hD/oBlIFUgOCQDOPV8nSINxCwM3o93xP4P9Fq6aV5sgv2cOOITDMtCfQ+3PvHp3l689XZvAM9QyOA== +"@babel/helper-function-name@^7.8.3", "@babel/helper-function-name@^7.9.5": + version "7.9.5" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.9.5.tgz#2b53820d35275120e1874a82e5aabe1376920a5c" + integrity sha512-JVcQZeXM59Cd1qanDUxv9fgJpt3NeKUaqBqUEvfmQ+BCOKq2xUgaWZW2hr0dkbyJgezYuplEoh5knmrnS68efw== dependencies: "@babel/helper-get-function-arity" "^7.8.3" "@babel/template" "^7.8.3" - "@babel/types" "^7.8.3" + "@babel/types" "^7.9.5" "@babel/helper-get-function-arity@^7.8.3": version "7.8.3" @@ -207,10 +207,10 @@ dependencies: "@babel/types" "^7.8.3" -"@babel/helper-validator-identifier@^7.9.0": - version "7.9.0" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.0.tgz#ad53562a7fc29b3b9a91bbf7d10397fd146346ed" - integrity sha512-6G8bQKjOh+of4PV/ThDm/rRqlU7+IGoJuofpagU5GlEl29Vv0RGqqt86ZGRV8ZuSOY3o+8yXl5y782SMcG7SHw== +"@babel/helper-validator-identifier@^7.9.0", "@babel/helper-validator-identifier@^7.9.5": + version "7.9.5" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.5.tgz#90977a8e6fbf6b431a7dc31752eee233bf052d80" + integrity sha512-/8arLKUFq882w4tWGj9JYzRpAlZgiWUJ+dtteNTDqrRBz9Iguck9Rn3ykuBDoUwh2TO4tSAJlrxDUOXWklJe4g== "@babel/helper-wrap-function@^7.8.3": version "7.8.3" @@ -286,13 +286,14 @@ "@babel/helper-plugin-utils" "^7.8.3" "@babel/plugin-syntax-numeric-separator" "^7.8.3" -"@babel/plugin-proposal-object-rest-spread@^7.9.0": - version "7.9.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.9.0.tgz#a28993699fc13df165995362693962ba6b061d6f" - integrity sha512-UgqBv6bjq4fDb8uku9f+wcm1J7YxJ5nT7WO/jBr0cl0PLKb7t1O6RNR1kZbjgx2LQtsDI9hwoQVmn0yhXeQyow== +"@babel/plugin-proposal-object-rest-spread@^7.9.5": + version "7.9.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.9.5.tgz#3fd65911306d8746014ec0d0cf78f0e39a149116" + integrity sha512-VP2oXvAf7KCYTthbUHwBlewbl1Iq059f6seJGsxMizaCdgHIeczOr7FBqELhSqfkIl04Fi8okzWzl63UKbQmmg== dependencies: "@babel/helper-plugin-utils" "^7.8.3" "@babel/plugin-syntax-object-rest-spread" "^7.8.0" + "@babel/plugin-transform-parameters" "^7.9.5" "@babel/plugin-proposal-optional-catch-binding@^7.8.3": version "7.8.3" @@ -412,14 +413,14 @@ "@babel/helper-plugin-utils" "^7.8.3" lodash "^4.17.13" -"@babel/plugin-transform-classes@^7.9.0": - version "7.9.2" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.9.2.tgz#8603fc3cc449e31fdbdbc257f67717536a11af8d" - integrity sha512-TC2p3bPzsfvSsqBZo0kJnuelnoK9O3welkUpqSqBQuBF6R5MN2rysopri8kNvtlGIb2jmUO7i15IooAZJjZuMQ== +"@babel/plugin-transform-classes@^7.9.5": + version "7.9.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.9.5.tgz#800597ddb8aefc2c293ed27459c1fcc935a26c2c" + integrity sha512-x2kZoIuLC//O5iA7PEvecB105o7TLzZo8ofBVhP79N+DO3jaX+KYfww9TQcfBEZD0nikNyYcGB1IKtRq36rdmg== dependencies: "@babel/helper-annotate-as-pure" "^7.8.3" "@babel/helper-define-map" "^7.8.3" - "@babel/helper-function-name" "^7.8.3" + "@babel/helper-function-name" "^7.9.5" "@babel/helper-optimise-call-expression" "^7.8.3" "@babel/helper-plugin-utils" "^7.8.3" "@babel/helper-replace-supers" "^7.8.6" @@ -433,10 +434,10 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-destructuring@^7.8.3": - version "7.8.8" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.8.8.tgz#fadb2bc8e90ccaf5658de6f8d4d22ff6272a2f4b" - integrity sha512-eRJu4Vs2rmttFCdhPUM3bV0Yo/xPSdPw6ML9KHs/bjB4bLA5HXlbvYXPOD5yASodGod+krjYx21xm1QmL8dCJQ== +"@babel/plugin-transform-destructuring@^7.9.5": + version "7.9.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.9.5.tgz#72c97cf5f38604aea3abf3b935b0e17b1db76a50" + integrity sha512-j3OEsGel8nHL/iusv/mRd5fYZ3DrOxWC82x0ogmdN/vHfAP4MYw+AFKYanzWlktNwikKvlzUV//afBW5FTp17Q== dependencies: "@babel/helper-plugin-utils" "^7.8.3" @@ -551,10 +552,10 @@ "@babel/helper-plugin-utils" "^7.8.3" "@babel/helper-replace-supers" "^7.8.3" -"@babel/plugin-transform-parameters@^7.8.7": - version "7.9.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.9.3.tgz#3028d0cc20ddc733166c6e9c8534559cee09f54a" - integrity sha512-fzrQFQhp7mIhOzmOtPiKffvCYQSK10NR8t6BBz2yPbeUHb9OLW8RZGtgDRBn8z2hGcwvKDL3vC7ojPTLNxmqEg== +"@babel/plugin-transform-parameters@^7.9.5": + version "7.9.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.9.5.tgz#173b265746f5e15b2afe527eeda65b73623a0795" + integrity sha512-0+1FhHnMfj6lIIhVvS4KGQJeuhe1GI//h5uptK4PvLt+BGBxsoUJbd3/IW002yk//6sZPlFgsG1hY6OHLcy6kA== dependencies: "@babel/helper-get-function-arity" "^7.8.3" "@babel/helper-plugin-utils" "^7.8.3" @@ -625,10 +626,10 @@ "@babel/helper-create-regexp-features-plugin" "^7.8.3" "@babel/helper-plugin-utils" "^7.8.3" -"@babel/preset-env@^7.9.0": - version "7.9.0" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.9.0.tgz#a5fc42480e950ae8f5d9f8f2bbc03f52722df3a8" - integrity sha512-712DeRXT6dyKAM/FMbQTV/FvRCms2hPCx+3weRjZ8iQVQWZejWWk1wwG6ViWMyqb/ouBbGOl5b6aCk0+j1NmsQ== +"@babel/preset-env@^7.9.5": + version "7.9.5" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.9.5.tgz#8ddc76039bc45b774b19e2fc548f6807d8a8919f" + integrity sha512-eWGYeADTlPJH+wq1F0wNfPbVS1w1wtmMJiYk55Td5Yu28AsdR9AsC97sZ0Qq8fHqQuslVSIYSGJMcblr345GfQ== dependencies: "@babel/compat-data" "^7.9.0" "@babel/helper-compilation-targets" "^7.8.7" @@ -639,7 +640,7 @@ "@babel/plugin-proposal-json-strings" "^7.8.3" "@babel/plugin-proposal-nullish-coalescing-operator" "^7.8.3" "@babel/plugin-proposal-numeric-separator" "^7.8.3" - "@babel/plugin-proposal-object-rest-spread" "^7.9.0" + "@babel/plugin-proposal-object-rest-spread" "^7.9.5" "@babel/plugin-proposal-optional-catch-binding" "^7.8.3" "@babel/plugin-proposal-optional-chaining" "^7.9.0" "@babel/plugin-proposal-unicode-property-regex" "^7.8.3" @@ -656,9 +657,9 @@ "@babel/plugin-transform-async-to-generator" "^7.8.3" "@babel/plugin-transform-block-scoped-functions" "^7.8.3" "@babel/plugin-transform-block-scoping" "^7.8.3" - "@babel/plugin-transform-classes" "^7.9.0" + "@babel/plugin-transform-classes" "^7.9.5" "@babel/plugin-transform-computed-properties" "^7.8.3" - "@babel/plugin-transform-destructuring" "^7.8.3" + "@babel/plugin-transform-destructuring" "^7.9.5" "@babel/plugin-transform-dotall-regex" "^7.8.3" "@babel/plugin-transform-duplicate-keys" "^7.8.3" "@babel/plugin-transform-exponentiation-operator" "^7.8.3" @@ -673,7 +674,7 @@ "@babel/plugin-transform-named-capturing-groups-regex" "^7.8.3" "@babel/plugin-transform-new-target" "^7.8.3" "@babel/plugin-transform-object-super" "^7.8.3" - "@babel/plugin-transform-parameters" "^7.8.7" + "@babel/plugin-transform-parameters" "^7.9.5" "@babel/plugin-transform-property-literals" "^7.8.3" "@babel/plugin-transform-regenerator" "^7.8.7" "@babel/plugin-transform-reserved-words" "^7.8.3" @@ -684,7 +685,7 @@ "@babel/plugin-transform-typeof-symbol" "^7.8.4" "@babel/plugin-transform-unicode-regex" "^7.8.3" "@babel/preset-modules" "^0.1.3" - "@babel/types" "^7.9.0" + "@babel/types" "^7.9.5" browserslist "^4.9.1" core-js-compat "^3.6.2" invariant "^2.2.2" @@ -730,26 +731,26 @@ "@babel/types" "^7.8.6" "@babel/traverse@^7.8.3", "@babel/traverse@^7.8.6", "@babel/traverse@^7.9.0": - version "7.9.0" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.9.0.tgz#d3882c2830e513f4fe4cec9fe76ea1cc78747892" - integrity sha512-jAZQj0+kn4WTHO5dUZkZKhbFrqZE7K5LAQ5JysMnmvGij+wOdr+8lWqPeW0BcF4wFwrEXXtdGO7wcV6YPJcf3w== + version "7.9.5" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.9.5.tgz#6e7c56b44e2ac7011a948c21e283ddd9d9db97a2" + integrity sha512-c4gH3jsvSuGUezlP6rzSJ6jf8fYjLj3hsMZRx/nX0h+fmHN0w+ekubRrHPqnMec0meycA2nwCsJ7dC8IPem2FQ== dependencies: "@babel/code-frame" "^7.8.3" - "@babel/generator" "^7.9.0" - "@babel/helper-function-name" "^7.8.3" + "@babel/generator" "^7.9.5" + "@babel/helper-function-name" "^7.9.5" "@babel/helper-split-export-declaration" "^7.8.3" "@babel/parser" "^7.9.0" - "@babel/types" "^7.9.0" + "@babel/types" "^7.9.5" debug "^4.1.0" globals "^11.1.0" lodash "^4.17.13" -"@babel/types@^7.4.4", "@babel/types@^7.8.3", "@babel/types@^7.8.6", "@babel/types@^7.9.0": - version "7.9.0" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.9.0.tgz#00b064c3df83ad32b2dbf5ff07312b15c7f1efb5" - integrity sha512-BS9JKfXkzzJl8RluW4JGknzpiUV7ZrvTayM6yfqLTVBEnFtyowVIOu6rqxRd5cVO6yGoWf4T8u8dgK9oB+GCng== +"@babel/types@^7.4.4", "@babel/types@^7.8.3", "@babel/types@^7.8.6", "@babel/types@^7.9.0", "@babel/types@^7.9.5": + version "7.9.5" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.9.5.tgz#89231f82915a8a566a703b3b20133f73da6b9444" + integrity sha512-XjnvNqenk818r5zMaba+sLQjnbda31UfUURv3ei0qPQw4u+j2jMyJ5b11y8ZHYTRSI3NnInQkkkRT4fLqqPdHg== dependencies: - "@babel/helper-validator-identifier" "^7.9.0" + "@babel/helper-validator-identifier" "^7.9.5" lodash "^4.17.13" to-fast-properties "^2.0.0" @@ -774,6 +775,21 @@ "@nodelib/fs.scandir" "2.1.3" fastq "^1.6.0" +"@stylelint/postcss-css-in-js@^0.37.0": + version "0.37.0" + resolved "https://registry.yarnpkg.com/@stylelint/postcss-css-in-js/-/postcss-css-in-js-0.37.0.tgz#199df63fe8d876d74656c8dec3b17e8474ca866e" + integrity sha512-9svhg0rpUOo4xkvnllUzM0ZQF/Iwxhi6Bf1rzOA06fDa+fjnBUb2mvEV1c9nJb14g1XD/HMSmvklaVyCo96x6A== + dependencies: + "@babel/core" ">=7.9.0" + +"@stylelint/postcss-markdown@^0.36.1": + version "0.36.1" + resolved "https://registry.yarnpkg.com/@stylelint/postcss-markdown/-/postcss-markdown-0.36.1.tgz#829b87e6c0f108014533d9d7b987dc9efb6632e8" + integrity sha512-iDxMBWk9nB2BPi1VFQ+Dc5+XpvODBHw2n3tYpaBZuEAFQlbtF9If0Qh5LTTwSi/XwdbJ2jt+0dis3i8omyggpw== + dependencies: + remark "^12.0.0" + unist-util-find-all-after "^3.0.1" + "@types/color-name@^1.1.1": version "1.1.1" resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0" @@ -784,11 +800,6 @@ resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.0.tgz#69a23a3ad29caf0097f06eda59b361ee2f0639f6" integrity sha1-aaI6OtKcrwCX8G7aWbNh7i8GOfY= -"@types/node@*": - version "13.9.5" - resolved "https://registry.yarnpkg.com/@types/node/-/node-13.9.5.tgz#59738bf30b31aea1faa2df7f4a5f55613750cf00" - integrity sha512-hkzMMD3xu6BrJpGVLeQ3htQQNAcOrJjX7WFmtK8zWQpz2UJf13LCFF2ALA7c9OVdvc2vQJeDdjfR35M0sBCxvw== - "@types/normalize-package-data@^2.4.0": version "2.4.0" resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e" @@ -799,27 +810,11 @@ resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0" integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA== -"@types/unist@*", "@types/unist@^2.0.0", "@types/unist@^2.0.2": +"@types/unist@^2.0.0", "@types/unist@^2.0.2": version "2.0.3" resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.3.tgz#9c088679876f374eb5983f150d4787aa6fb32d7e" integrity sha512-FvUupuM3rlRsRtCN+fDudtmytGO6iHJuuRKS1Ss0pG5z8oX0diNEw94UEL7hgDbpN94rgaK5R7sWm6RrSkZuAQ== -"@types/vfile-message@*": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@types/vfile-message/-/vfile-message-2.0.0.tgz#690e46af0fdfc1f9faae00cd049cc888957927d5" - integrity sha512-GpTIuDpb9u4zIO165fUy9+fXcULdD8HFRNli04GehoMVbeNq7D6OBnqSmg3lxZnC+UvgUhEWKxdKiwYUkGltIw== - dependencies: - vfile-message "*" - -"@types/vfile@^3.0.0": - version "3.0.2" - resolved "https://registry.yarnpkg.com/@types/vfile/-/vfile-3.0.2.tgz#19c18cd232df11ce6fa6ad80259bc86c366b09b9" - integrity sha512-b3nLFGaGkJ9rzOcuXRfHkZMdjsawuDD0ENL9fzTophtBg8FJHSGbH7daXkEpcwy3v7Xol3pAvsmlYyFhR4pqJw== - dependencies: - "@types/node" "*" - "@types/unist" "*" - "@types/vfile-message" "*" - acorn-jsx@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.2.0.tgz#4c66069173d6fdd68ed85239fc256226182b2ebe" @@ -919,13 +914,13 @@ astral-regex@^1.0.0: resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== -autoprefixer@^9.7.4: - version "9.7.5" - resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-9.7.5.tgz#8df10b9ff9b5814a8d411a5cfbab9c793c392376" - integrity sha512-URo6Zvt7VYifomeAfJlMFnYDhow1rk2bufwkbamPEAtQFcL11moLk4PnR7n9vlu7M+BkXAZkHFA0mIcY7tjQFg== +autoprefixer@^9.7.5: + version "9.7.6" + resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-9.7.6.tgz#63ac5bbc0ce7934e6997207d5bb00d68fa8293a4" + integrity sha512-F7cYpbN7uVVhACZTeeIeealwdGM6wMtfWARVLTy5xmKtgVdBNJvbDRoCK3YO1orcs7gv/KwYlb3iXwu9Ug9BkQ== dependencies: - browserslist "^4.11.0" - caniuse-lite "^1.0.30001036" + browserslist "^4.11.1" + caniuse-lite "^1.0.30001039" chalk "^2.4.2" normalize-range "^0.1.2" num2fraction "^1.2.2" @@ -974,15 +969,15 @@ browser-stdout@1.3.1: resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== -browserslist@^4.11.0, browserslist@^4.8.3, browserslist@^4.9.1: - version "4.11.0" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.11.0.tgz#aef4357b10a8abda00f97aac7cd587b2082ba1ad" - integrity sha512-WqEC7Yr5wUH5sg6ruR++v2SGOQYpyUdYYd4tZoAq1F7y+QXoLoYGXVbxhtaIqWmAJjtNTRjVD3HuJc1OXTel2A== +browserslist@^4.11.1, browserslist@^4.8.5, browserslist@^4.9.1: + version "4.11.1" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.11.1.tgz#92f855ee88d6e050e7e7311d987992014f1a1f1b" + integrity sha512-DCTr3kDrKEYNw6Jb9HFxVLQNaue8z+0ZfRBRjmCunKDEXEBajKDj2Y+Uelg+Pi29OnvaSGwjOsnRyNEkXzHg5g== dependencies: - caniuse-lite "^1.0.30001035" - electron-to-chromium "^1.3.380" - node-releases "^1.1.52" - pkg-up "^3.1.0" + caniuse-lite "^1.0.30001038" + electron-to-chromium "^1.3.390" + node-releases "^1.1.53" + pkg-up "^2.0.0" buffer-from@^1.0.0: version "1.1.1" @@ -995,9 +990,9 @@ callsites@^3.0.0: integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== camelcase-keys@^6.1.1: - version "6.2.1" - resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-6.2.1.tgz#cd3e2d2d7db767aa3f247e4c2df93b4661008945" - integrity sha512-BPCNVH56RVIxQQIXskp5tLQXUNGQ6sXr7iCv1FHDt81xBOQ/1r6H8SPxf19InVP6DexWar4s87q9thfuk8X9HA== + version "6.2.2" + resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-6.2.2.tgz#5e755d6ba51aa223ec7d3d52f25778210f9dc3c0" + integrity sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg== dependencies: camelcase "^5.3.1" map-obj "^4.0.0" @@ -1008,10 +1003,10 @@ camelcase@^5.0.0, camelcase@^5.3.1: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== -caniuse-lite@^1.0.30001035, caniuse-lite@^1.0.30001036: - version "1.0.30001038" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001038.tgz#44da3cbca2ab6cb6aa83d1be5d324e17f141caff" - integrity sha512-zii9quPo96XfOiRD4TrfYGs+QsGZpb2cGiMAzPjtf/hpFgB6zCPZgJb7I1+EATeMw/o+lG8FyRAnI+CWStHcaQ== +caniuse-lite@^1.0.30001038, caniuse-lite@^1.0.30001039: + version "1.0.30001040" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001040.tgz#103fc8e6eb1d7397e95134cd0e996743353d58ea" + integrity sha512-Ep0tEPeI5wCvmJNrXjE3etgfI+lkl1fTDU6Y3ZH1mhrjkPlVI9W4pcKbMo+BQLpEWKVYYp2EmYaRsqpPC3k7lQ== ccount@^1.0.0: version "1.0.5" @@ -1027,10 +1022,10 @@ chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.4.1, chalk@^2.4.2: escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chalk@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4" - integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg== +chalk@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.0.0.tgz#6e98081ed2d17faab615eb52ac66ec1fe6209e72" + integrity sha512-N9oWFcegS0sFr9oh1oz2d7Npos6vNoWW9HvtCg5N1KRFpUhaAhvTv5Y58g880fZaEYSNm3qDz8SU1UrGvp+n7A== dependencies: ansi-styles "^4.1.0" supports-color "^7.1.0" @@ -1155,11 +1150,11 @@ convert-source-map@^1.7.0: safe-buffer "~5.1.1" core-js-compat@^3.6.2: - version "3.6.4" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.6.4.tgz#938476569ebb6cda80d339bcf199fae4f16fff17" - integrity sha512-zAa3IZPvsJ0slViBQ2z+vgyyTuhd3MFn1rBQjZSKVEgB0UMYhUkCj9jJUVPgGTGqWvsBVmfnruXgTcNyTlEiSA== + version "3.6.5" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.6.5.tgz#2a51d9a4e25dfd6e690251aa81f99e3c05481f1c" + integrity sha512-7ItTKOhOZbznhXAQ2g/slGg1PJV5zDO/WdkTwi7UEOJmkvsE32PWvx6mKtDjiMpjnR2CNf6BAD6sSxIlv7ptng== dependencies: - browserslist "^4.8.3" + browserslist "^4.8.5" semver "7.0.0" cosmiconfig@^6.0.0: @@ -1319,10 +1314,10 @@ domutils@^1.5.1: dom-serializer "0" domelementtype "1" -electron-to-chromium@^1.3.380: - version "1.3.388" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.388.tgz#d3be2b7afc42c64c81f204755975b78547775301" - integrity sha512-/FNHDmNmI4IR/qY+uuAVq8OET5S9J7d5QfQUnAz0edkhl02BjtOflF2H0RXKapVtJfMgaFthKBzeYJAzOaW8PA== +electron-to-chromium@^1.3.390: + version "1.3.402" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.402.tgz#9ad93c0c8ea2e571431739e0d76bd6bc9788a846" + integrity sha512-gaCDfX7IUH0s3JmBiHCDPrvVcdnTTP1r4WLJc2dHkYYbLmXZ2XHiJCcGQ9Balf91aKTvuCKCyu2JjJYRykoI1w== emoji-regex@^7.0.1: version "7.0.3" @@ -1351,7 +1346,7 @@ error-ex@^1.2.0, error-ex@^1.3.1: dependencies: is-arrayish "^0.2.1" -es-abstract@^1.17.0, es-abstract@^1.17.0-next.1: +es-abstract@^1.17.0, es-abstract@^1.17.0-next.1, es-abstract@^1.17.5: version "1.17.5" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.5.tgz#d8c9d1d66c8981fb9200e2251d799eee92774ae9" integrity sha512-BR9auzDbySxOcfog0tLECW8l28eRGpDpU3Dm3Hp4q/N+VtLTmyj4EUN088XZWQDW/hzj6sYRDXeOFsaAODKvpg== @@ -1406,9 +1401,9 @@ eslint-import-resolver-node@^0.3.2: resolve "^1.13.1" eslint-module-utils@^2.4.0: - version "2.5.2" - resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.5.2.tgz#7878f7504824e1b857dd2505b59a8e5eda26a708" - integrity sha512-LGScZ/JSlqGKiT8OC+cYRxseMjyqt6QO54nl281CK93unD89ijSeRV6An8Ci/2nvWVKe8K/Tqdm75RQoIOCr+Q== + version "2.6.0" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.6.0.tgz#579ebd094f56af7797d19c9866c9c9486629bfa6" + integrity sha512-6j9xxegbqe8/kZY8cYpcp0xhbK0EgJlg3g9mib3/miLaExuuwc3n5UEfSnU6hWMbT0FAYVvDbL9RrRgpUeQIvA== dependencies: debug "^2.6.9" pkg-dir "^2.0.0" @@ -1630,9 +1625,9 @@ fast-levenshtein@~2.0.6: integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= fastq@^1.6.0: - version "1.6.1" - resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.6.1.tgz#4570c74f2ded173e71cf0beb08ac70bb85826791" - integrity sha512-mpIH5sKYueh3YyeJwqtVo8sORi0CgtmkVbK6kZStpQlZBYQuTzG2CZ7idSiJuA7bY0SFCWUc5WIs+oYumGCQNw== + version "1.7.0" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.7.0.tgz#fcd79a08c5bd7ec5b55cd3f5c4720db551929801" + integrity sha512-YOadQRnHd5q6PogvAR/x62BGituF2ufiEA6s8aavQANw5YKHERI4AREboX6KotzP8oX2klxYF2wcV/7bn1clfQ== dependencies: reusify "^1.0.4" @@ -1710,9 +1705,9 @@ flat@^4.1.0: is-buffer "~2.0.3" flatted@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08" - integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg== + version "2.0.2" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138" + integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA== fs.realpath@^1.0.0: version "1.0.0" @@ -1818,12 +1813,12 @@ globjoin@^0.1.4: resolved "https://registry.yarnpkg.com/globjoin/-/globjoin-0.1.4.tgz#2f4494ac8919e3767c5cbb691e9f463324285d43" integrity sha1-L0SUrIkZ43Z8XLtpHp9GMyQoXUM= -gonzales-pe@^4.2.4: - version "4.2.4" - resolved "https://registry.yarnpkg.com/gonzales-pe/-/gonzales-pe-4.2.4.tgz#356ae36a312c46fe0f1026dd6cb539039f8500d2" - integrity sha512-v0Ts/8IsSbh9n1OJRnSfa7Nlxi4AkXIsWB6vPept8FDbL4bXn3FNuxjYtO/nmBGu7GDkL9MFeGebeSu6l55EPQ== +gonzales-pe@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/gonzales-pe/-/gonzales-pe-4.3.0.tgz#fe9dec5f3c557eead09ff868c65826be54d067b3" + integrity sha512-otgSPpUmdWJ43VXyiNgEYE4luzHCL2pz4wQ0OnDluC6Eg4Ko3Vexy/SrSynglw/eR+OhkzmqFCZa/OFa/RgAOQ== dependencies: - minimist "1.1.x" + minimist "^1.2.5" graceful-fs@^4.1.15, graceful-fs@^4.1.2: version "4.2.3" @@ -2023,7 +2018,7 @@ is-date-object@^1.0.1: resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.2.tgz#bda736f2cd8fd06d32844e7743bfa7494c3bfd7e" integrity sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g== -is-decimal@^1.0.0: +is-decimal@^1.0.0, is-decimal@^1.0.2: version "1.0.4" resolved "https://registry.yarnpkg.com/is-decimal/-/is-decimal-1.0.4.tgz#65a3a5958a1c5b63a706e1b333d7cd9f630d3fa5" integrity sha512-RGdriMmQQvZ2aqaQq3awNA6dCGtKpiDFcOzrTWrDAT2MiWrKQVPmxLGHl7Y2nNu6led0kEyoX0enY0qXYsv9zw== @@ -2065,6 +2060,11 @@ is-plain-obj@^1.1.0: resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" integrity sha1-caUMhCnfync8kqOQpKA7OfzVHT4= +is-plain-obj@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" + integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== + is-promise@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" @@ -2158,9 +2158,9 @@ json-stable-stringify-without-jsonify@^1.0.1: integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= json5@^2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.2.tgz#43ef1f0af9835dd624751a6b7fa48874fb2d608e" - integrity sha512-MoUOQ4WdiN3yxhm7NEVJSJrieAo5hNSLQ5sj05OTRHPL9HOBy8u4Bu88jsC1jvqAdN+E1bJmsUcZH+1HQxliqQ== + version "2.1.3" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.3.tgz#c9b0f7fa9233bfe5807fe66fcf3a5617ed597d43" + integrity sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA== dependencies: minimist "^1.2.5" @@ -2305,24 +2305,26 @@ markdown-escapes@^1.0.0: resolved "https://registry.yarnpkg.com/markdown-escapes/-/markdown-escapes-1.0.4.tgz#c95415ef451499d7602b91095f3c8e8975f78535" integrity sha512-8z4efJYk43E0upd0NbVXwgSTQs6cT3T06etieCMEg7dRbzCbxUCK/GHlX8mhHRDcp+OLlHkPKsvqQTCvsRl2cg== -markdown-table@^1.1.0: - version "1.1.3" - resolved "https://registry.yarnpkg.com/markdown-table/-/markdown-table-1.1.3.tgz#9fcb69bcfdb8717bfd0398c6ec2d93036ef8de60" - integrity sha512-1RUZVgQlpJSPWYbFSpmudq5nHY1doEIv89gBtF0s4gW1GF2XorxcA/70M5vq7rLv0a6mhOUccRsqkwhwLCIQ2Q== +markdown-table@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/markdown-table/-/markdown-table-2.0.0.tgz#194a90ced26d31fe753d8b9434430214c011865b" + integrity sha512-Ezda85ToJUBhM6WGaG6veasyym+Tbs3cMAw/ZhOPqXiYsr0jgocBV3j3nx+4lk47plLlIqjwuTm/ywVI+zjJ/A== + dependencies: + repeat-string "^1.0.0" mathml-tag-names@^2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/mathml-tag-names/-/mathml-tag-names-2.1.3.tgz#4ddadd67308e780cf16a47685878ee27b736a0a3" integrity sha512-APMBEanjybaPzUrfqU0IMU5I0AswKMH7k8OTLs0vvV4KZpExkTkY87nR/zpbuTPj+gARop7aGUbl11pnDfW6xg== -mdast-util-compact@^1.0.0: - version "1.0.4" - resolved "https://registry.yarnpkg.com/mdast-util-compact/-/mdast-util-compact-1.0.4.tgz#d531bb7667b5123abf20859be086c4d06c894593" - integrity sha512-3YDMQHI5vRiS2uygEFYaqckibpJtKq5Sj2c8JioeOQBU6INpKbdWzfyLqFFnDwEcEnRFIdMsguzs5pC1Jp4Isg== +mdast-util-compact@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/mdast-util-compact/-/mdast-util-compact-2.0.1.tgz#cabc69a2f43103628326f35b1acf735d55c99490" + integrity sha512-7GlnT24gEwDrdAwEHrU4Vv5lLWrEer4KOkAiKT9nYstsTad7Oc1TwqT2zIMKRdZF7cTuaf+GA1E4Kv7jJh8mPA== dependencies: - unist-util-visit "^1.1.0" + unist-util-visit "^2.0.0" -meow@^6.0.1: +meow@^6.1.0: version "6.1.0" resolved "https://registry.yarnpkg.com/meow/-/meow-6.1.0.tgz#4ff4641818d3502afcddc631f94cb6971a581cb3" integrity sha512-iIAoeI01v6pmSfObAAWFoITAA4GgiT45m4SmJgoxtZfvI0fyZwhV4d0lTwiUXvAKIPlma05Feb2Xngl52Mj5Cg== @@ -2377,11 +2379,6 @@ minimist-options@^4.0.1: arrify "^1.0.1" is-plain-obj "^1.1.0" -minimist@1.1.x: - version "1.1.3" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.1.3.tgz#3bedfd91a92d39016fcfaa1c681e8faa1a1efda8" - integrity sha1-O+39kaktOQFvz6ocaB6Pqhoe/ag= - minimist@^1.1.0, minimist@^1.2.5: version "1.2.5" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" @@ -2395,9 +2392,9 @@ mkdirp@0.5.3: minimist "^1.2.5" mkdirp@^0.5.1: - version "0.5.4" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.4.tgz#fd01504a6797ec5c9be81ff43d204961ed64a512" - integrity sha512-iG9AK/dJLtJ0XNgTuDbSyNS3zECqDlAhnQW4CsNxBG3LQJBbHmRX1egw39DmtOdCAqY+dKXV+sgPgilNWUKMVw== + version "0.5.5" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" + integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== dependencies: minimist "^1.2.5" @@ -2474,12 +2471,10 @@ node-modules-regexp@^1.0.0: resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40" integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA= -node-releases@^1.1.52: - version "1.1.52" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.52.tgz#bcffee3e0a758e92e44ecfaecd0a47554b0bcba9" - integrity sha512-snSiT1UypkgGt2wxPqS6ImEUICbNCMb31yaxWrOLXjhlt2z2/IBpaOxzONExqSm4y5oLnAqjjRWu+wsDzK5yNQ== - dependencies: - semver "^6.3.0" +node-releases@^1.1.53: + version "1.1.53" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.53.tgz#2d821bfa499ed7c5dffc5e2f28c88e78a08ee3f4" + integrity sha512-wp8zyQVwef2hpZ/dJH7SfSrIPD6YoJz6BDQDpGEkcA0s3LpAQoxBIYmfIq6QAhC1DhwsyCgTaTTcONwX8qzCuQ== normalize-package-data@^2.3.2, normalize-package-data@^2.5.0: version "2.5.0" @@ -2613,9 +2608,9 @@ p-limit@^1.1.0: p-try "^1.0.0" p-limit@^2.0.0, p-limit@^2.2.0: - version "2.2.2" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.2.tgz#61279b67721f5287aa1c13a9a7fbbc48c9291b1e" - integrity sha512-WGR+xHecKTr7EbUEhyLSh5Dube9JtdiG78ufaeLxTgpudf/20KqyMioIUZJAezlTIi6evxuoUs9YXc11cU+yzQ== + version "2.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" + integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== dependencies: p-try "^2.0.0" @@ -2657,10 +2652,10 @@ parent-module@^1.0.0: dependencies: callsites "^3.0.0" -parse-entities@^1.0.2, parse-entities@^1.1.0: - version "1.2.2" - resolved "https://registry.yarnpkg.com/parse-entities/-/parse-entities-1.2.2.tgz#c31bf0f653b6661354f8973559cb86dd1d5edf50" - integrity sha512-NzfpbxW/NPrzZ/yYSoQxyqUZMZXIdCfE0OIN4ESsnptHJECoUk3FZktxNuzQf4tjt5UEopnxpYJbvYuxIFDdsg== +parse-entities@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/parse-entities/-/parse-entities-2.0.0.tgz#53c6eb5b9314a1f4ec99fa0fdf7ce01ecda0cbe8" + integrity sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ== dependencies: character-entities "^1.0.0" character-entities-legacy "^1.0.0" @@ -2784,12 +2779,12 @@ pkg-dir@^3.0.0: dependencies: find-up "^3.0.0" -pkg-up@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/pkg-up/-/pkg-up-3.1.0.tgz#100ec235cc150e4fd42519412596a28512a0def5" - integrity sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA== +pkg-up@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/pkg-up/-/pkg-up-2.0.0.tgz#c819ac728059a461cab1c3889a2be3c49a004d7f" + integrity sha1-yBmscoBZpGHKscOImivjxJoATX8= dependencies: - find-up "^3.0.0" + find-up "^2.1.0" postcss-html@^0.36.0: version "0.36.0" @@ -2798,13 +2793,6 @@ postcss-html@^0.36.0: dependencies: htmlparser2 "^3.10.0" -postcss-jsx@^0.36.4: - version "0.36.4" - resolved "https://registry.yarnpkg.com/postcss-jsx/-/postcss-jsx-0.36.4.tgz#37a68f300a39e5748d547f19a747b3257240bd50" - integrity sha512-jwO/7qWUvYuWYnpOb0+4bIIgJt7003pgU3P6nETBLaOyBXuTD55ho21xnals5nBrlpTIFodyd3/jBi6UO3dHvA== - dependencies: - "@babel/core" ">=7.2.2" - postcss-less@^3.1.4: version "3.1.4" resolved "https://registry.yarnpkg.com/postcss-less/-/postcss-less-3.1.4.tgz#369f58642b5928ef898ffbc1a6e93c958304c5ad" @@ -2812,14 +2800,6 @@ postcss-less@^3.1.4: dependencies: postcss "^7.0.14" -postcss-markdown@^0.36.0: - version "0.36.0" - resolved "https://registry.yarnpkg.com/postcss-markdown/-/postcss-markdown-0.36.0.tgz#7f22849ae0e3db18820b7b0d5e7833f13a447560" - integrity sha512-rl7fs1r/LNSB2bWRhyZ+lM/0bwKv9fhl38/06gF6mKMo/NPnp55+K1dSTosSVjFZc0e1ppBlu+WT91ba0PMBfQ== - dependencies: - remark "^10.0.1" - unist-util-find-all-after "^1.0.2" - postcss-media-query-parser@^0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/postcss-media-query-parser/-/postcss-media-query-parser-0.2.3.tgz#27b39c6f4d94f81b1a73b8f76351c609e5cef244" @@ -2840,19 +2820,19 @@ postcss-resolve-nested-selector@^0.1.1: resolved "https://registry.yarnpkg.com/postcss-resolve-nested-selector/-/postcss-resolve-nested-selector-0.1.1.tgz#29ccbc7c37dedfac304e9fff0bf1596b3f6a0e4e" integrity sha1-Kcy8fDfe36wwTp//C/FZaz9qDk4= -postcss-safe-parser@^4.0.1: +postcss-safe-parser@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/postcss-safe-parser/-/postcss-safe-parser-4.0.2.tgz#a6d4e48f0f37d9f7c11b2a581bf00f8ba4870b96" integrity sha512-Uw6ekxSWNLCPesSv/cmqf2bY/77z11O7jZGPax3ycZMFU/oi2DMH9i89AdHc1tRwFg/arFoEwX0IS3LCUxJh1g== dependencies: postcss "^7.0.26" -postcss-sass@^0.4.2: - version "0.4.2" - resolved "https://registry.yarnpkg.com/postcss-sass/-/postcss-sass-0.4.2.tgz#7d1f8ddf6960d329de28fb3ff43c9c42013646bc" - integrity sha512-hcRgnd91OQ6Ot9R90PE/khUDCJHG8Uxxd3F7Y0+9VHjBiJgNv7sK5FxyHMCBtoLmmkzVbSj3M3OlqUfLJpq0CQ== +postcss-sass@^0.4.4: + version "0.4.4" + resolved "https://registry.yarnpkg.com/postcss-sass/-/postcss-sass-0.4.4.tgz#91f0f3447b45ce373227a98b61f8d8f0785285a3" + integrity sha512-BYxnVYx4mQooOhr+zer0qWbSPYnarAy8ZT7hAQtbxtgVf8gy+LSLT/hHGe35h14/pZDTw1DsxdbrwxBN++H+fg== dependencies: - gonzales-pe "^4.2.4" + gonzales-pe "^4.3.0" postcss "^7.0.21" postcss-scss@^2.0.0: @@ -3020,9 +3000,9 @@ regexpp@^2.0.1: integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw== regexpp@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.0.0.tgz#dd63982ee3300e67b41c1956f850aa680d9d330e" - integrity sha512-Z+hNr7RAVWxznLPuA7DIh8UNX1j9CDrUQxskw9IrBE1Dxue2lyXT+shqEIeLUjrokxIP8CMy1WkjgG3rTsd5/g== + version "3.1.0" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.1.0.tgz#206d0ad0a5648cffbdb8ae46438f3dc51c9f78e2" + integrity sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q== regexpu-core@^4.7.0: version "4.7.0" @@ -3048,31 +3028,32 @@ regjsparser@^0.6.4: dependencies: jsesc "~0.5.0" -remark-parse@^6.0.0: - version "6.0.3" - resolved "https://registry.yarnpkg.com/remark-parse/-/remark-parse-6.0.3.tgz#c99131052809da482108413f87b0ee7f52180a3a" - integrity sha512-QbDXWN4HfKTUC0hHa4teU463KclLAnwpn/FBn87j9cKYJWWawbiLgMfP2Q4XwhxxuuuOxHlw+pSN0OKuJwyVvg== +remark-parse@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/remark-parse/-/remark-parse-8.0.0.tgz#0aaae4b49e607ee7e972a6cf688026f46bbf6d1a" + integrity sha512-Ck14G1Ns/GEPXhSw6m1Uv28kMtVk63e59NyL+QlhBBwBdIUXROM6MPfBehPhW6TW2d73batMdZsKwuxl5i3tEA== dependencies: + ccount "^1.0.0" collapse-white-space "^1.0.2" is-alphabetical "^1.0.0" is-decimal "^1.0.0" is-whitespace-character "^1.0.0" is-word-character "^1.0.0" markdown-escapes "^1.0.0" - parse-entities "^1.1.0" + parse-entities "^2.0.0" repeat-string "^1.5.4" state-toggle "^1.0.0" trim "0.0.1" trim-trailing-lines "^1.0.0" unherit "^1.0.4" - unist-util-remove-position "^1.0.0" - vfile-location "^2.0.0" + unist-util-remove-position "^2.0.0" + vfile-location "^3.0.0" xtend "^4.0.1" -remark-stringify@^6.0.0: - version "6.0.4" - resolved "https://registry.yarnpkg.com/remark-stringify/-/remark-stringify-6.0.4.tgz#16ac229d4d1593249018663c7bddf28aafc4e088" - integrity sha512-eRWGdEPMVudijE/psbIDNcnJLRVx3xhfuEsTDGgH4GsFF91dVhw5nhmnBppafJ7+NWINW6C7ZwWbi30ImJzqWg== +remark-stringify@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/remark-stringify/-/remark-stringify-8.0.0.tgz#33423ab8bf3076fb197f4cf582aaaf866b531625" + integrity sha512-cABVYVloFH+2ZI5bdqzoOmemcz/ZuhQSH6W6ZNYnLojAUUn3xtX7u+6BpnYp35qHoGr2NFBsERV14t4vCIeW8w== dependencies: ccount "^1.0.0" is-alphanumeric "^1.0.0" @@ -3080,25 +3061,25 @@ remark-stringify@^6.0.0: is-whitespace-character "^1.0.0" longest-streak "^2.0.1" markdown-escapes "^1.0.0" - markdown-table "^1.1.0" - mdast-util-compact "^1.0.0" - parse-entities "^1.0.2" + markdown-table "^2.0.0" + mdast-util-compact "^2.0.0" + parse-entities "^2.0.0" repeat-string "^1.5.4" state-toggle "^1.0.0" - stringify-entities "^1.0.1" + stringify-entities "^3.0.0" unherit "^1.0.4" xtend "^4.0.1" -remark@^10.0.1: - version "10.0.1" - resolved "https://registry.yarnpkg.com/remark/-/remark-10.0.1.tgz#3058076dc41781bf505d8978c291485fe47667df" - integrity sha512-E6lMuoLIy2TyiokHprMjcWNJ5UxfGQjaMSMhV+f4idM625UjjK4j798+gPs5mfjzDE6vL0oFKVeZM6gZVSVrzQ== +remark@^12.0.0: + version "12.0.0" + resolved "https://registry.yarnpkg.com/remark/-/remark-12.0.0.tgz#d1c145c07341c9232f93b2f8539d56da15a2548c" + integrity sha512-oX4lMIS0csgk8AEbzY0h2jdR0ngiCHOpwwpxjmRa5TqAkeknY+tkhjRJGZqnCmvyuWh55/0SW5WY3R3nn3PH9A== dependencies: - remark-parse "^6.0.0" - remark-stringify "^6.0.0" - unified "^7.0.0" + remark-parse "^8.0.0" + remark-stringify "^8.0.0" + unified "^9.0.0" -repeat-string@^1.5.4: +repeat-string@^1.0.0, repeat-string@^1.5.4: version "1.6.1" resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= @@ -3168,9 +3149,9 @@ run-parallel@^1.1.2, run-parallel@^1.1.9: integrity sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q== rxjs@^6.4.0: - version "6.5.4" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.4.tgz#e0777fe0d184cec7872df147f303572d414e211c" - integrity sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q== + version "6.5.5" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.5.tgz#c5c884e3094c8cfee31bf27eb87e54ccfc87f9ec" + integrity sha512-WfQI+1gohdf0Dai/Bbmk5L5ItH5tYqm3ki2c5GdWhKjalzjg93N3avFjVStyZZz+A2Em+ZxKH5bNghw9UeylGQ== dependencies: tslib "^1.9.0" @@ -3215,7 +3196,7 @@ semver@7.0.0: resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e" integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A== -semver@^6.1.0, semver@^6.1.2, semver@^6.3.0: +semver@^6.1.0, semver@^6.1.2: version "6.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== @@ -3356,21 +3337,39 @@ string-width@^4.2.0: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.0" +string.prototype.trimend@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz#85812a6b847ac002270f5808146064c995fb6913" + integrity sha512-LRPxFUaTtpqYsTeNKaFOw3R4bxIzWOnbQ837QfBylo8jIxtcbK/A/sMV7Q+OAV/vWo+7s25pOE10KYSjaSO06g== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.5" + string.prototype.trimleft@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/string.prototype.trimleft/-/string.prototype.trimleft-2.1.1.tgz#9bdb8ac6abd6d602b17a4ed321870d2f8dcefc74" - integrity sha512-iu2AGd3PuP5Rp7x2kEZCrB2Nf41ehzh+goo8TV7z8/XDBbsvc6HQIlUl9RjkZ4oyrW1XM5UwlGl1oVEaDjg6Ag== + version "2.1.2" + resolved "https://registry.yarnpkg.com/string.prototype.trimleft/-/string.prototype.trimleft-2.1.2.tgz#4408aa2e5d6ddd0c9a80739b087fbc067c03b3cc" + integrity sha512-gCA0tza1JBvqr3bfAIFJGqfdRTyPae82+KTnm3coDXkZN9wnuW3HjGgN386D7hfv5CHQYCI022/rJPVlqXyHSw== dependencies: define-properties "^1.1.3" - function-bind "^1.1.1" + es-abstract "^1.17.5" + string.prototype.trimstart "^1.0.0" string.prototype.trimright@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/string.prototype.trimright/-/string.prototype.trimright-2.1.1.tgz#440314b15996c866ce8a0341894d45186200c5d9" - integrity sha512-qFvWL3/+QIgZXVmJBfpHmxLB7xsUXz6HsUmP8+5dRaC3Q7oKUv9Vo6aMCRZC1smrtyECFsIT30PqBJ1gTjAs+g== + version "2.1.2" + resolved "https://registry.yarnpkg.com/string.prototype.trimright/-/string.prototype.trimright-2.1.2.tgz#c76f1cef30f21bbad8afeb8db1511496cfb0f2a3" + integrity sha512-ZNRQ7sY3KroTaYjRS6EbNiiHrOkjihL9aQE/8gfQ4DtAC/aEBRHFJa44OmoWxGGqXuJlfKkZW4WcXErGr+9ZFg== dependencies: define-properties "^1.1.3" - function-bind "^1.1.1" + es-abstract "^1.17.5" + string.prototype.trimend "^1.0.0" + +string.prototype.trimstart@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz#14af6d9f34b053f7cfc89b72f8f2ee14b9039a54" + integrity sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.5" string_decoder@^1.1.1: version "1.3.0" @@ -3379,14 +3378,15 @@ string_decoder@^1.1.1: dependencies: safe-buffer "~5.2.0" -stringify-entities@^1.0.1: - version "1.3.2" - resolved "https://registry.yarnpkg.com/stringify-entities/-/stringify-entities-1.3.2.tgz#a98417e5471fd227b3e45d3db1861c11caf668f7" - integrity sha512-nrBAQClJAPN2p+uGCVJRPIPakKeKWZ9GtBCmormE7pWOSlHat7+x5A8gx85M7HM5Dt0BP3pP5RhVW77WdbJJ3A== +stringify-entities@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/stringify-entities/-/stringify-entities-3.0.0.tgz#455abe501f8b7859ba5726a25a8872333c65b0a7" + integrity sha512-h7NJJIssprqlyjHT2eQt2W1F+MCcNmwPGlKb0bWEdET/3N44QN3QbUF/ueKCgAssyKRZ3Br9rQ7FcXjHr0qLHw== dependencies: character-entities-html4 "^1.0.0" character-entities-legacy "^1.0.0" is-alphanumerical "^1.0.0" + is-decimal "^1.0.2" is-hexadecimal "^1.0.0" strip-ansi@^4.0.0: @@ -3428,23 +3428,25 @@ strip-json-comments@2.0.1: integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= strip-json-comments@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.0.1.tgz#85713975a91fb87bf1b305cca77395e40d2a64a7" - integrity sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw== + version "3.1.0" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.0.tgz#7638d31422129ecf4457440009fba03f9f9ac180" + integrity sha512-e6/d0eBu7gHtdCqFt0xJr642LdToM5/cN4Qb9DbHjVx1CP5RyeM+zH7pbecEmDv/lBqb0QH+6Uqq75rxFPkM0w== style-search@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/style-search/-/style-search-0.1.0.tgz#7958c793e47e32e07d2b5cafe5c0bf8e12e77902" integrity sha1-eVjHk+R+MuB9K1yv5cC/jhLneQI= -stylelint@^13.2.1: - version "13.2.1" - resolved "https://registry.yarnpkg.com/stylelint/-/stylelint-13.2.1.tgz#9101fcd70791856530049816ff53d980ecd561df" - integrity sha512-461ZV4KpUe7pEHHgMOsH4kkjF7qsjkCIMJYOf7QQC4cvgPUJ0z4Nj+ah5fvKl1rzqBqc5EZa6P0nna4CGoJX+A== +stylelint@^13.3.1: + version "13.3.1" + resolved "https://registry.yarnpkg.com/stylelint/-/stylelint-13.3.1.tgz#815917e88d7528b24e6d0e6a9b3afb76b50efc26" + integrity sha512-jeeGwU7y/0l2YTL042U2U0W04J9JIO6bRpTM4S8npSzaO5GzBz4VFlVlMucFzZXkSylxppEx9R6p+DiDLJcrWw== dependencies: - autoprefixer "^9.7.4" + "@stylelint/postcss-css-in-js" "^0.37.0" + "@stylelint/postcss-markdown" "^0.36.1" + autoprefixer "^9.7.5" balanced-match "^1.0.0" - chalk "^3.0.0" + chalk "^4.0.0" cosmiconfig "^6.0.0" debug "^4.1.1" execall "^2.0.0" @@ -3462,19 +3464,17 @@ stylelint@^13.2.1: lodash "^4.17.15" log-symbols "^3.0.0" mathml-tag-names "^2.1.3" - meow "^6.0.1" + meow "^6.1.0" micromatch "^4.0.2" normalize-selector "^0.2.0" postcss "^7.0.27" postcss-html "^0.36.0" - postcss-jsx "^0.36.4" postcss-less "^3.1.4" - postcss-markdown "^0.36.0" postcss-media-query-parser "^0.2.3" postcss-reporter "^6.0.1" postcss-resolve-nested-selector "^0.1.1" - postcss-safe-parser "^4.0.1" - postcss-sass "^0.4.2" + postcss-safe-parser "^4.0.2" + postcss-sass "^0.4.4" postcss-scss "^2.0.0" postcss-selector-parser "^6.0.2" postcss-syntax "^0.36.2" @@ -3655,48 +3655,41 @@ unicode-property-aliases-ecmascript@^1.0.4: resolved "https://registry.yarnpkg.com/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.1.0.tgz#dd57a99f6207bedff4628abefb94c50db941c8f4" integrity sha512-PqSoPh/pWetQ2phoj5RLiaqIk4kCNwoV3CI+LfGmWLKI3rE3kl1h59XpX2BjgDrmbxD9ARtQobPGU1SguCYuQg== -unified@^7.0.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/unified/-/unified-7.1.0.tgz#5032f1c1ee3364bd09da12e27fdd4a7553c7be13" - integrity sha512-lbk82UOIGuCEsZhPj8rNAkXSDXd6p0QLzIuSsCdxrqnqU56St4eyOB+AlXsVgVeRmetPTYydIuvFfpDIed8mqw== +unified@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/unified/-/unified-9.0.0.tgz#12b099f97ee8b36792dbad13d278ee2f696eed1d" + integrity sha512-ssFo33gljU3PdlWLjNp15Inqb77d6JnJSfyplGJPT/a+fNRNyCBeveBAYJdO5khKdF6WVHa/yYCC7Xl6BDwZUQ== dependencies: - "@types/unist" "^2.0.0" - "@types/vfile" "^3.0.0" bail "^1.0.0" extend "^3.0.0" - is-plain-obj "^1.1.0" + is-buffer "^2.0.0" + is-plain-obj "^2.0.0" trough "^1.0.0" - vfile "^3.0.0" - x-is-string "^0.1.0" + vfile "^4.0.0" uniq@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/uniq/-/uniq-1.0.1.tgz#b31c5ae8254844a3a8281541ce2b04b865a734ff" integrity sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8= -unist-util-find-all-after@^1.0.2: - version "1.0.5" - resolved "https://registry.yarnpkg.com/unist-util-find-all-after/-/unist-util-find-all-after-1.0.5.tgz#5751a8608834f41d117ad9c577770c5f2f1b2899" - integrity sha512-lWgIc3rrTMTlK1Y0hEuL+k+ApzFk78h+lsaa2gHf63Gp5Ww+mt11huDniuaoq1H+XMK2lIIjjPkncxXcDp3QDw== +unist-util-find-all-after@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/unist-util-find-all-after/-/unist-util-find-all-after-3.0.1.tgz#95cc62f48812d879b4685a0512bf1b838da50e9a" + integrity sha512-0GICgc++sRJesLwEYDjFVJPJttBpVQaTNgc6Jw0Jhzvfs+jtKePEMu+uD+PqkRUrAvGQqwhpDwLGWo1PK8PDEw== dependencies: - unist-util-is "^3.0.0" + unist-util-is "^4.0.0" -unist-util-is@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/unist-util-is/-/unist-util-is-3.0.0.tgz#d9e84381c2468e82629e4a5be9d7d05a2dd324cd" - integrity sha512-sVZZX3+kspVNmLWBPAB6r+7D9ZgAFPNWm66f7YNb420RlQSbn+n8rG8dGZSkrER7ZIXGQYNm5pqC3v3HopH24A== +unist-util-is@^4.0.0: + version "4.0.2" + resolved "https://registry.yarnpkg.com/unist-util-is/-/unist-util-is-4.0.2.tgz#c7d1341188aa9ce5b3cff538958de9895f14a5de" + integrity sha512-Ofx8uf6haexJwI1gxWMGg6I/dLnF2yE+KibhD3/diOqY2TinLcqHXCV6OI5gFVn3xQqDH+u0M625pfKwIwgBKQ== -unist-util-remove-position@^1.0.0: - version "1.1.4" - resolved "https://registry.yarnpkg.com/unist-util-remove-position/-/unist-util-remove-position-1.1.4.tgz#ec037348b6102c897703eee6d0294ca4755a2020" - integrity sha512-tLqd653ArxJIPnKII6LMZwH+mb5q+n/GtXQZo6S6csPRs5zB0u79Yw8ouR3wTw8wxvdJFhpP6Y7jorWdCgLO0A== +unist-util-remove-position@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/unist-util-remove-position/-/unist-util-remove-position-2.0.1.tgz#5d19ca79fdba712301999b2b73553ca8f3b352cc" + integrity sha512-fDZsLYIe2uT+oGFnuZmy73K6ZxOPG/Qcm+w7jbEjaFcJgbQ6cqjs/eSPzXhsmGpAsWPkqZM9pYjww5QTn3LHMA== dependencies: - unist-util-visit "^1.1.0" - -unist-util-stringify-position@^1.0.0, unist-util-stringify-position@^1.1.1: - version "1.1.2" - resolved "https://registry.yarnpkg.com/unist-util-stringify-position/-/unist-util-stringify-position-1.1.2.tgz#3f37fcf351279dcbca7480ab5889bb8a832ee1c6" - integrity sha512-pNCVrk64LZv1kElr0N1wPiHEUoXNVFERp+mlTg/s9R5Lwg87f9bM/3sQB99w+N9D/qnM9ar3+AKDBwo/gm/iQQ== + unist-util-visit "^2.0.0" unist-util-stringify-position@^2.0.0: version "2.0.3" @@ -3705,19 +3698,22 @@ unist-util-stringify-position@^2.0.0: dependencies: "@types/unist" "^2.0.2" -unist-util-visit-parents@^2.0.0: - version "2.1.2" - resolved "https://registry.yarnpkg.com/unist-util-visit-parents/-/unist-util-visit-parents-2.1.2.tgz#25e43e55312166f3348cae6743588781d112c1e9" - integrity sha512-DyN5vD4NE3aSeB+PXYNKxzGsfocxp6asDc2XXE3b0ekO2BaRUpBicbbUygfSvYfUz1IkmjFR1YF7dPklraMZ2g== +unist-util-visit-parents@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/unist-util-visit-parents/-/unist-util-visit-parents-3.0.2.tgz#d4076af3011739c71d2ce99d05de37d545f4351d" + integrity sha512-yJEfuZtzFpQmg1OSCyS9M5NJRrln/9FbYosH3iW0MG402QbdbaB8ZESwUv9RO6nRfLAKvWcMxCwdLWOov36x/g== dependencies: - unist-util-is "^3.0.0" + "@types/unist" "^2.0.0" + unist-util-is "^4.0.0" -unist-util-visit@^1.1.0: - version "1.4.1" - resolved "https://registry.yarnpkg.com/unist-util-visit/-/unist-util-visit-1.4.1.tgz#4724aaa8486e6ee6e26d7ff3c8685960d560b1e3" - integrity sha512-AvGNk7Bb//EmJZyhtRUnNMEpId/AZ5Ph/KUpTI09WHQuDZHKovQ1oEv3mfmKpWKtoMzyMC4GLBm1Zy5k12fjIw== +unist-util-visit@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/unist-util-visit/-/unist-util-visit-2.0.2.tgz#3843782a517de3d2357b4c193b24af2d9366afb7" + integrity sha512-HoHNhGnKj6y+Sq+7ASo2zpVdfdRifhTgX2KTU3B/sO/TTlZchp7E3S4vjRzDJ7L60KmrCPsQkVK3lEF3cz36XQ== dependencies: - unist-util-visit-parents "^2.0.0" + "@types/unist" "^2.0.0" + unist-util-is "^4.0.0" + unist-util-visit-parents "^3.0.0" uri-js@^4.2.2: version "4.2.2" @@ -3744,35 +3740,29 @@ validate-npm-package-license@^3.0.1: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" -vfile-location@^2.0.0: - version "2.0.6" - resolved "https://registry.yarnpkg.com/vfile-location/-/vfile-location-2.0.6.tgz#8a274f39411b8719ea5728802e10d9e0dff1519e" - integrity sha512-sSFdyCP3G6Ka0CEmN83A2YCMKIieHx0EDaj5IDP4g1pa5ZJ4FJDvpO0WODLxo4LUX4oe52gmSCK7Jw4SBghqxA== +vfile-location@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/vfile-location/-/vfile-location-3.0.1.tgz#d78677c3546de0f7cd977544c367266764d31bb3" + integrity sha512-yYBO06eeN/Ki6Kh1QAkgzYpWT1d3Qln+ZCtSbJqFExPl1S3y2qqotJQXoh6qEvl/jDlgpUJolBn3PItVnnZRqQ== -vfile-message@*: - version "2.0.3" - resolved "https://registry.yarnpkg.com/vfile-message/-/vfile-message-2.0.3.tgz#0dd4f6879fb240a8099b22bd3755536c92e59ba5" - integrity sha512-qQg/2z8qnnBHL0psXyF72kCjb9YioIynvyltuNKFaUhRtqTIcIMP3xnBaPzirVZNuBrUe1qwFciSx2yApa4byw== +vfile-message@^2.0.0: + version "2.0.4" + resolved "https://registry.yarnpkg.com/vfile-message/-/vfile-message-2.0.4.tgz#5b43b88171d409eae58477d13f23dd41d52c371a" + integrity sha512-DjssxRGkMvifUOJre00juHoP9DPWuzjxKuMDrhNbk2TdaYYBNMStsNhEOt3idrtI12VQYM/1+iM0KOzXi4pxwQ== dependencies: "@types/unist" "^2.0.0" unist-util-stringify-position "^2.0.0" -vfile-message@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/vfile-message/-/vfile-message-1.1.1.tgz#5833ae078a1dfa2d96e9647886cd32993ab313e1" - integrity sha512-1WmsopSGhWt5laNir+633LszXvZ+Z/lxveBf6yhGsqnQIhlhzooZae7zV6YVM1Sdkw68dtAW3ow0pOdPANugvA== - dependencies: - unist-util-stringify-position "^1.1.1" - -vfile@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/vfile/-/vfile-3.0.1.tgz#47331d2abe3282424f4a4bb6acd20a44c4121803" - integrity sha512-y7Y3gH9BsUSdD4KzHsuMaCzRjglXN0W2EcMf0gpvu6+SbsGhMje7xDc8AEoeXy6mIwCKMI6BkjMsRjzQbhMEjQ== +vfile@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/vfile/-/vfile-4.1.0.tgz#d79248957f43225d57ff67a56effc67bef08946e" + integrity sha512-BaTPalregj++64xbGK6uIlsurN3BCRNM/P2Pg8HezlGzKd1O9PrwIac6bd9Pdx2uTb0QHoioZ+rXKolbVXEgJg== dependencies: + "@types/unist" "^2.0.0" is-buffer "^2.0.0" replace-ext "1.0.0" - unist-util-stringify-position "^1.0.0" - vfile-message "^1.0.0" + unist-util-stringify-position "^2.0.0" + vfile-message "^2.0.0" which-module@^2.0.0: version "2.0.0" @@ -3829,11 +3819,6 @@ write@1.0.3: dependencies: mkdirp "^0.5.1" -x-is-string@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/x-is-string/-/x-is-string-0.1.0.tgz#474b50865af3a49a9c4657f05acd145458f77d82" - integrity sha1-R0tQhlrzpJqcRlfwWs0UVFj3fYI= - xtend@^4.0.0, xtend@^4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" From cd4ca41e82f68a0c845f69c9cf480632ae398661 Mon Sep 17 00:00:00 2001 From: Nasser Rafie Date: Sat, 11 Apr 2020 06:30:31 +0430 Subject: [PATCH 21/32] :mag: --- test/virastar.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/virastar.js b/test/virastar.js index 8086208..7d68573 100644 --- a/test/virastar.js +++ b/test/virastar.js @@ -318,13 +318,17 @@ describe('Virastar.js', function () { }); describe('#cleanup(): Equals', function () { - it('should preserve the certain strings', function () { + it('should preserve certain strings', function () { var equals = [ + '![alt name](https://example.com/media/image.jpg)', + '[![alt name](https://example.com/media/image.jpg)](https://example.com/media/image.jpg)', + '[![](https://example.com/media/image.jpg)](https://example.com/media/image.jpg)', + '[![](https://example.com/media/image.jpg)](https://example.com/media/image.jpg) [![](https://example.com/media/image.jpg)](https://example.com/media/image.jpg)', '[![](https://upload.wikimedia.org/wikipedia/commons/0/0c/Nastaliq-proportions.jpg)](https://en.wikipedia.org/wiki/File:Nastaliq-proportions.jpg)' ]; for (var equal in equals) { - assert.strictEqual(virastar.cleanup(equals[equal]), equals[equal] ); + assert.strictEqual(virastar.cleanup(equals[equal]), equals[equal]); } }); }); From 979b54c57400c45f7b9a454d21eea207d71e61c4 Mon Sep 17 00:00:00 2001 From: Nasser Rafie Date: Sat, 11 Apr 2020 06:59:50 +0430 Subject: [PATCH 22/32] prevent removing spaces after punctuations on the end of lines --- README.md | 3 ++- lib/virastar.js | 9 ++++++--- settings.json | 3 ++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 99973ad..f598419 100644 --- a/README.md +++ b/README.md @@ -157,7 +157,8 @@ Virastar comes with a list of options to control its behavior. * `fix_spacing_for_punctuations`, (_default_: `true`) - - one space after and no space before `:`, `;`, `,`, `.`, `!`, `?` and their persian equivalents + - removes space before punctuations + - removes more than one space after punctuations, except followed by new-lines - removes space after colon that separates time parts - removes space after dots in numbers - removes space before some common domain tlds diff --git a/lib/virastar.js b/lib/virastar.js index 59b6ed6..697b44b 100644 --- a/lib/virastar.js +++ b/lib/virastar.js @@ -850,9 +850,12 @@ function fixPunctuationSpacing (text, options) { return text - // : ; , . ! ? and their persian equivalents should have - // no space before and one space after except followed by new-lines or preservers - .replace(/[ \t\u200c]*([:;,؛،.؟?!]{1})[ \t\u200c]*(?!\n|_{2})/g, '$1 ') + // removes space before punctuations + .replace(/[ \t\u200c]*([:;,؛،.؟?!]{1})/g, '$1') + + // removes more than one space after punctuations + // except followed by new-lines (or preservers) + .replace(/([:;,؛،.؟?!]{1})[ \t\u200c]*(?!\n|_{2})/g, '$1 ') // removes space after colon that separates time parts .replace(/([0-9۰-۹]+):\s+([0-9۰-۹]+)/g, '$1:$2') diff --git a/settings.json b/settings.json index f3c1e49..27ca11d 100644 --- a/settings.json +++ b/settings.json @@ -336,7 +336,8 @@ "key": "fix_spacing_for_punctuations", "label": "Fix Spacing for Punctuations", "description": [ - "one space after and no space before `:`, `;`, `,`, `.`, `!`, `?` and their persian equivalents", + "removes space before punctuations", + "removes more than one space after punctuations, except followed by new-lines", "removes space after colon that separates time parts", "removes space after dots in numbers", "removes space before some common domain tlds", From 66f87bf9a3d43e029950b3a2fa46a810d7ccdc88 Mon Sep 17 00:00:00 2001 From: Nasser Rafie Date: Sat, 11 Apr 2020 07:04:06 +0430 Subject: [PATCH 23/32] :wrench: unused arg removed --- lib/virastar.js | 82 ++++++++++++++++++++++++------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/lib/virastar.js b/lib/virastar.js index 697b44b..d0a046e 100644 --- a/lib/virastar.js +++ b/lib/virastar.js @@ -536,7 +536,7 @@ } // props @ebraminio/persiantools - function cleanupZWNJ (text, options) { + function cleanupZWNJ (text) { return text // converts all soft hyphens (­) into zwnj @@ -555,7 +555,7 @@ } // late checks for zwnjs - function cleanupZWNJLate (text, options) { + function cleanupZWNJLate (text) { return text // cleans zwnj after characters that don't conncet to the next @@ -565,7 +565,7 @@ // converts numeral and selected html character-sets into original characters // @props: @substack/node-ent - function decodeHTMLEntities (text, options) { + function decodeHTMLEntities (text) { return text.replace(/&(#?[^;\W]+;?)/g, function (matched, match) { var n; if ((n = /^#(\d+);?$/.exec(match))) { @@ -588,7 +588,7 @@ }); } - function normalizeEOL (text, options) { + function normalizeEOL (text) { return text // replaces windows end of lines with unix eol (`\n`) @@ -596,7 +596,7 @@ ; } - function fixDashes (text, options) { + function fixDashes (text) { return text // replaces triple dash to mdash @@ -607,7 +607,7 @@ ; } - function fixThreeDots (text, options) { + function fixThreeDots (text) { return text // removes spaces between dots @@ -618,7 +618,7 @@ ; } - function normalizeEllipsis (text, options) { + function normalizeEllipsis (text) { return text // replaces more than one ellipsis with one @@ -630,7 +630,7 @@ ; } - function fixEnglishQuotesPairs (text, options) { + function fixEnglishQuotesPairs (text) { return text // replaces english quote pairs with their persian equivalent @@ -639,13 +639,13 @@ } // replaces english quote marks with their persian equivalent - function fixEnglishQuotes (text, options) { + function fixEnglishQuotes (text) { return text .replace(/(["'`]+)(.+?)(\1)/g, '«$2»') ; } - function fixHamzeh (text, options) { + function fixHamzeh (text) { var replacement = '$1هٔ$3'; return text @@ -661,7 +661,7 @@ ; } - function fixHamzehArabic (text, options) { + function fixHamzehArabic (text) { return text // converts arabic hamzeh ة to هٔ @@ -669,14 +669,14 @@ ; } - function fixHamzehArabicAlt (text, options) { + function fixHamzehArabicAlt (text) { return text // converts arabic hamzeh ة to ه‌ی .replace(/(\S)ة([\s\u200c\u200e])/g, '$1ه‌ی$2') ; } - function cleanupRLM (text, options) { + function cleanupRLM (text) { return text // converts Right-to-left marks followed by persian characters to // zero-width non-joiners (ZWNJ) @@ -685,12 +685,12 @@ } // converts incorrect persian glyphs to standard characters - function fixPersianGlyphs (text, options) { + function fixPersianGlyphs (text) { return arrReplace(text, glyphs); } // props @ebraminio/persiantools - function fixMiscNonPersianChars (text, options) { + function fixMiscNonPersianChars (text) { return charReplace(text, 'كڪيىۍېہە', 'ککییییههه'); // return text // .replace(/ك/g, 'ک') // arabic kaf @@ -704,23 +704,23 @@ } // replaces english numbers with their persian equivalent - function fixEnglishNumbers (text, options) { + function fixEnglishNumbers (text) { return charReplace(text, '1234567890', digits); } // replaces arabic numbers with their persian equivalent - function fixArabicNumbers (text, options) { + function fixArabicNumbers (text) { return charReplace(text, '١٢٣٤٥٦٧٨٩٠', digits); } // @REF: https://github.com/shkarimpour/pholiday/pull/5/files - function convertPersianNumbers (text, options) { + function convertPersianNumbers (text) { return text.replace(/[\u0660-\u0669\u06f0-\u06f9]/g, function (char) { return char.charCodeAt(0) & 0xf; }); } - function fixNumeralSymbols (text, options) { + function fixNumeralSymbols (text) { return text // replaces english percent signs (U+066A) @@ -747,12 +747,12 @@ ; } - function fixPunctuations (text, options) { + function fixPunctuations (text) { return charReplace(text, ',;', '،؛'); } // replaces question marks with its persian equivalent - function fixQuestionMark (text, options) { + function fixQuestionMark (text) { return text .replace(/(\?)/g, '\u061F') // \u061F = ؟ ; @@ -761,7 +761,7 @@ // puts zwnj between the word and the prefix: // - mi* nemi* bi* // NOTE: there's a possible bug here: prefixes could be separate nouns - function fixPerfixSpacing (text, options) { + function fixPerfixSpacing (text) { var replacement = '$1\u200c$3'; return text .replace(/((\s|^)ن?می) ([^ ])/g, replacement) @@ -771,7 +771,7 @@ // puts zwnj between the word and the suffix // NOTE: possible bug: suffixes could be nouns - function fixSuffixSpacing (text, options) { + function fixSuffixSpacing (text) { var replacement = '$1\u200c$2'; return text @@ -790,7 +790,7 @@ ; } - function fixSuffixSpacingHamzeh (text, options) { + function fixSuffixSpacingHamzeh (text) { var replacement = '$1\u0647\u200c\u06cc$3'; return text @@ -805,7 +805,7 @@ ; } - function fixSuffixMisc (text, options) { + function fixSuffixMisc (text) { return text // replaces ه followed by ئ or ی, and then by ی, with ه\u200cای, // EXAMPLE: خانه‌ئی becomes خانه‌ای @@ -814,7 +814,7 @@ ; } - function cleanupExtraMarks (text, options) { + function cleanupExtraMarks (text) { return text // removes space between different/same marks (combining for cleanup) @@ -830,14 +830,14 @@ } // replaces kashidas to ndash in parenthetic - function kashidasAsParenthetic (text, options) { + function kashidasAsParenthetic (text) { return text .replace(/(\s)\u0640+/g, '$1–') .replace(/\u0640+(\s)/g, '–$1') ; } - function cleanupKashidas (text, options) { + function cleanupKashidas (text) { return text // converts kashida between numbers to ndash .replace(/([0-9۰-۹]+)ـ+([0-9۰-۹]+)/g, '$1–$2') @@ -848,7 +848,7 @@ ; } - function fixPunctuationSpacing (text, options) { + function fixPunctuationSpacing (text) { return text // removes space before punctuations .replace(/[ \t\u200c]*([:;,؛،.؟?!]{1})/g, '$1') @@ -871,7 +871,7 @@ ; } - function fixBracesSpacing (text, options) { + function fixBracesSpacing (text) { var replacement = ' $1$2$3 '; return text // removes inside spaces and more than one outside @@ -884,7 +884,7 @@ ; } - function fixBracesSpacingInside (text, options) { + function fixBracesSpacingInside (text) { var replacement = '$1$2$3'; return text // removes inside spaces for `()`, `[]`, `{}`, `“”` and `«»` @@ -896,7 +896,7 @@ ; } - function markdownNormalizeBraces (text, options) { + function markdownNormalizeBraces (text) { return text // removes space between ! and opening brace on markdown images // EXAMPLE: `! [alt] (src)` --> `![alt](src)` @@ -921,7 +921,7 @@ ; } - function markdownNormalizeLists (text, options) { + function markdownNormalizeLists (text) { return text // removes extra line between two items list .replace(/((\n|^)\*.*?)\n+(?=\n\*)/g, '$1') @@ -930,7 +930,7 @@ ; } - function fixDiacritics (text, options) { + function fixDiacritics (text) { return text // cleans zwnj before diacritic characters .replace(newRegExp('\u200c([' + charsDiacritic + '])'), '$1') @@ -944,7 +944,7 @@ ; } - function cleanupSpacing (text, options) { + function cleanupSpacing (text) { return text // replaces more than one space with just a single one @@ -958,7 +958,7 @@ ; } - function cleanupLineBreaks (text, options) { + function cleanupLineBreaks (text) { return text // cleans more than two contiguous line-breaks @@ -966,7 +966,7 @@ ; } - function cleanupBeginAndEnd (text, options) { + function cleanupBeginAndEnd (text) { return text // removes space/tab/zwnj/nbsp from the beginning of the new-lines @@ -979,13 +979,13 @@ ; } - function flipPunctuations (text, options) { + function flipPunctuations (text) { var end = ['-']; var start = ['!', '.', '،', '…', '"']; var before = []; var after = []; - text = fixThreeDots(text, options); + text = fixThreeDots(text); for (var iStart = 0; iStart < start.length; iStart++) { var sElement = start[iStart]; @@ -1013,11 +1013,11 @@ text += after[iAfter]; } - return normalizeEllipsis(text, options); + return normalizeEllipsis(text); } // swap incorrect quotes pairs `»«` to `«»` and `”“` to `“”` - function swapQuotes (text, options) { + function swapQuotes (text) { return text .replace(/(»)(.+?)(«)/g, '«$2»') .replace(/(”)(.+?)(“)/g, '“$2”') From b6545885374325e79b8d55549edecdf7e0f98e65 Mon Sep 17 00:00:00 2001 From: Nasser Rafie Date: Sat, 11 Apr 2020 07:34:30 +0430 Subject: [PATCH 24/32] readme: correct anchors for options --- README.md | 399 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 204 insertions(+), 195 deletions(-) diff --git a/README.md b/README.md index f598419..abb8622 100644 --- a/README.md +++ b/README.md @@ -52,201 +52,210 @@ Virastar("سلام 123" ,{"fix_english_numbers":false}); // Outputs: "سلام 1 ## Options and Specifications Virastar comes with a list of options to control its behavior. -* `normalize_eol`, (_default_: `true`) - - replaces windows end of lines with unix eol (`\n`) - - -* `decode_htmlentities`, (_default_: `true`) - - converts numeral and selected html character-sets into original characters - - -* `fix_dashes`, (_default_: `true`) - - replaces triple dash to mdash - - replaces double dash to ndash - - -* `fix_three_dots`, (_default_: `true`) - - removes spaces between dots - - replaces three dots with ellipsis character - - -* `normalize_ellipsis`, (_default_: `true`) - - replaces more than one ellipsis with one - - replaces (space|tab|zwnj) after ellipsis with one space - - -* `normalize_dates`, (_default_: `true`) - - re-orders date parts with slash as delimiter - - -* `fix_english_quotes_pairs`, (_default_: `true`) - - replaces english quote pairs (`“”`) with their persian equivalent (`«»`) - - -* `fix_english_quotes`, (_default_: `true`) - - replaces english quote marks with their persian equivalent - - -* `fix_hamzeh`, (_default_: `true`) - - replaces `ه` followed by (space|ZWNJ|lrm) follow by `ی` with `هٔ` - - replaces `ه` followed by (space|ZWNJ|lrm|nothing) follow by `ء` with `هٔ` - - replaces `هٓ` or single-character `ۀ` with the standard `هٔ` - - -* `fix_hamzeh_arabic`, (_default_: `false`) - - converts arabic hamzeh `ة` to `هٔ` - - -* `cleanup_rlm`, (_default_: `true`) - - converts Right-to-left marks followed by persian characters to zero-width non-joiners (ZWNJ) - - -* `cleanup_zwnj`, (_default_: `true`) - - converts all soft hyphens (`­`) into zwnj - - removes more than one zwnj - - cleans zwnj after characters that don't conncet to the next - - cleans zwnj before and after numbers, english words, spaces and punctuations - - removes unnecessary zwnj on start/end of each line - - -* `fix_arabic_numbers`, (_default_: `true`) - - replaces arabic numbers with their persian equivalent - - -* `fix_english_numbers`, (_default_: `true`) - - replaces english numbers with their persian equivalent - - -* `fix_numeral_symbols`, (_default_: `true`) - - replaces english percent signs (U+066A) - - replaces dots between numbers into decimal separator (U+066B) - - replaces commas between numbers into thousands separator (U+066C) - - -* `fix_misc_non_persian_chars`, (_default_: `true`) - - replaces arabic normal/swash kaf with its persian equivalent - - replaces arabic/urdu/pushtu/uyghur yeh with its persian equivalent - - replaces kurdish he with its persian equivalent - - -* `fix_punctuations`, (_default_: `true`) - - replaces `,`, `;` with its persian equivalent - - -* `fix_question_mark`, (_default_: `true`) - - replaces question marks with its persian equivalent - - -* `fix_perfix_spacing`, (_default_: `true`) - - puts zwnj between the word and the prefix: - - `mi*`, `nemi*`, `bi*` - - -* `fix_suffix_spacing`, (_default_: `true`) - - puts zwnj between the word and the suffix: - - `*ha`, `*haye` - - `*am`, `*at`, `*ash`, `*ei`, `*eid`, `*eem`, `*and`, `*man`, `*tan`, `*shan` - - `*tar`, `*tari`, `*tarin` - - `*hayee`, `*hayam`, `*hayat`, `*hayash`, `*hayetan`, `*hayeman`, `*hayeshan` - -* `fix_suffix_misc`, (_default_: `true`) - - replaces `ه` followed by `ئ` or `ی`, and then by `ی`, with `ه‌ای` - -* `fix_spacing_for_braces_and_quotes`, (_default_: `true`) - - removes inside spaces and more than one outside for `()`, `[]`, `{}`, `“”` and `«»` - - -* `fix_spacing_for_punctuations`, (_default_: `true`) - - removes space before punctuations - - removes more than one space after punctuations, except followed by new-lines - - removes space after colon that separates time parts - - removes space after dots in numbers - - removes space before some common domain tlds - - removes space between question and exclamation marks - - removes space between same marks - - -* `fix_diacritics`, (_default_: `true`) - - cleans zwnj before diacritic characters - - cleans more than one diacritic characters - - cleans spaces before diacritic characters - -* `fix_persian_glyphs`, (_default_: `true`) - - converts incorrect persian glyphs to standard characters - -* `cleanup_spacing`, (_default_: `true`) - - replaces more than one space with just a single one - - cleans whitespace/zwnj between new-lines - - -* `cleanup_line_breaks`, (_default_: `true`) - - cleans more than **two** contiguous line breaks - - -* `cleanup_begin_and_end`, (_default_: `true`) - - removes space/tab/zwnj/nbsp from the beginning of the new-lines - - removes spaces, tabs, zwnj, direction marks and new lines from the beginning and end of text - -#### markdown -* `markdown_normalize_braces`, (_default_: `true`) - - removes spaces between `[]` and `()` (`[text] (link)` into `[text](link)`) - - removes space between `!` and opening brace (`! [alt](src)` into `![alt](src)`) - - removes spaces inside double `()`, `[]`, `{}` (`[[ text ]]` into `[[text]]`) - - removes spaces between double `()`, `[]`, `{}` (`[[text] ]` into `[[text]]`) - -* `markdown_normalize_lists`, (_default_: `true`) - - removes extra lines between two items on a markdown list beginning with `-`, `*` or `#` - -* `skip_markdown_ordered_lists_numbers_conversion`, (_default_: `false`) - - skips converting english numbers of ordered lists in markdown - -#### aggressive editing -* `cleanup_extra_marks`, (_default_: `true`) - - replaces more than one exclamation mark with just one - - replaces more than one english or persian question mark with just one - - re-orders consecutive marks: `?!` into `!?` - - -* `kashidas_as_parenthetic`, (_default_: `true`) - - replaces kashidas to ndash in parenthetic - - -* `cleanup_kashidas`, (_default_: `true`) - - converts kashida between numbers to ndash - - removes all kashidas between non-whitespace characters - -#### extras -* `preserve_frontmatter`, (_default_: `true`) - - preserves frontmatter data in the text - - -* `preserve_HTML`, (_default_: `true`) - - preserves all html tags in the text - - -* `preserve_comments`, (_default_: `true`) - - preserves all html comments in the text - - -* `preserve_entities`, (_default_: `true`) - - preserves all html entities in the text - - -* `preserve_URIs`, (_default_: `true`) - - preserves all uri strings in the text - - -* `preserve_brackets`, (_default_: `false`) - - preserves strings inside square brackets (`[]`) - - -* `preserve_braces`, (_default_: `false`) - - preserves strings inside curly braces (`{}`) - - -* `preserve_nbsps`, (_default_: `true`) - - preserves all no-break space entities in the text +#### `normalize_eol` +_default_: `true` +- replaces windows end of lines with unix eol (`\n`) + +#### `decode_htmlentities` +_default_: `true` +- converts numeral and selected html character-sets into original characters + +#### `fix_dashes` +_default_: `true` +- replaces triple dash to mdash +- replaces double dash to ndash + +#### `fix_three_dots` +_default_: `true` +- removes spaces between dots +- replaces three dots with ellipsis character + +#### `normalize_ellipsis` +_default_: `true` +- replaces more than one ellipsis with one +- replaces (space|tab|zwnj) after ellipsis with one space + +#### `normalize_dates` +_default_: `true` +- re-orders date parts with slash as delimiter + +#### `fix_english_quotes_pairs` +_default_: `true` +- replaces english quote pairs (`“”`) with their persian equivalent (`«»`) + +#### `fix_english_quotes` +_default_: `true` +- replaces english quote marks with their persian equivalent + +#### `fix_hamzeh` +_default_: `true` +- replaces `ه` followed by (space|ZWNJ|lrm) follow by `ی` with `هٔ` +- replaces `ه` followed by (space|ZWNJ|lrm|nothing) follow by `ء` with `هٔ` +- replaces `هٓ` or single-character `ۀ` with the standard `هٔ` + +#### `fix_hamzeh_arabic` +_default_: `false` +- converts arabic hamzeh `ة` to `هٔ` + +#### `cleanup_rlm` +_default_: `true` +- converts Right-to-left marks followed by persian characters to zero-width non-joiners (ZWNJ) + +#### `cleanup_zwnj` +_default_: `true` +- converts all soft hyphens (`­`) into zwnj +- removes more than one zwnj +- cleans zwnj after characters that don't conncet to the next +- cleans zwnj before and after numbers, english words, spaces and punctuations +- removes unnecessary zwnj on start/end of each line + +#### `fix_arabic_numbers` +_default_: `true` +- replaces arabic numbers with their persian equivalent + +#### `fix_english_numbers` +_default_: `true` +- replaces english numbers with their persian equivalent + +#### `fix_numeral_symbols` +_default_: `true` +- replaces english percent signs (U+066A) +- replaces dots between numbers into decimal separator (U+066B) +- replaces commas between numbers into thousands separator (U+066C) + +#### `fix_misc_non_persian_chars` +_default_: `true` +- replaces arabic normal/swash kaf with its persian equivalent +- replaces arabic/urdu/pushtu/uyghur yeh with its persian equivalent +- replaces kurdish he with its persian equivalent + +#### `fix_punctuations` +_default_: `true` +- replaces `,`, `;` with its persian equivalent + +#### `fix_question_mark` +_default_: `true` +- replaces question marks with its persian equivalent + +#### `fix_perfix_spacing` +_default_: `true` +- puts zwnj between the word and the prefix: + - `mi*`, `nemi*`, `bi*` + +#### `fix_suffix_spacing` +_default_: `true` +- puts zwnj between the word and the suffix: + - `*ha`, `*haye` + - `*am`, `*at`, `*ash`, `*ei`, `*eid`, `*eem`, `*and`, `*man`, `*tan`, `*shan` + - `*tar`, `*tari`, `*tarin` + - `*hayee`, `*hayam`, `*hayat`, `*hayash`, `*hayetan`, `*hayeman`, `*hayeshan` + +#### `fix_suffix_misc` +_default_: `true` +- replaces `ه` followed by `ئ` or `ی`, and then by `ی`, with `ه‌ای` + +#### `fix_spacing_for_braces_and_quotes` +_default_: `true` +- removes inside spaces and more than one outside for `()`, `[]`, `{}`, `“”` and `«»` + +#### `fix_spacing_for_punctuations` +_default_: `true` +- removes space before punctuations +- removes more than one space after punctuations, except followed by new-lines +- removes space after colon that separates time parts +- removes space after dots in numbers +- removes space before some common domain tlds +- removes space between question and exclamation marks +- removes space between same marks + +#### `fix_diacritics` +_default_: `true` +- cleans zwnj before diacritic characters +- cleans more than one diacritic characters +- cleans spaces before diacritic characters + +#### `fix_persian_glyphs` +_default_: `true` +- converts incorrect persian glyphs to standard characters + +#### `cleanup_spacing` +_default_: `true` +- replaces more than one space with just a single one +- cleans whitespace/zwnj between new-lines + +#### `cleanup_line_breaks` +_default_: `true` +- cleans more than **two** contiguous line breaks + +#### `cleanup_begin_and_end` +_default_: `true` +- removes space/tab/zwnj/nbsp from the beginning of the new-lines +- removes spaces, tabs, zwnj, direction marks and new lines from the beginning and end of text + +### markdown +#### `markdown_normalize_braces` +_default_: `true` +- removes spaces between `[]` and `()` (`[text] (link)` into `[text](link)`) +- removes space between `!` and opening brace (`! [alt](src)` into `![alt](src)`) +- removes spaces inside double `()`, `[]`, `{}` (`[[ text ]]` into `[[text]]`) +- removes spaces between double `()`, `[]`, `{}` (`[[text] ]` into `[[text]]`) + +#### `markdown_normalize_lists` +_default_: `true` +- removes extra lines between two items on a markdown list beginning with `-`, `*` or `#` + +#### `skip_markdown_ordered_lists_numbers_conversion` +_default_: `false` +- skips converting english numbers of ordered lists in markdown + +### aggressive editing +#### `cleanup_extra_marks` +_default_: `true` +- replaces more than one exclamation mark with just one +- replaces more than one english or persian question mark with just one +- re-orders consecutive marks: `?!` into `!?` + +#### `kashidas_as_parenthetic` +_default_: `true` +- replaces kashidas to ndash in parenthetic + +#### `cleanup_kashidas` +_default_: `true` +- converts kashida between numbers to ndash +- removes all kashidas between non-whitespace characters + +### extras +#### `preserve_frontmatter` +_default_: `true` +- preserves frontmatter data in the text + +#### `preserve_HTML` +_default_: `true` +- preserves all html tags in the text + +#### `preserve_comments` +_default_: `true` +- preserves all html comments in the text + +#### `preserve_entities` +_default_: `true` +- preserves all html entities in the text + +#### `preserve_URIs` +_default_: `true` +- preserves all uri strings in the text + +#### `preserve_brackets` +_default_: `false` +- preserves strings inside square brackets (`[]`) + +#### `preserve_braces` +_default_: `false` +- preserves strings inside curly braces (`{}`) + +#### `preserve_nbsps` +_default_: `true` +- preserves all no-break space entities in the text ## License - This software is licensed under the MIT License. [View the license](LICENSE). From d0f9b1e8a4d7e749a9ce48cc36d9f94941ca9572 Mon Sep 17 00:00:00 2001 From: Nasser Rafie Date: Sun, 12 Apr 2020 21:41:23 +0430 Subject: [PATCH 25/32] :new: option fix misc spacing --- CHANGELOG.md | 1 + README.md | 5 +++++ lib/virastar.js | 16 ++++++++++++++++ settings.json | 9 +++++++++ 4 files changed, 31 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d6eb723..68b0dce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ### [develop] - Added: removes spaces between dots on `fix_three_dots` - Added: new option `normalize_dates` to re-order date parts with slash as delimiter +- Added: new option `fix_misc_spacing` to remove space before braces containing numbers - Changed: early fix persian glyphs - Changed: removing space between different/same marks - Fixed: lazy seek before dashes on frontmatter preserving diff --git a/README.md b/README.md index abb8622..cf4e3a4 100644 --- a/README.md +++ b/README.md @@ -178,6 +178,11 @@ _default_: `true` _default_: `true` - converts incorrect persian glyphs to standard characters +#### `fix_misc_spacing` +_default_: `true` +- removes space before parentheses on misc cases +- removes space before braces containing numbers + #### `cleanup_spacing` _default_: `true` - replaces more than one space with just a single one diff --git a/lib/virastar.js b/lib/virastar.js index d0a046e..e975a85 100644 --- a/lib/virastar.js +++ b/lib/virastar.js @@ -91,6 +91,7 @@ fix_hamzeh: true, fix_hamzeh_arabic: false, fix_misc_non_persian_chars: true, + fix_misc_spacing: true, fix_numeral_symbols: true, fix_perfix_spacing: true, fix_persian_glyphs: true, @@ -448,6 +449,10 @@ text = fixBracesSpacingInside(text, opts); } + if (opts.fix_misc_spacing) { + text = fixMiscSpacing(text, opts); + } + if (opts.fix_diacritics) { text = fixDiacritics(text, opts); } @@ -930,6 +935,17 @@ ; } + function fixMiscSpacing (text) { + return text + + // removes space before parentheses on misc cases + .replace(/ \((ص|عج|س|ع|ره)\)/g, '($1)') + + // removes space before braces containing numbers + .replace(/ \[([0-9۰-۹]+)\]/g, '[$1]') + ; + } + function fixDiacritics (text) { return text // cleans zwnj before diacritic characters diff --git a/settings.json b/settings.json index 27ca11d..a3100c5 100644 --- a/settings.json +++ b/settings.json @@ -332,6 +332,15 @@ ], "default": true }, + { + "key": "fix_misc_spacing", + "label": "Fix Misc Spacing", + "description": [ + "removes space before parentheses on misc cases", + "removes space before braces containing numbers" + ], + "default": true + }, { "key": "fix_spacing_for_punctuations", "label": "Fix Spacing for Punctuations", From 8096b19222194a4dec7232585a8ed2f328129100 Mon Sep 17 00:00:00 2001 From: Nasser Rafie Date: Sun, 12 Apr 2020 21:44:09 +0430 Subject: [PATCH 26/32] :wrench: unused arg removed --- lib/virastar.js | 76 ++++++++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/lib/virastar.js b/lib/virastar.js index e975a85..4bf5c59 100644 --- a/lib/virastar.js +++ b/lib/virastar.js @@ -285,7 +285,7 @@ } if (opts.decode_htmlentities) { - text = decodeHTMLEntities(text, opts); + text = decodeHTMLEntities(text); } // preserves all html entities in the text @@ -299,57 +299,57 @@ } if (opts.normalize_eol) { - text = normalizeEOL(text, opts); + text = normalizeEOL(text); } if (opts.fix_persian_glyphs) { - text = fixPersianGlyphs(text, opts); + text = fixPersianGlyphs(text); } if (opts.fix_dashes) { - text = fixDashes(text, opts); + text = fixDashes(text); } if (opts.fix_three_dots) { - text = fixThreeDots(text, opts); + text = fixThreeDots(text); } if (opts.normalize_ellipsis) { - text = normalizeEllipsis(text, opts); + text = normalizeEllipsis(text); } if (opts.fix_english_quotes_pairs) { - text = fixEnglishQuotesPairs(text, opts); + text = fixEnglishQuotesPairs(text); } if (opts.fix_english_quotes) { - text = fixEnglishQuotes(text, opts); + text = fixEnglishQuotes(text); } if (opts.fix_hamzeh) { if (opts.fix_hamzeh_arabic) { - text = fixHamzehArabic(text, opts); + text = fixHamzehArabic(text); } - text = fixHamzeh(text, opts); + text = fixHamzeh(text); } else if (opts.fix_suffix_spacing) { if (opts.fix_hamzeh_arabic) { - text = fixHamzehArabicAlt(text, opts); + text = fixHamzehArabicAlt(text); } - text = fixSuffixSpacingHamzeh(text, opts); + text = fixSuffixSpacingHamzeh(text); } if (opts.cleanup_rlm) { - text = cleanupRLM(text, opts); + text = cleanupRLM(text); } if (opts.cleanup_zwnj) { - text = cleanupZWNJ(text, opts); + text = cleanupZWNJ(text); } if (opts.fix_arabic_numbers) { - text = fixArabicNumbers(text, opts); + text = fixArabicNumbers(text); } // word tokenizer @@ -377,23 +377,23 @@ } if (opts.fix_english_numbers) { - matched = fixEnglishNumbers(matched, opts); + matched = fixEnglishNumbers(matched); } if (opts.fix_numeral_symbols) { - matched = fixNumeralSymbols(matched, opts); + matched = fixNumeralSymbols(matched); } if (opts.fix_punctuations) { - matched = fixPunctuations(matched, opts); + matched = fixPunctuations(matched); } if (opts.fix_misc_non_persian_chars) { - matched = fixMiscNonPersianChars(matched, opts); + matched = fixMiscNonPersianChars(matched); } if (opts.fix_question_mark) { - matched = fixQuestionMark(matched, opts); + matched = fixQuestionMark(matched); } return matched; @@ -401,72 +401,72 @@ ); if (opts.normalize_dates) { - text = normalizeDates(text, opts); + text = normalizeDates(text); } if (opts.fix_perfix_spacing) { - text = fixPerfixSpacing(text, opts); + text = fixPerfixSpacing(text); } if (opts.fix_suffix_spacing) { - text = fixSuffixSpacing(text, opts); + text = fixSuffixSpacing(text); } if (opts.fix_suffix_misc) { - text = fixSuffixMisc(text, opts); + text = fixSuffixMisc(text); } if (opts.fix_spacing_for_braces_and_quotes) { - text = fixBracesSpacing(text, opts); + text = fixBracesSpacing(text); } if (opts.cleanup_extra_marks) { - text = cleanupExtraMarks(text, opts); + text = cleanupExtraMarks(text); } if (opts.fix_spacing_for_punctuations) { - text = fixPunctuationSpacing(text, opts); + text = fixPunctuationSpacing(text); } if (opts.kashidas_as_parenthetic) { - text = kashidasAsParenthetic(text, opts); + text = kashidasAsParenthetic(text); } if (opts.cleanup_kashidas) { - text = cleanupKashidas(text, opts); + text = cleanupKashidas(text); } if (opts.markdown_normalize_braces) { - text = markdownNormalizeBraces(text, opts); + text = markdownNormalizeBraces(text); } if (opts.markdown_normalize_lists) { - text = markdownNormalizeLists(text, opts); + text = markdownNormalizeLists(text); } // doing it again after `fixPunctuationSpacing()` if (opts.fix_spacing_for_braces_and_quotes) { - text = fixBracesSpacingInside(text, opts); + text = fixBracesSpacingInside(text); } if (opts.fix_misc_spacing) { - text = fixMiscSpacing(text, opts); + text = fixMiscSpacing(text); } if (opts.fix_diacritics) { - text = fixDiacritics(text, opts); + text = fixDiacritics(text); } if (opts.cleanup_spacing) { - text = cleanupSpacing(text, opts); + text = cleanupSpacing(text); } if (opts.cleanup_zwnj) { - text = cleanupZWNJLate(text, opts); + text = cleanupZWNJLate(text); } if (opts.cleanup_line_breaks) { - text = cleanupLineBreaks(text, opts); + text = cleanupLineBreaks(text); } // bringing back entities @@ -531,7 +531,7 @@ } if (opts.cleanup_begin_and_end) { - text = cleanupBeginAndEnd(text, opts); + text = cleanupBeginAndEnd(text); } else { // removes single space paddings around the string text = text.replace(/^[ ]/g, '').replace(/[ ]$/g, ''); From f39bf9dff829e5006cf657c7a9ff4b9417c5654b Mon Sep 17 00:00:00 2001 From: Nasser Rafie Date: Sun, 12 Apr 2020 21:44:28 +0430 Subject: [PATCH 27/32] :wrench: --- package.json | 2 +- yarn.lock | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 5641b04..a8cf903 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "mocha": "^7.1.1", "semistandard": "^14.2.0", "sprintf-js": "^1.1.2", - "stylelint": "^13.3.1" + "stylelint": "^13.3.2" }, "semistandard": { "ignore": [ diff --git a/yarn.lock b/yarn.lock index 0dd7fd5..e07112a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -775,10 +775,10 @@ "@nodelib/fs.scandir" "2.1.3" fastq "^1.6.0" -"@stylelint/postcss-css-in-js@^0.37.0": - version "0.37.0" - resolved "https://registry.yarnpkg.com/@stylelint/postcss-css-in-js/-/postcss-css-in-js-0.37.0.tgz#199df63fe8d876d74656c8dec3b17e8474ca866e" - integrity sha512-9svhg0rpUOo4xkvnllUzM0ZQF/Iwxhi6Bf1rzOA06fDa+fjnBUb2mvEV1c9nJb14g1XD/HMSmvklaVyCo96x6A== +"@stylelint/postcss-css-in-js@^0.37.1": + version "0.37.1" + resolved "https://registry.yarnpkg.com/@stylelint/postcss-css-in-js/-/postcss-css-in-js-0.37.1.tgz#41e5e7660f73d88227610e18c6ebb262d56ac125" + integrity sha512-UMf2Rni3JGKi3ZwYRGMYJ5ipOA5ENJSKMtYA/pE1ZLURwdh7B5+z2r73RmWvub+N0UuH1Lo+TGfCgYwPvqpXNw== dependencies: "@babel/core" ">=7.9.0" @@ -914,7 +914,7 @@ astral-regex@^1.0.0: resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== -autoprefixer@^9.7.5: +autoprefixer@^9.7.6: version "9.7.6" resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-9.7.6.tgz#63ac5bbc0ce7934e6997207d5bb00d68fa8293a4" integrity sha512-F7cYpbN7uVVhACZTeeIeealwdGM6wMtfWARVLTy5xmKtgVdBNJvbDRoCK3YO1orcs7gv/KwYlb3iXwu9Ug9BkQ== @@ -1315,9 +1315,9 @@ domutils@^1.5.1: domelementtype "1" electron-to-chromium@^1.3.390: - version "1.3.402" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.402.tgz#9ad93c0c8ea2e571431739e0d76bd6bc9788a846" - integrity sha512-gaCDfX7IUH0s3JmBiHCDPrvVcdnTTP1r4WLJc2dHkYYbLmXZ2XHiJCcGQ9Balf91aKTvuCKCyu2JjJYRykoI1w== + version "1.3.403" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.403.tgz#c8bab4e2e72bf78bc28bad1cc355c061f9cc1918" + integrity sha512-JaoxV4RzdBAZOnsF4dAlZ2ijJW72MbqO5lNfOBHUWiBQl3Rwe+mk2RCUMrRI3rSClLJ8HSNQNqcry12H+0ZjFw== emoji-regex@^7.0.1: version "7.0.3" @@ -3437,14 +3437,14 @@ style-search@^0.1.0: resolved "https://registry.yarnpkg.com/style-search/-/style-search-0.1.0.tgz#7958c793e47e32e07d2b5cafe5c0bf8e12e77902" integrity sha1-eVjHk+R+MuB9K1yv5cC/jhLneQI= -stylelint@^13.3.1: - version "13.3.1" - resolved "https://registry.yarnpkg.com/stylelint/-/stylelint-13.3.1.tgz#815917e88d7528b24e6d0e6a9b3afb76b50efc26" - integrity sha512-jeeGwU7y/0l2YTL042U2U0W04J9JIO6bRpTM4S8npSzaO5GzBz4VFlVlMucFzZXkSylxppEx9R6p+DiDLJcrWw== +stylelint@^13.3.2: + version "13.3.2" + resolved "https://registry.yarnpkg.com/stylelint/-/stylelint-13.3.2.tgz#fbcb69a2452bc35de3eedd95b443449f92ab4107" + integrity sha512-kpO3/Gz2ZY40EWUwFYYkgpzhf8ZDUyKpcui5+pS0XKJBj/EMYmZpOJoL8IFAz2yApYeg91NVy5yAjE39hDzWvQ== dependencies: - "@stylelint/postcss-css-in-js" "^0.37.0" + "@stylelint/postcss-css-in-js" "^0.37.1" "@stylelint/postcss-markdown" "^0.36.1" - autoprefixer "^9.7.5" + autoprefixer "^9.7.6" balanced-match "^1.0.0" chalk "^4.0.0" cosmiconfig "^6.0.0" From 54455e5f4a78ee33e36f4ae4d72586ac3bbfd0ea Mon Sep 17 00:00:00 2001 From: Nasser Rafie Date: Sun, 12 Apr 2020 21:44:55 +0430 Subject: [PATCH 28/32] :pencil: --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cf4e3a4..b967435 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Virastar is a Persian text cleaner. A javascript port of [aziz/virastar](https://github.com/aziz/virastar) -with a lot of help from [ebraminio/persiantools](https://github.com/ebraminio/persiantools) +with lots of help from [ebraminio/persiantools](https://github.com/ebraminio/persiantools) see live [demo](https://virastar.brothersincode.ir) From c562d4dcbd2560dd5ce96ae2818e452466093d44 Mon Sep 17 00:00:00 2001 From: Nasser Rafie Date: Sun, 12 Apr 2020 23:36:56 +0430 Subject: [PATCH 29/32] :new: option remove diacritics --- CHANGELOG.md | 1 + README.md | 4 ++++ lib/virastar.js | 13 ++++++++++++- settings.json | 8 ++++++++ test/virastar.js | 4 ++++ 5 files changed, 29 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68b0dce..9fa6431 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ - Added: removes spaces between dots on `fix_three_dots` - Added: new option `normalize_dates` to re-order date parts with slash as delimiter - Added: new option `fix_misc_spacing` to remove space before braces containing numbers +- Added: new option `remove_diacritics` to remove all diacritic characters - Changed: early fix persian glyphs - Changed: removing space between different/same marks - Fixed: lazy seek before dashes on frontmatter preserving diff --git a/README.md b/README.md index b967435..fa6824b 100644 --- a/README.md +++ b/README.md @@ -174,6 +174,10 @@ _default_: `true` - cleans more than one diacritic characters - cleans spaces before diacritic characters +### `remove_diacritics` +_default_: `false` +- removes all diacritic characters + #### `fix_persian_glyphs` _default_: `true` - converts incorrect persian glyphs to standard characters diff --git a/lib/virastar.js b/lib/virastar.js index 4bf5c59..93f3504 100644 --- a/lib/virastar.js +++ b/lib/virastar.js @@ -116,6 +116,7 @@ preserve_HTML: true, preserve_nbsps: true, preserve_URIs: true, + remove_diacritics: false, skip_markdown_ordered_lists_numbers_conversion: false }; @@ -453,7 +454,9 @@ text = fixMiscSpacing(text); } - if (opts.fix_diacritics) { + if (opts.remove_diacritics) { + text = removeDiacritics(text); + } else if (opts.fix_diacritics) { text = fixDiacritics(text); } @@ -960,6 +963,14 @@ ; } + function removeDiacritics (text) { + return text + + // removes all diacritic characters + .replace(newRegExp('[' + charsDiacritic + ']+'), '') + ; + } + function cleanupSpacing (text) { return text diff --git a/settings.json b/settings.json index a3100c5..de91133 100644 --- a/settings.json +++ b/settings.json @@ -314,6 +314,14 @@ ], "default": true }, + { + "key": "remove_diacritics", + "label": "Remove Diacritics", + "description": [ + "removes all diacritic characters" + ], + "default": false + }, { "key": "fix_numeral_symbols", "label": "Fix Numeral Symbols", diff --git a/test/virastar.js b/test/virastar.js index 7d68573..589bce4 100644 --- a/test/virastar.js +++ b/test/virastar.js @@ -443,5 +443,9 @@ describe('Virastar.js', function () { assert.strictEqual(virastar.cleanup('23/10/1355'), '۱۳۵۵/۱۰/۲۳'); assert.strictEqual(virastar.cleanup('3/1/1355'), '۱۳۵۵/۱/۳'); }); + + it('extra: removeDiacritics(): removes all diacritic characters', function () { + assert.strictEqual(virastar.cleanup('اذا عَمَّتِ الْبُلْدانَ الْفِتَنُ فَعَلَیکمْ بِقُمْ وَحَوالیها وَنَواحیها فَانَ الْبَلاءَ مَدْفُوعٌ عَنْها', { remove_diacritics: true }), 'اذا عمت البلدان الفتن فعلیکم بقم وحوالیها ونواحیها فان البلاء مدفوع عنها'); + }); }); }); From cc32718f810ac2e1ada954d9a531eebd40a22261 Mon Sep 17 00:00:00 2001 From: Nasser Rafie Date: Thu, 14 May 2020 02:46:26 +0430 Subject: [PATCH 30/32] removing markdown link spaces inside normal parentheses --- CHANGELOG.md | 1 + lib/virastar.js | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fa6431..71d1a0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ - Added: new option `normalize_dates` to re-order date parts with slash as delimiter - Added: new option `fix_misc_spacing` to remove space before braces containing numbers - Added: new option `remove_diacritics` to remove all diacritic characters +- Added: removes markdown link spaces inside normal parentheses - Changed: early fix persian glyphs - Changed: removing space between different/same marks - Fixed: lazy seek before dashes on frontmatter preserving diff --git a/lib/virastar.js b/lib/virastar.js index 93f3504..93425bc 100644 --- a/lib/virastar.js +++ b/lib/virastar.js @@ -901,6 +901,10 @@ .replace(/(\{)\s*([^}]+?)\s*?(\})/g, replacement) .replace(/(“)\s*([^”]+?)\s*?(”)/g, replacement) .replace(/(«)\s*([^»]+?)\s*?(»)/g, replacement) + + // NOTE: must be here, wierd not working if on `markdownNormalizeBraces()` + // removes markdown link spaces inside normal () + .replace(/(\(\[.*?\]\(.*?\))\s+(\))/g, '$1$2') ; } From a15231524cb30123e00d39642d1f6457b9152d7d Mon Sep 17 00:00:00 2001 From: Nasser Rafie Date: Thu, 14 May 2020 02:48:04 +0430 Subject: [PATCH 31/32] prevent removing new-lines on normalize braces --- CHANGELOG.md | 1 + lib/virastar.js | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71d1a0f..0844c66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ - Fixed: combined pattern for removing kashidas - Fixed: prevent removing spaces after punctuations on the end of lines - Fixed: prevent removing double spaces on the end of lines +- Fixed: prevent removing new-lines on normalize braces ### 0.20.0 - Added: cleanup zwnj before/after ellipsis diff --git a/lib/virastar.js b/lib/virastar.js index 93425bc..977e2b3 100644 --- a/lib/virastar.js +++ b/lib/virastar.js @@ -916,20 +916,20 @@ // removes spaces between [] and () // EXAMPLE: `[text] (link)` --> `[text](link)` - .replace(/(\[.*?\])\s+(\(.*?\))/g, '$1$2') + .replace(/(\[.*?\])[ \t]+(\(.*?\))/g, '$1$2') // removes spaces inside double () [] {} // EXAMPLE: `[[ text ]]` --> `[[text]]` - .replace(/\(\(\s*(.*?)\s*\)\)/g, '(($1))') - .replace(/\[\[\s*(.*?)\s*\]\]/g, '[[$1]]') - .replace(/\{\{\s*(.*?)\s*\}\}/g, '{{$1}}') - .replace(/\{\{\{\s*(.*?)\s*\}\}\}/g, '{{{$1}}}') // mustache escape + .replace(/\(\([ \t]*(.*?)[ \t]*\)\)/g, '(($1))') + .replace(/\[\[[ \t]*(.*?)[ \t]*\]\]/g, '[[$1]]') + .replace(/\{\{[ \t]*(.*?)[ \t]*\}\}/g, '{{$1}}') + .replace(/\{\{\{[ \t]*(.*?)[ \t]*\}\}\}/g, '{{{$1}}}') // mustache escape // removes spaces between double () [] {} // EXAMPLE: `[[text] ]` --> `[[text]]` - .replace(/(\(\(.*\))\s+(\))/g, '$1$2') - .replace(/(\[\[.*\])\s+(\])/g, '$1$2') - .replace(/(\{\{.*\})\s+(\})/g, '$1$2') + .replace(/(\(\(.*\))[ \t]+(\))/g, '$1$2') + .replace(/(\[\[.*\])[ \t]+(\])/g, '$1$2') + .replace(/(\{\{.*\})[ \t]+(\})/g, '$1$2') ; } From 4da62a6e61d3df599db3398192a7d8eaf2ca6fb6 Mon Sep 17 00:00:00 2001 From: Nasser Rafie Date: Thu, 14 May 2020 02:48:19 +0430 Subject: [PATCH 32/32] :wrench: --- package.json | 8 +- yarn.lock | 433 +++++++++++++++++++++++++-------------------------- 2 files changed, 216 insertions(+), 225 deletions(-) diff --git a/package.json b/package.json index a8cf903..b524606 100644 --- a/package.json +++ b/package.json @@ -20,13 +20,13 @@ }, "dependencies": {}, "devDependencies": { - "@babel/core": "^7.9.0", - "@babel/preset-env": "^7.9.5", + "@babel/core": "^7.9.6", + "@babel/preset-env": "^7.9.6", "@babel/register": "^7.9.0", - "mocha": "^7.1.1", + "mocha": "^7.1.2", "semistandard": "^14.2.0", "sprintf-js": "^1.1.2", - "stylelint": "^13.3.2" + "stylelint": "^13.3.3" }, "semistandard": { "ignore": [ diff --git a/yarn.lock b/yarn.lock index e07112a..7ca5180 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9,28 +9,28 @@ dependencies: "@babel/highlight" "^7.8.3" -"@babel/compat-data@^7.8.6", "@babel/compat-data@^7.9.0": - version "7.9.0" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.9.0.tgz#04815556fc90b0c174abd2c0c1bb966faa036a6c" - integrity sha512-zeFQrr+284Ekvd9e7KAX954LkapWiOmQtsfHirhxqfdlX6MEC32iRE+pqUGlYIBchdevaCwvzxWGSy/YBNI85g== +"@babel/compat-data@^7.9.6": + version "7.9.6" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.9.6.tgz#3f604c40e420131affe6f2c8052e9a275ae2049b" + integrity sha512-5QPTrNen2bm7RBc7dsOmcA5hbrS4O2Vhmk5XOL4zWW/zD/hV0iinpefDlkm+tBBy8kDtFaaeEvmAqt+nURAV2g== dependencies: - browserslist "^4.9.1" + browserslist "^4.11.1" invariant "^2.2.4" semver "^5.5.0" -"@babel/core@>=7.9.0", "@babel/core@^7.9.0": - version "7.9.0" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.9.0.tgz#ac977b538b77e132ff706f3b8a4dbad09c03c56e" - integrity sha512-kWc7L0fw1xwvI0zi8OKVBuxRVefwGOrKSQMvrQ3dW+bIIavBY3/NpXmpjMy7bQnLgwgzWQZ8TlM57YHpHNHz4w== +"@babel/core@>=7.9.0", "@babel/core@^7.9.6": + version "7.9.6" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.9.6.tgz#d9aa1f580abf3b2286ef40b6904d390904c63376" + integrity sha512-nD3deLvbsApbHAHttzIssYqgb883yU/d9roe4RZymBCDaZryMJDbptVpEpeQuRh4BJ+SYI8le9YGxKvFEvl1Wg== dependencies: "@babel/code-frame" "^7.8.3" - "@babel/generator" "^7.9.0" + "@babel/generator" "^7.9.6" "@babel/helper-module-transforms" "^7.9.0" - "@babel/helpers" "^7.9.0" - "@babel/parser" "^7.9.0" + "@babel/helpers" "^7.9.6" + "@babel/parser" "^7.9.6" "@babel/template" "^7.8.6" - "@babel/traverse" "^7.9.0" - "@babel/types" "^7.9.0" + "@babel/traverse" "^7.9.6" + "@babel/types" "^7.9.6" convert-source-map "^1.7.0" debug "^4.1.0" gensync "^1.0.0-beta.1" @@ -40,12 +40,12 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/generator@^7.9.0", "@babel/generator@^7.9.5": - version "7.9.5" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.9.5.tgz#27f0917741acc41e6eaaced6d68f96c3fa9afaf9" - integrity sha512-GbNIxVB3ZJe3tLeDm1HSn2AhuD/mVcyLDpgtLXa5tplmWrJdF/elxB56XNqCuD6szyNkDi6wuoKXln3QeBmCHQ== +"@babel/generator@^7.9.6": + version "7.9.6" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.9.6.tgz#5408c82ac5de98cda0d77d8124e99fa1f2170a43" + integrity sha512-+htwWKJbH2bL72HRluF8zumBxzuX0ZZUFl3JLNyoUjM/Ho8wnVpPXM6aUz8cfKDqQ/h7zHqKt4xzJteUosckqQ== dependencies: - "@babel/types" "^7.9.5" + "@babel/types" "^7.9.6" jsesc "^2.5.1" lodash "^4.17.13" source-map "^0.5.0" @@ -65,13 +65,13 @@ "@babel/helper-explode-assignable-expression" "^7.8.3" "@babel/types" "^7.8.3" -"@babel/helper-compilation-targets@^7.8.7": - version "7.8.7" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.8.7.tgz#dac1eea159c0e4bd46e309b5a1b04a66b53c1dde" - integrity sha512-4mWm8DCK2LugIS+p1yArqvG1Pf162upsIsjE7cNBjez+NjliQpVhj20obE520nao0o14DaTnFJv+Fw5a0JpoUw== +"@babel/helper-compilation-targets@^7.9.6": + version "7.9.6" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.9.6.tgz#1e05b7ccc9d38d2f8b40b458b380a04dcfadd38a" + integrity sha512-x2Nvu0igO0ejXzx09B/1fGBxY9NXQlBW2kZsSxCJft+KHN8t9XWzIvFxtPHnBOAXpVsdxZKZFbRUC8TsNKajMw== dependencies: - "@babel/compat-data" "^7.8.6" - browserslist "^4.9.1" + "@babel/compat-data" "^7.9.6" + browserslist "^4.11.1" invariant "^2.2.4" levenary "^1.1.1" semver "^5.5.0" @@ -183,14 +183,14 @@ "@babel/types" "^7.8.3" "@babel/helper-replace-supers@^7.8.3", "@babel/helper-replace-supers@^7.8.6": - version "7.8.6" - resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.8.6.tgz#5ada744fd5ad73203bf1d67459a27dcba67effc8" - integrity sha512-PeMArdA4Sv/Wf4zXwBKPqVj7n9UF/xg6slNRtZW84FM7JpE1CbG8B612FyM4cxrf4fMAMGO0kR7voy1ForHHFA== + version "7.9.6" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.9.6.tgz#03149d7e6a5586ab6764996cd31d6981a17e1444" + integrity sha512-qX+chbxkbArLyCImk3bWV+jB5gTNU/rsze+JlcF6Nf8tVTigPJSI1o1oBow/9Resa1yehUO9lIipsmu9oG4RzA== dependencies: "@babel/helper-member-expression-to-functions" "^7.8.3" "@babel/helper-optimise-call-expression" "^7.8.3" - "@babel/traverse" "^7.8.6" - "@babel/types" "^7.8.6" + "@babel/traverse" "^7.9.6" + "@babel/types" "^7.9.6" "@babel/helper-simple-access@^7.8.3": version "7.8.3" @@ -222,14 +222,14 @@ "@babel/traverse" "^7.8.3" "@babel/types" "^7.8.3" -"@babel/helpers@^7.9.0": - version "7.9.2" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.9.2.tgz#b42a81a811f1e7313b88cba8adc66b3d9ae6c09f" - integrity sha512-JwLvzlXVPjO8eU9c/wF9/zOIN7X6h8DYf7mG4CiFRZRvZNKEF5dQ3H3V+ASkHoIB3mWhatgl5ONhyqHRI6MppA== +"@babel/helpers@^7.9.6": + version "7.9.6" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.9.6.tgz#092c774743471d0bb6c7de3ad465ab3d3486d580" + integrity sha512-tI4bUbldloLcHWoRUMAj4g1bF313M/o6fBKhIsb3QnGVPwRm9JsNf/gqMkQ7zjqReABiffPV6RWj7hEglID5Iw== dependencies: "@babel/template" "^7.8.3" - "@babel/traverse" "^7.9.0" - "@babel/types" "^7.9.0" + "@babel/traverse" "^7.9.6" + "@babel/types" "^7.9.6" "@babel/highlight@^7.8.3": version "7.9.0" @@ -240,10 +240,10 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.8.6", "@babel/parser@^7.9.0": - version "7.9.4" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.9.4.tgz#68a35e6b0319bbc014465be43828300113f2f2e8" - integrity sha512-bC49otXX6N0/VYhgOMh4gnP26E9xnDZK3TmbNpxYzzz9BQLBosQwfyOe9/cXUU3txYhTzLCbcqd5c8y/OmCjHA== +"@babel/parser@^7.8.6", "@babel/parser@^7.9.6": + version "7.9.6" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.9.6.tgz#3b1bbb30dabe600cd72db58720998376ff653bc7" + integrity sha512-AoeIEJn8vt+d/6+PXDRPaksYhnlbMIiejioBZvvMQsOjW/JYK6k/0dKnvvP3EhK5GfMBWDPtrxRtegWdAcdq9Q== "@babel/plugin-proposal-async-generator-functions@^7.8.3": version "7.8.3" @@ -286,10 +286,10 @@ "@babel/helper-plugin-utils" "^7.8.3" "@babel/plugin-syntax-numeric-separator" "^7.8.3" -"@babel/plugin-proposal-object-rest-spread@^7.9.5": - version "7.9.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.9.5.tgz#3fd65911306d8746014ec0d0cf78f0e39a149116" - integrity sha512-VP2oXvAf7KCYTthbUHwBlewbl1Iq059f6seJGsxMizaCdgHIeczOr7FBqELhSqfkIl04Fi8okzWzl63UKbQmmg== +"@babel/plugin-proposal-object-rest-spread@^7.9.6": + version "7.9.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.9.6.tgz#7a093586fcb18b08266eb1a7177da671ac575b63" + integrity sha512-Ga6/fhGqA9Hj+y6whNpPv8psyaK5xzrQwSPsGPloVkvmH+PqW1ixdnfJ9uIO06OjQNYol3PMnfmJ8vfZtkzF+A== dependencies: "@babel/helper-plugin-utils" "^7.8.3" "@babel/plugin-syntax-object-rest-spread" "^7.8.0" @@ -493,34 +493,34 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-modules-amd@^7.9.0": - version "7.9.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.9.0.tgz#19755ee721912cf5bb04c07d50280af3484efef4" - integrity sha512-vZgDDF003B14O8zJy0XXLnPH4sg+9X5hFBBGN1V+B2rgrB+J2xIypSN6Rk9imB2hSTHQi5OHLrFWsZab1GMk+Q== +"@babel/plugin-transform-modules-amd@^7.9.6": + version "7.9.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.9.6.tgz#8539ec42c153d12ea3836e0e3ac30d5aae7b258e" + integrity sha512-zoT0kgC3EixAyIAU+9vfaUVKTv9IxBDSabgHoUCBP6FqEJ+iNiN7ip7NBKcYqbfUDfuC2mFCbM7vbu4qJgOnDw== dependencies: "@babel/helper-module-transforms" "^7.9.0" "@babel/helper-plugin-utils" "^7.8.3" - babel-plugin-dynamic-import-node "^2.3.0" + babel-plugin-dynamic-import-node "^2.3.3" -"@babel/plugin-transform-modules-commonjs@^7.9.0": - version "7.9.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.9.0.tgz#e3e72f4cbc9b4a260e30be0ea59bdf5a39748940" - integrity sha512-qzlCrLnKqio4SlgJ6FMMLBe4bySNis8DFn1VkGmOcxG9gqEyPIOzeQrA//u0HAKrWpJlpZbZMPB1n/OPa4+n8g== +"@babel/plugin-transform-modules-commonjs@^7.9.6": + version "7.9.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.9.6.tgz#64b7474a4279ee588cacd1906695ca721687c277" + integrity sha512-7H25fSlLcn+iYimmsNe3uK1at79IE6SKW9q0/QeEHTMC9MdOZ+4bA+T1VFB5fgOqBWoqlifXRzYD0JPdmIrgSQ== dependencies: "@babel/helper-module-transforms" "^7.9.0" "@babel/helper-plugin-utils" "^7.8.3" "@babel/helper-simple-access" "^7.8.3" - babel-plugin-dynamic-import-node "^2.3.0" + babel-plugin-dynamic-import-node "^2.3.3" -"@babel/plugin-transform-modules-systemjs@^7.9.0": - version "7.9.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.9.0.tgz#e9fd46a296fc91e009b64e07ddaa86d6f0edeb90" - integrity sha512-FsiAv/nao/ud2ZWy4wFacoLOm5uxl0ExSQ7ErvP7jpoihLR6Cq90ilOFyX9UXct3rbtKsAiZ9kFt5XGfPe/5SQ== +"@babel/plugin-transform-modules-systemjs@^7.9.6": + version "7.9.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.9.6.tgz#207f1461c78a231d5337a92140e52422510d81a4" + integrity sha512-NW5XQuW3N2tTHim8e1b7qGy7s0kZ2OH3m5octc49K1SdAKGxYxeIx7hiIz05kS1R2R+hOWcsr1eYwcGhrdHsrg== dependencies: "@babel/helper-hoist-variables" "^7.8.3" "@babel/helper-module-transforms" "^7.9.0" "@babel/helper-plugin-utils" "^7.8.3" - babel-plugin-dynamic-import-node "^2.3.0" + babel-plugin-dynamic-import-node "^2.3.3" "@babel/plugin-transform-modules-umd@^7.9.0": version "7.9.0" @@ -626,13 +626,13 @@ "@babel/helper-create-regexp-features-plugin" "^7.8.3" "@babel/helper-plugin-utils" "^7.8.3" -"@babel/preset-env@^7.9.5": - version "7.9.5" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.9.5.tgz#8ddc76039bc45b774b19e2fc548f6807d8a8919f" - integrity sha512-eWGYeADTlPJH+wq1F0wNfPbVS1w1wtmMJiYk55Td5Yu28AsdR9AsC97sZ0Qq8fHqQuslVSIYSGJMcblr345GfQ== +"@babel/preset-env@^7.9.6": + version "7.9.6" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.9.6.tgz#df063b276c6455ec6fcfc6e53aacc38da9b0aea6" + integrity sha512-0gQJ9RTzO0heXOhzftog+a/WyOuqMrAIugVYxMYf83gh1CQaQDjMtsOpqOwXyDL/5JcWsrCm8l4ju8QC97O7EQ== dependencies: - "@babel/compat-data" "^7.9.0" - "@babel/helper-compilation-targets" "^7.8.7" + "@babel/compat-data" "^7.9.6" + "@babel/helper-compilation-targets" "^7.9.6" "@babel/helper-module-imports" "^7.8.3" "@babel/helper-plugin-utils" "^7.8.3" "@babel/plugin-proposal-async-generator-functions" "^7.8.3" @@ -640,7 +640,7 @@ "@babel/plugin-proposal-json-strings" "^7.8.3" "@babel/plugin-proposal-nullish-coalescing-operator" "^7.8.3" "@babel/plugin-proposal-numeric-separator" "^7.8.3" - "@babel/plugin-proposal-object-rest-spread" "^7.9.5" + "@babel/plugin-proposal-object-rest-spread" "^7.9.6" "@babel/plugin-proposal-optional-catch-binding" "^7.8.3" "@babel/plugin-proposal-optional-chaining" "^7.9.0" "@babel/plugin-proposal-unicode-property-regex" "^7.8.3" @@ -667,9 +667,9 @@ "@babel/plugin-transform-function-name" "^7.8.3" "@babel/plugin-transform-literals" "^7.8.3" "@babel/plugin-transform-member-expression-literals" "^7.8.3" - "@babel/plugin-transform-modules-amd" "^7.9.0" - "@babel/plugin-transform-modules-commonjs" "^7.9.0" - "@babel/plugin-transform-modules-systemjs" "^7.9.0" + "@babel/plugin-transform-modules-amd" "^7.9.6" + "@babel/plugin-transform-modules-commonjs" "^7.9.6" + "@babel/plugin-transform-modules-systemjs" "^7.9.6" "@babel/plugin-transform-modules-umd" "^7.9.0" "@babel/plugin-transform-named-capturing-groups-regex" "^7.8.3" "@babel/plugin-transform-new-target" "^7.8.3" @@ -685,8 +685,8 @@ "@babel/plugin-transform-typeof-symbol" "^7.8.4" "@babel/plugin-transform-unicode-regex" "^7.8.3" "@babel/preset-modules" "^0.1.3" - "@babel/types" "^7.9.5" - browserslist "^4.9.1" + "@babel/types" "^7.9.6" + browserslist "^4.11.1" core-js-compat "^3.6.2" invariant "^2.2.2" levenary "^1.1.1" @@ -714,10 +714,10 @@ pirates "^4.0.0" source-map-support "^0.5.16" -"@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7": - version "7.9.2" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.9.2.tgz#d90df0583a3a252f09aaa619665367bae518db06" - integrity sha512-NE2DtOdufG7R5vnfQUTehdTfNycfUANEtCa9PssN9O/xmTzP4E08UI797ixaei6hBEVL9BI/PsdJS5x7mWoB9Q== +"@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2": + version "7.9.6" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.9.6.tgz#a9102eb5cadedf3f31d08a9ecf294af7827ea29f" + integrity sha512-64AF1xY3OAkFHqOb9s4jpgk1Mm5vDZ4L3acHvAml+53nO1XbXLuDodsVpO4OIUsmemlUHMxNdYMNJmsvOwLrvQ== dependencies: regenerator-runtime "^0.13.4" @@ -730,25 +730,25 @@ "@babel/parser" "^7.8.6" "@babel/types" "^7.8.6" -"@babel/traverse@^7.8.3", "@babel/traverse@^7.8.6", "@babel/traverse@^7.9.0": - version "7.9.5" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.9.5.tgz#6e7c56b44e2ac7011a948c21e283ddd9d9db97a2" - integrity sha512-c4gH3jsvSuGUezlP6rzSJ6jf8fYjLj3hsMZRx/nX0h+fmHN0w+ekubRrHPqnMec0meycA2nwCsJ7dC8IPem2FQ== +"@babel/traverse@^7.8.3", "@babel/traverse@^7.9.6": + version "7.9.6" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.9.6.tgz#5540d7577697bf619cc57b92aa0f1c231a94f442" + integrity sha512-b3rAHSjbxy6VEAvlxM8OV/0X4XrG72zoxme6q1MOoe2vd0bEc+TwayhuC1+Dfgqh1QEG+pj7atQqvUprHIccsg== dependencies: "@babel/code-frame" "^7.8.3" - "@babel/generator" "^7.9.5" + "@babel/generator" "^7.9.6" "@babel/helper-function-name" "^7.9.5" "@babel/helper-split-export-declaration" "^7.8.3" - "@babel/parser" "^7.9.0" - "@babel/types" "^7.9.5" + "@babel/parser" "^7.9.6" + "@babel/types" "^7.9.6" debug "^4.1.0" globals "^11.1.0" lodash "^4.17.13" -"@babel/types@^7.4.4", "@babel/types@^7.8.3", "@babel/types@^7.8.6", "@babel/types@^7.9.0", "@babel/types@^7.9.5": - version "7.9.5" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.9.5.tgz#89231f82915a8a566a703b3b20133f73da6b9444" - integrity sha512-XjnvNqenk818r5zMaba+sLQjnbda31UfUURv3ei0qPQw4u+j2jMyJ5b11y8ZHYTRSI3NnInQkkkRT4fLqqPdHg== +"@babel/types@^7.4.4", "@babel/types@^7.8.3", "@babel/types@^7.8.6", "@babel/types@^7.9.0", "@babel/types@^7.9.5", "@babel/types@^7.9.6": + version "7.9.6" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.9.6.tgz#2c5502b427251e9de1bd2dff95add646d95cc9f7" + integrity sha512-qxXzvBO//jO9ZnoasKF1uJzHd2+M6Q2ZPIVfnFps8JJvXy0ZBbwbNOmE6SGIY5XOY6d1Bo5lb9d9RJ8nv3WSeA== dependencies: "@babel/helper-validator-identifier" "^7.9.5" lodash "^4.17.13" @@ -821,14 +821,14 @@ acorn-jsx@^5.2.0: integrity sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ== acorn@^7.1.1: - version "7.1.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.1.tgz#e35668de0b402f359de515c5482a1ab9f89a69bf" - integrity sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg== + version "7.2.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.2.0.tgz#17ea7e40d7c8640ff54a694c889c26f31704effe" + integrity sha512-apwXVmYVpQ34m/i71vrApRrRKCWQnZZF1+npOD0WV5xZFfwWOmKGQ2RWlfdy9vWITsenisM8M0Qeq8agcFHNiQ== ajv@^6.10.0, ajv@^6.10.2: - version "6.12.0" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.0.tgz#06d60b96d87b8454a5adaba86e7854da629db4b7" - integrity sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw== + version "6.12.2" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.2.tgz#c629c5eced17baf314437918d2da88c99d5958cd" + integrity sha512-k+V+hzjm5q/Mr8ef/1Y9goCmlsK4I6Sm74teeyGvFk1XrOsbsKLjEdrvny42CZ+a8sXbk8KWpY/bDwS+FLL2UQ== dependencies: fast-deep-equal "^3.1.1" fast-json-stable-stringify "^2.0.0" @@ -927,10 +927,10 @@ autoprefixer@^9.7.6: postcss "^7.0.27" postcss-value-parser "^4.0.3" -babel-plugin-dynamic-import-node@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.0.tgz#f00f507bdaa3c3e3ff6e7e5e98d90a7acab96f7f" - integrity sha512-o6qFkpeQEBxcqt0XYlWzAVxNCSCZdUgcR8IRlhD/8DylxjjO4foPcvTW0GGKa/cVt3rvxZ7o5ippJ+/0nvLhlQ== +babel-plugin-dynamic-import-node@^2.3.3: + version "2.3.3" + resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz#84fda19c976ec5c6defef57f9427b3def66e17a3" + integrity sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ== dependencies: object.assign "^4.1.0" @@ -969,13 +969,13 @@ browser-stdout@1.3.1: resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== -browserslist@^4.11.1, browserslist@^4.8.5, browserslist@^4.9.1: - version "4.11.1" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.11.1.tgz#92f855ee88d6e050e7e7311d987992014f1a1f1b" - integrity sha512-DCTr3kDrKEYNw6Jb9HFxVLQNaue8z+0ZfRBRjmCunKDEXEBajKDj2Y+Uelg+Pi29OnvaSGwjOsnRyNEkXzHg5g== +browserslist@^4.11.1, browserslist@^4.8.5: + version "4.12.0" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.12.0.tgz#06c6d5715a1ede6c51fc39ff67fd647f740b656d" + integrity sha512-UH2GkcEDSI0k/lRkuDSzFl9ZZ87skSy9w2XAn1MsZnL+4c4rqbBd3e82UWHbYDpztABrPBhZsTEeuxVfHppqDg== dependencies: - caniuse-lite "^1.0.30001038" - electron-to-chromium "^1.3.390" + caniuse-lite "^1.0.30001043" + electron-to-chromium "^1.3.413" node-releases "^1.1.53" pkg-up "^2.0.0" @@ -989,7 +989,7 @@ callsites@^3.0.0: resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== -camelcase-keys@^6.1.1: +camelcase-keys@^6.2.2: version "6.2.2" resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-6.2.2.tgz#5e755d6ba51aa223ec7d3d52f25778210f9dc3c0" integrity sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg== @@ -1003,10 +1003,10 @@ camelcase@^5.0.0, camelcase@^5.3.1: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== -caniuse-lite@^1.0.30001038, caniuse-lite@^1.0.30001039: - version "1.0.30001040" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001040.tgz#103fc8e6eb1d7397e95134cd0e996743353d58ea" - integrity sha512-Ep0tEPeI5wCvmJNrXjE3etgfI+lkl1fTDU6Y3ZH1mhrjkPlVI9W4pcKbMo+BQLpEWKVYYp2EmYaRsqpPC3k7lQ== +caniuse-lite@^1.0.30001039, caniuse-lite@^1.0.30001043: + version "1.0.30001055" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001055.tgz#7b52c3537f7a8c0408aca867e83d2b04268b54cd" + integrity sha512-MbwsBmKrBSKIWldfdIagO5OJWZclpJtS4h0Jrk/4HFrXJxTdVdH23Fd+xCiHriVGvYcWyW8mR/CPsYajlH8Iuw== ccount@^1.0.0: version "1.0.5" @@ -1078,9 +1078,9 @@ cli-cursor@^2.1.0: restore-cursor "^2.0.0" cli-width@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" - integrity sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk= + version "2.2.1" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.1.tgz#b0433d0b4e9c847ef18868a4ef16fd5fc8271c48" + integrity sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw== cliui@^5.0.0: version "5.0.0" @@ -1235,7 +1235,7 @@ define-properties@^1.1.2, define-properties@^1.1.3: dependencies: object-keys "^1.0.12" -deglob@^4.0.0: +deglob@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/deglob/-/deglob-4.0.1.tgz#0685c6383992fd6009be10653a2b1116696fad55" integrity sha512-/g+RDZ7yf2HvoW+E5Cy+K94YhgcFgr6C8LuHZD1O5HoNPkf3KY6RfXJ0DBGlB/NkLi5gml+G9zqRzk9S0mHZCg== @@ -1314,10 +1314,10 @@ domutils@^1.5.1: dom-serializer "0" domelementtype "1" -electron-to-chromium@^1.3.390: - version "1.3.403" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.403.tgz#c8bab4e2e72bf78bc28bad1cc355c061f9cc1918" - integrity sha512-JaoxV4RzdBAZOnsF4dAlZ2ijJW72MbqO5lNfOBHUWiBQl3Rwe+mk2RCUMrRI3rSClLJ8HSNQNqcry12H+0ZjFw== +electron-to-chromium@^1.3.413: + version "1.3.436" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.436.tgz#d50715d8c2a75c9a3d2e77a1c3a28072580aaba2" + integrity sha512-qE378nzCj/E680nApDh8ctJ3gY8k58xIRCBbQC9S6i3OCRlwnTzTBVGXWDh37RZYgIYyFR0n6X14xlND1EkezQ== emoji-regex@^7.0.1: version "7.0.3" @@ -1335,9 +1335,9 @@ entities@^1.1.1: integrity sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w== entities@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/entities/-/entities-2.0.0.tgz#68d6084cab1b079767540d80e56a39b423e4abf4" - integrity sha512-D9f7V0JSRwIxlRI2mjMqufDrRDnx8p+eEOz7aUM9SuvF8gsBzra0/6tbjl1m8eQHrZlYj6PxqE00hZ1SAIKPLw== + version "2.0.2" + resolved "https://registry.yarnpkg.com/entities/-/entities-2.0.2.tgz#ac74db0bba8d33808bbf36809c3a5c3683531436" + integrity sha512-dmD3AvJQBUjKpcNkoqr+x+IF0SdRtPz9Vk0uTy4yWqga9ibB6s4v++QFWNohjiUGoMlF552ZvNyXDxz5iW0qmw== error-ex@^1.2.0, error-ex@^1.3.1: version "1.3.2" @@ -1548,11 +1548,11 @@ esprima@^4.0.0: integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== esquery@^1.0.1: - version "1.2.0" - resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.2.0.tgz#a010a519c0288f2530b3404124bfb5f02e9797fe" - integrity sha512-weltsSqdeWIX9G2qQZz7KlTRJdkkOCTPgLYJUz1Hacf48R4YOwGPHO3+ORfWedqJKbq5WQmsgK90n+pFLIKt/Q== + version "1.3.1" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.3.1.tgz#b78b5828aa8e214e29fb74c4d5b752e1c033da57" + integrity sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ== dependencies: - estraverse "^5.0.0" + estraverse "^5.1.0" esrecurse@^4.1.0: version "4.2.1" @@ -1566,10 +1566,10 @@ estraverse@^4.1.0, estraverse@^4.1.1: resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== -estraverse@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.0.0.tgz#ac81750b482c11cca26e4b07e83ed8f75fbcdc22" - integrity sha512-j3acdrMzqrxmJTNj5dbr1YbjacrYgAxVMeF0gK16E3j494mOe7xygM/ZLIguEQ0ETwAg2hlJCtHRGav+y0Ny5A== +estraverse@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.1.0.tgz#374309d39fd935ae500e7b92e8a6b4c720e59642" + integrity sha512-FyohXK+R0vE+y1nHLoBM7ZTyqRpqAlhdZHCWIWEviFLiGB8b04H6bQs8G+XTthacvT8VuwvteiP7RJSxMs8UEw== esutils@^2.0.2: version "2.0.3" @@ -1625,9 +1625,9 @@ fast-levenshtein@~2.0.6: integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= fastq@^1.6.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.7.0.tgz#fcd79a08c5bd7ec5b55cd3f5c4720db551929801" - integrity sha512-YOadQRnHd5q6PogvAR/x62BGituF2ufiEA6s8aavQANw5YKHERI4AREboX6KotzP8oX2klxYF2wcV/7bn1clfQ== + version "1.8.0" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.8.0.tgz#550e1f9f59bbc65fe185cb6a9b4d95357107f481" + integrity sha512-SMIZoZdLh/fgofivvIkmknUXyPnvxRE3DhtZ5Me3Mrsk5gyPL42F0xr51TdRXskBxHfMp+07bcYzfsYEsSQA9Q== dependencies: reusify "^1.0.4" @@ -1715,9 +1715,9 @@ fs.realpath@^1.0.0: integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= fsevents@~2.1.1: - version "2.1.2" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.2.tgz#4c0a1fb34bc68e543b4b82a9ec392bfbda840805" - integrity sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA== + version "2.1.3" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.3.tgz#fb738703ae8d2f9fe900c33836ddebee8b97f23e" + integrity sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ== function-bind@^1.1.1: version "1.1.1" @@ -1821,16 +1821,16 @@ gonzales-pe@^4.3.0: minimist "^1.2.5" graceful-fs@^4.1.15, graceful-fs@^4.1.2: - version "4.2.3" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423" - integrity sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ== + version "4.2.4" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb" + integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw== growl@1.10.5: version "1.10.5" resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e" integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA== -hard-rejection@^2.0.0: +hard-rejection@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/hard-rejection/-/hard-rejection-2.1.0.tgz#1c6eda5c1685c63942766d79bb40ae773cecd883" integrity sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA== @@ -2065,11 +2065,6 @@ is-plain-obj@^2.0.0: resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== -is-promise@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" - integrity sha1-eaKp7OfwlugPNtKy87wWwf9L8/o= - is-regex@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.5.tgz#39d589a358bf18967f726967120b8fc1aed74eae" @@ -2325,21 +2320,21 @@ mdast-util-compact@^2.0.0: unist-util-visit "^2.0.0" meow@^6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/meow/-/meow-6.1.0.tgz#4ff4641818d3502afcddc631f94cb6971a581cb3" - integrity sha512-iIAoeI01v6pmSfObAAWFoITAA4GgiT45m4SmJgoxtZfvI0fyZwhV4d0lTwiUXvAKIPlma05Feb2Xngl52Mj5Cg== + version "6.1.1" + resolved "https://registry.yarnpkg.com/meow/-/meow-6.1.1.tgz#1ad64c4b76b2a24dfb2f635fddcadf320d251467" + integrity sha512-3YffViIt2QWgTy6Pale5QpopX/IvU3LPL03jOTqp6pGj3VjesdO/U8CuHMKpnQr4shCNCM5fd5XFFvIIl6JBHg== dependencies: "@types/minimist" "^1.2.0" - camelcase-keys "^6.1.1" + camelcase-keys "^6.2.2" decamelize-keys "^1.1.0" - hard-rejection "^2.0.0" - minimist-options "^4.0.1" + hard-rejection "^2.1.0" + minimist-options "^4.0.2" normalize-package-data "^2.5.0" - read-pkg-up "^7.0.0" + read-pkg-up "^7.0.1" redent "^3.0.0" trim-newlines "^3.0.0" - type-fest "^0.8.1" - yargs-parser "^18.1.1" + type-fest "^0.13.1" + yargs-parser "^18.1.3" merge2@^1.3.0: version "1.3.0" @@ -2371,7 +2366,7 @@ minimatch@3.0.4, minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" -minimist-options@^4.0.1: +minimist-options@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/minimist-options/-/minimist-options-4.0.2.tgz#29c4021373ded40d546186725e57761e4b1984a7" integrity sha512-seq4hpWkYSUh1y7NXxzucwAN9yVlBc3Upgdjz8vLCP97jG8kaOmzYrVH/m7tQ1NYD1wdtZbSLfdy4zFmRWuc/w== @@ -2379,29 +2374,22 @@ minimist-options@^4.0.1: arrify "^1.0.1" is-plain-obj "^1.1.0" -minimist@^1.1.0, minimist@^1.2.5: +minimist@^1.2.5: version "1.2.5" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== -mkdirp@0.5.3: - version "0.5.3" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.3.tgz#5a514b7179259287952881e94410ec5465659f8c" - integrity sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg== - dependencies: - minimist "^1.2.5" - -mkdirp@^0.5.1: +mkdirp@0.5.5, mkdirp@^0.5.1: version "0.5.5" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== dependencies: minimist "^1.2.5" -mocha@^7.1.1: - version "7.1.1" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-7.1.1.tgz#89fbb30d09429845b1bb893a830bf5771049a441" - integrity sha512-3qQsu3ijNS3GkWcccT5Zw0hf/rWvu1fTN9sPvEd81hlwsr30GX2GcDSSoBxo24IR8FelmrAydGC6/1J5QQP4WA== +mocha@^7.1.2: + version "7.1.2" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-7.1.2.tgz#8e40d198acf91a52ace122cd7599c9ab857b29e6" + integrity sha512-o96kdRKMKI3E8U0bjnfqW4QMk12MwZ4mhdBTf+B5a1q9+aq2HRnj+3ZdJu0B/ZhJeK78MgYuv6L8d/rA5AeBJA== dependencies: ansi-colors "3.2.3" browser-stdout "1.3.1" @@ -2416,7 +2404,7 @@ mocha@^7.1.1: js-yaml "3.13.1" log-symbols "3.0.0" minimatch "3.0.4" - mkdirp "0.5.3" + mkdirp "0.5.5" ms "2.1.1" node-environment-flags "1.0.6" object.assign "4.1.0" @@ -2472,9 +2460,9 @@ node-modules-regexp@^1.0.0: integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA= node-releases@^1.1.53: - version "1.1.53" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.53.tgz#2d821bfa499ed7c5dffc5e2f28c88e78a08ee3f4" - integrity sha512-wp8zyQVwef2hpZ/dJH7SfSrIPD6YoJz6BDQDpGEkcA0s3LpAQoxBIYmfIq6QAhC1DhwsyCgTaTTcONwX8qzCuQ== + version "1.1.55" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.55.tgz#8af23b7c561d8e2e6e36a46637bab84633b07cee" + integrity sha512-H3R3YR/8TjT5WPin/wOoHOUPHgvj8leuU/Keta/rwelEQN9pA/S2Dx8/se4pZ2LBxSd0nAGzsNzhqwa77v7F1w== normalize-package-data@^2.3.2, normalize-package-data@^2.5.0: version "2.5.0" @@ -2857,14 +2845,14 @@ postcss-syntax@^0.36.2: integrity sha512-nBRg/i7E3SOHWxF3PpF5WnJM/jQ1YpY9000OaVXlAQj6Zp/kIqJxEDWIZ67tAd7NLuk7zqN4yqe9nc0oNAOs1w== postcss-value-parser@^4.0.3: - version "4.0.3" - resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.0.3.tgz#651ff4593aa9eda8d5d0d66593a2417aeaeb325d" - integrity sha512-N7h4pG+Nnu5BEIzyeaaIYWs0LI5XC40OrRh5L60z0QjFsqGWcHcbkBvpe1WYpcIS9yQ8sOi/vIPt1ejQCrMVrg== + version "4.1.0" + resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.1.0.tgz#443f6a20ced6481a2bda4fa8532a6e55d789a2cb" + integrity sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ== postcss@^7.0.0, postcss@^7.0.14, postcss@^7.0.2, postcss@^7.0.21, postcss@^7.0.26, postcss@^7.0.27, postcss@^7.0.7: - version "7.0.27" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.27.tgz#cc67cdc6b0daa375105b7c424a85567345fc54d9" - integrity sha512-WuQETPMcW9Uf1/22HWUWP9lgsIC+KEHg2kozMflKjbeUtw9ujvFX6QmIfozaErDkmLWS9WEnEdEe6Uo9/BNTdQ== + version "7.0.30" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.30.tgz#cc9378beffe46a02cbc4506a0477d05fcea9a8e2" + integrity sha512-nu/0m+NtIzoubO+xdAlwZl/u5S5vi/y6BCsoL8D+8IxsD3XvBS8X4YEADNIVXKVuQvduiucnRv+vPIqj56EGMQ== dependencies: chalk "^2.4.2" source-map "^0.6.1" @@ -2917,7 +2905,7 @@ read-pkg-up@^2.0.0: find-up "^2.0.0" read-pkg "^2.0.0" -read-pkg-up@^7.0.0: +read-pkg-up@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-7.0.1.tgz#f3a6135758459733ae2b95638056e1854e7ef507" integrity sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg== @@ -3029,9 +3017,9 @@ regjsparser@^0.6.4: jsesc "~0.5.0" remark-parse@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/remark-parse/-/remark-parse-8.0.0.tgz#0aaae4b49e607ee7e972a6cf688026f46bbf6d1a" - integrity sha512-Ck14G1Ns/GEPXhSw6m1Uv28kMtVk63e59NyL+QlhBBwBdIUXROM6MPfBehPhW6TW2d73batMdZsKwuxl5i3tEA== + version "8.0.2" + resolved "https://registry.yarnpkg.com/remark-parse/-/remark-parse-8.0.2.tgz#5999bc0b9c2e3edc038800a64ff103d0890b318b" + integrity sha512-eMI6kMRjsAGpMXXBAywJwiwAse+KNpmt+BK55Oofy4KvBZEqUDj6mWbGLJZrujoPIPPxDXzn3T9baRlpsm2jnQ== dependencies: ccount "^1.0.0" collapse-white-space "^1.0.2" @@ -3110,9 +3098,9 @@ resolve-from@^5.0.0: integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== resolve@^1.10.0, resolve@^1.10.1, resolve@^1.11.0, resolve@^1.13.1, resolve@^1.3.2: - version "1.15.1" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.15.1.tgz#27bdcdeffeaf2d6244b95bb0f9f4b4653451f3e8" - integrity sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w== + version "1.17.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444" + integrity sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w== dependencies: path-parse "^1.0.6" @@ -3137,11 +3125,9 @@ rimraf@2.6.3: glob "^7.1.3" run-async@^2.2.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.4.0.tgz#e59054a5b86876cfae07f431d18cbaddc594f1e8" - integrity sha512-xJTbh/d7Lm7SBhc1tNvTpeCHaEzoyxPrqNlvSdMfBTYwaY++UJFyXUOxAtsRUXjlqOfj8luNaR9vjCh4KeV+pg== - dependencies: - is-promise "^2.1.0" + version "2.4.1" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.4.1.tgz#8440eccf99ea3e70bd409d49aab88e10c189a455" + integrity sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ== run-parallel@^1.1.2, run-parallel@^1.1.9: version "1.1.9" @@ -3161,9 +3147,9 @@ safe-buffer@~5.1.1: integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== safe-buffer@~5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519" - integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg== + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== "safer-buffer@>= 2.1.2 < 3": version "2.1.2" @@ -3238,9 +3224,9 @@ slice-ansi@^2.1.0: is-fullwidth-code-point "^2.0.0" source-map-support@^0.5.16: - version "0.5.16" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.16.tgz#0ae069e7fe3ba7538c64c98515e35339eac5a042" - integrity sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ== + version "0.5.19" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61" + integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw== dependencies: buffer-from "^1.0.0" source-map "^0.6.0" @@ -3264,14 +3250,14 @@ spdx-correct@^3.0.0: spdx-license-ids "^3.0.0" spdx-exceptions@^2.1.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz#2ea450aee74f2a89bfb94519c07fcd6f41322977" - integrity sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA== + version "2.3.0" + resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz#3f28ce1a77a00372683eade4a433183527a2163d" + integrity sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A== spdx-expression-parse@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz#99e119b7a5da00e05491c9fa338b7904823b41d0" - integrity sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg== + version "3.0.1" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz#cf70f50482eefdc98e3ce0a6833e4a53ceeba679" + integrity sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q== dependencies: spdx-exceptions "^2.1.0" spdx-license-ids "^3.0.0" @@ -3297,13 +3283,13 @@ sprintf-js@~1.0.2: integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= standard-engine@^12.0.0: - version "12.0.0" - resolved "https://registry.yarnpkg.com/standard-engine/-/standard-engine-12.0.0.tgz#1643dceba96ca9c04c535a1fb28d79bfb21b3572" - integrity sha512-gJIIRb0LpL7AHyGbN9+hJ4UJns37lxmNTnMGRLC8CFrzQ+oB/K60IQjKNgPBCB2VP60Ypm6f8DFXvhVWdBOO+g== + version "12.0.1" + resolved "https://registry.yarnpkg.com/standard-engine/-/standard-engine-12.0.1.tgz#42a34993d74dc9af4b3bcaccecb17cb8b6c0628b" + integrity sha512-XtR9NfoTqvHkWQCwL1aLMwXw1Qxy5s4rdSIqetgBNw+8faNbQ+BbB49hPhKXjxxfC4yg+fpH0lx/T5fuUbpDcQ== dependencies: - deglob "^4.0.0" + deglob "^4.0.1" get-stdin "^7.0.0" - minimist "^1.1.0" + minimist "^1.2.5" pkg-conf "^3.1.0" state-toggle@^1.0.0: @@ -3379,9 +3365,9 @@ string_decoder@^1.1.1: safe-buffer "~5.2.0" stringify-entities@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/stringify-entities/-/stringify-entities-3.0.0.tgz#455abe501f8b7859ba5726a25a8872333c65b0a7" - integrity sha512-h7NJJIssprqlyjHT2eQt2W1F+MCcNmwPGlKb0bWEdET/3N44QN3QbUF/ueKCgAssyKRZ3Br9rQ7FcXjHr0qLHw== + version "3.0.1" + resolved "https://registry.yarnpkg.com/stringify-entities/-/stringify-entities-3.0.1.tgz#32154b91286ab0869ab2c07696223bd23b6dbfc0" + integrity sha512-Lsk3ISA2++eJYqBMPKcr/8eby1I6L0gP0NlxF8Zja6c05yr/yCYyb2c9PwXjd08Ib3If1vn1rbs1H5ZtVuOfvQ== dependencies: character-entities-html4 "^1.0.0" character-entities-legacy "^1.0.0" @@ -3437,10 +3423,10 @@ style-search@^0.1.0: resolved "https://registry.yarnpkg.com/style-search/-/style-search-0.1.0.tgz#7958c793e47e32e07d2b5cafe5c0bf8e12e77902" integrity sha1-eVjHk+R+MuB9K1yv5cC/jhLneQI= -stylelint@^13.3.2: - version "13.3.2" - resolved "https://registry.yarnpkg.com/stylelint/-/stylelint-13.3.2.tgz#fbcb69a2452bc35de3eedd95b443449f92ab4107" - integrity sha512-kpO3/Gz2ZY40EWUwFYYkgpzhf8ZDUyKpcui5+pS0XKJBj/EMYmZpOJoL8IFAz2yApYeg91NVy5yAjE39hDzWvQ== +stylelint@^13.3.3: + version "13.3.3" + resolved "https://registry.yarnpkg.com/stylelint/-/stylelint-13.3.3.tgz#e267a628ebfc1adad6f5a1fe818724c34171402b" + integrity sha512-j8Oio2T1YNiJc6iXDaPYd74Jg4zOa1bByNm/g9/Nvnq4tDPsIjMi46jhRZyPPktGPwjJ5FwcmCqIRlH6PVP8mA== dependencies: "@stylelint/postcss-css-in-js" "^0.37.1" "@stylelint/postcss-markdown" "^0.36.1" @@ -3591,9 +3577,9 @@ trough@^1.0.0: integrity sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA== tslib@^1.9.0: - version "1.11.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.11.1.tgz#eb15d128827fbee2841549e171f45ed338ac7e35" - integrity sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA== + version "1.12.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.12.0.tgz#d1fc9cacd06a1456c62f2902b361573e83d66473" + integrity sha512-5rxCQkP0kytf4H1T4xz1imjxaUUPMvc5aWp0rJ/VMIN7ClRiH1FwFvBt8wOeMasp/epeUnmSW6CixSIePtiLqA== type-check@~0.3.2: version "0.3.2" @@ -3602,6 +3588,11 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" +type-fest@^0.13.1: + version "0.13.1" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.13.1.tgz#0172cb5bce80b0bd542ea348db50c7e21834d934" + integrity sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg== + type-fest@^0.3.0: version "0.3.1" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.3.1.tgz#63d00d204e059474fe5e1b7c011112bbd1dc29e1" @@ -3830,11 +3821,11 @@ y18n@^4.0.0: integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== yaml@^1.7.2: - version "1.8.3" - resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.8.3.tgz#2f420fca58b68ce3a332d0ca64be1d191dd3f87a" - integrity sha512-X/v7VDnK+sxbQ2Imq4Jt2PRUsRsP7UcpSl3Llg6+NRRqWLIvxkMFYtH1FmvwNGYRKKPa+EPA4qDBlI9WVG1UKw== + version "1.9.2" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.9.2.tgz#f0cfa865f003ab707663e4f04b3956957ea564ed" + integrity sha512-HPT7cGGI0DuRcsO51qC1j9O16Dh1mZ2bnXwsi0jrSpsLz0WxOLSLXfkABVl6bZO629py3CU+OMJtpNHDLB97kg== dependencies: - "@babel/runtime" "^7.8.7" + "@babel/runtime" "^7.9.2" yargs-parser@13.1.2, yargs-parser@^13.1.2: version "13.1.2" @@ -3844,10 +3835,10 @@ yargs-parser@13.1.2, yargs-parser@^13.1.2: camelcase "^5.0.0" decamelize "^1.2.0" -yargs-parser@^18.1.1: - version "18.1.2" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.2.tgz#2f482bea2136dbde0861683abea7756d30b504f1" - integrity sha512-hlIPNR3IzC1YuL1c2UwwDKpXlNFBqD1Fswwh1khz5+d8Cq/8yc/Mn0i+rQXduu8hcrFKvO7Eryk+09NecTQAAQ== +yargs-parser@^18.1.3: + version "18.1.3" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0" + integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ== dependencies: camelcase "^5.0.0" decamelize "^1.2.0"