From fb94c24043b9f7db8f5e9a9c0c64faaf95cc88ed Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 9 Jan 2024 13:27:10 -0400 Subject: validators: junk whitespace refactor and additions --- src/data/things/validators.js | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/data/things/validators.js b/src/data/things/validators.js index f991036..d02e5f2 100644 --- a/src/data/things/validators.js +++ b/src/data/things/validators.js @@ -408,19 +408,21 @@ export const validateAllPropertyValues = (validator) => [validateProperties.validateOtherKeys]: validator, }); +const illeaglInvisibleSpace = { + action: 'delete', +}; + +const illegalVisibleSpace = { + action: 'replace', + with: ' ', + withAnnotation: `normal space`, +}; + const illegalContentSpec = [ - { - illegal: '\u200b', - action: 'delete', - annotation: `zero-width space`, - }, - { - illegal: '\xa0', - action: 'replace', - with: ' ', - annotation: `non-breaking space`, - withAnnotation: `normal space`, - }, + {illegal: '\u200b', annotation: `zero-width space`, ...illeaglInvisibleSpace}, + {illegal: '\u2005', annotation: `four-per-em space`, ...illegalVisibleSpace}, + {illegal: '\u205f', annotation: `medium mathematical space`, ...illegalVisibleSpace}, + {illegal: '\xa0', annotation: `non-breaking space`, ...illegalVisibleSpace}, ]; for (const entry of illegalContentSpec) { -- cgit 1.3.0-6-gf8a5