Skip to content

Commit

Permalink
Auto-drop incorrect wrapping quotes in values (#1448)
Browse files Browse the repository at this point in the history
Pending resolution of speced/bikeshed#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.
  • Loading branch information
tidoust authored Jan 23, 2025
1 parent c62fdfe commit 34af0e4
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tools/drop-css-property-duplicates.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit 34af0e4

Please sign in to comment.