2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-06-08 17:22:26 +03:00

feat(preset-html5): color tag #189, case insensitive tags #190 (#191)

* fix(preset-html5): add color tag #189

* fix(parser): case insensitive tags bug #190
This commit is contained in:
Nikolay Kost
2023-09-28 04:02:52 +03:00
committed by GitHub
parent 3bccca086f
commit 0c78831372
5 changed files with 58 additions and 2 deletions
+5 -2
View File
@@ -20,6 +20,9 @@ const parse = (input, opts = {}) => {
const options = opts;
const openTag = options.openTag || OPEN_BRAKET;
const closeTag = options.closeTag || CLOSE_BRAKET;
const onlyAllowTags = (options.onlyAllowTags || [])
.filter(Boolean)
.map((tag) => tag.toLowerCase());
let tokenizer = null;
@@ -83,8 +86,8 @@ const parse = (input, opts = {}) => {
* @return {boolean}
*/
const isAllowedTag = (value) => {
if (options.onlyAllowTags && options.onlyAllowTags.length) {
return options.onlyAllowTags.indexOf(value) >= 0;
if (onlyAllowTags.length) {
return onlyAllowTags.indexOf(value.toLowerCase()) >= 0;
}
return true;