From 7a2ab866099edffaba471ad808593f67ee796b21 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Thu, 17 Mar 2022 19:01:59 -0400 Subject: 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 --- dev/css-to-json-util.js | 12 +++++++----- dev/data/structured-content-overrides.css | 7 +++++++ 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'dev') 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); } } diff --git a/dev/data/structured-content-overrides.css b/dev/data/structured-content-overrides.css index 1d2ed830..9fd08f8f 100644 --- a/dev/data/structured-content-overrides.css +++ b/dev/data/structured-content-overrides.css @@ -54,3 +54,10 @@ border-width: 1px; border-color: currentColor; } +.gloss-link-text { + /* remove-rule */ +} +.gloss-link-external-icon { + display: none; + /* remove-property background-color vertical-align width height margin-left background-color position */ +} -- cgit v1.2.3