Skip to content

Commit 34af0e4

Browse files
authored
Auto-drop incorrect wrapping quotes in values (#1448)
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.
1 parent c62fdfe commit 34af0e4

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tools/drop-css-property-duplicates.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,31 @@ async function dropCSSPropertyDuplicates(folder) {
228228
}
229229
}
230230

231+
// TEMP (2025-01-23): Auto-drop wrapping "''" in values of properties and
232+
// values. Shorthand syntax used to be supported by Bikeshed, but no longer
233+
// is starting with v5.0.0. Pending resolution of:
234+
// https://github.com/speced/bikeshed/issues/3011
235+
// ... or updates made to underlying specs:
236+
// css-color-5, css-color-4, css-easing-2, css-fonts-4, css-shapes-1
237+
for (const spec of index.results) {
238+
if (!spec.css) {
239+
continue;
240+
}
241+
for (const dfnType of ['properties', 'values']) {
242+
for (const prop of spec.css[dfnType]) {
243+
if (!prop.value) {
244+
continue;
245+
}
246+
const needsSaving = prop.value.match(/''/);
247+
if (needsSaving) {
248+
console.warn(`- Dropped wrapping quotes in definition of ${prop.name} in ${spec.shortname}`);
249+
prop.value = prop.value.replace(/''/g, '');
250+
spec.needsSaving = true;
251+
}
252+
}
253+
}
254+
}
255+
231256
function getBaseJSON(spec) {
232257
return {
233258
spec: {

0 commit comments

Comments
 (0)