From 27ea6ef6c3588a7e3fc59f508a4d4ca18ea36f1d Mon Sep 17 00:00:00 2001 From: Francois Daoust Date: Thu, 23 Jan 2025 15:19:07 +0100 Subject: [PATCH] Auto-drop incorrect wrapping quotes in values Pending resolution of https://github.com/speced/bikeshed/issues/3011 or updates made to underlying specs, this adds a temporary mechanism to drop offending wrapping single quotes in the definitions of properties and values during data curation, so that we may publish a new version of `@webref/css` while the problem gets fixed. --- tools/drop-css-property-duplicates.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tools/drop-css-property-duplicates.js b/tools/drop-css-property-duplicates.js index fd4f15748500..0060aa4e3daa 100644 --- a/tools/drop-css-property-duplicates.js +++ b/tools/drop-css-property-duplicates.js @@ -228,6 +228,31 @@ async function dropCSSPropertyDuplicates(folder) { } } + // TEMP (2025-01-23): Auto-drop wrapping "''" in values of properties and + // values. Shorthand syntax used to be supported by Bikeshed, but no longer + // is starting with v5.0.0. Pending resolution of: + // https://github.com/speced/bikeshed/issues/3011 + // ... or updates made to underlying specs: + // css-color-5, css-color-4, css-easing-2, css-fonts-4, css-shapes-1 + for (const spec of index.results) { + if (!spec.css) { + continue; + } + for (const dfnType of ['properties', 'values']) { + for (const prop of spec.css[dfnType]) { + if (!prop.value) { + continue; + } + const needsSaving = prop.value.match(/''/); + if (needsSaving) { + console.warn(`- Dropped wrapping quotes in definition of ${prop.name} in ${spec.shortname}`); + prop.value = prop.value.replace(/''/g, ''); + spec.needsSaving = true; + } + } + } + } + function getBaseJSON(spec) { return { spec: {