diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2022-03-17 19:01:59 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-17 19:01:59 -0400 |
commit | 7a2ab866099edffaba471ad808593f67ee796b21 (patch) | |
tree | ddfe746ed76e16d80e0ac6e3029e2bc1049544d2 /dev/css-to-json-util.js | |
parent | 8aa060337cea2bb8fce7864d509d07df4688f1c2 (diff) |
Structured content links (#2089)
* Update CSS to JSON converter to generalize the remove-property comment
* Fix navigation not being updated when _clearContent is run
* Add structured content schema for link tags
* Add test links
* Add external-link icon
* Pass Display instance to DisplayContentManager
* Update structured content generation
* Update link styles
Diffstat (limited to 'dev/css-to-json-util.js')
-rw-r--r-- | dev/css-to-json-util.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/dev/css-to-json-util.js b/dev/css-to-json-util.js index d6a9622c..71033f3a 100644 --- a/dev/css-to-json-util.js +++ b/dev/css-to-json-util.js @@ -90,8 +90,9 @@ function generateRules(cssFile, overridesCssFile) { const stylesheet1 = css.parse(content1, {}).stylesheet; const stylesheet2 = css.parse(content2, {}).stylesheet; - const removePropertyPattern = /^remove-property\s+([a-zA-Z0-9-]+)$/; + const removePropertyPattern = /^remove-property\s+([\w\W]+)$/; const removeRulePattern = /^remove-rule$/; + const propertySeparator = /\s+/; const rules = []; @@ -139,10 +140,11 @@ function generateRules(cssFile, overridesCssFile) { const comment = declaration.comment.trim(); let m; if ((m = removePropertyPattern.exec(comment)) !== null) { - const property = m[1]; - const removeCount = removeProperty(rules[index].styles, property, removedProperties); - if (removeCount === 0) { throw new Error(`Property removal is unnecessary; ${property} does not exist`); } - } else if ((m = removeRulePattern.exec(comment)) !== null) { + for (const property of m[1].split(propertySeparator)) { + const removeCount = removeProperty(rules[index].styles, property, removedProperties); + if (removeCount === 0) { throw new Error(`Property removal is unnecessary; ${property} does not exist`); } + } + } else if (removeRulePattern.test(comment)) { rules.splice(index, 1); } } |