From 4580ba0ce0812be17278233f98799282b3548bc3 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Sat, 19 Feb 2022 17:57:34 +0100 Subject: [PATCH] Add error suppression --- Models/ThemeConfig/Conversion/Validation.ts | 17 ++++++++++++++--- assets/themes/uk_addresses/uk_addresses.json | 1 + 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Models/ThemeConfig/Conversion/Validation.ts b/Models/ThemeConfig/Conversion/Validation.ts index bcdb3902d..e7624b0dc 100644 --- a/Models/ThemeConfig/Conversion/Validation.ts +++ b/Models/ThemeConfig/Conversion/Validation.ts @@ -289,22 +289,33 @@ export class DetectMappingsWithImages extends DesugaringStep=0 const images = Utils.Dedup(Translations.T(mapping.then).ExtractImages()) + const ctx = `${context}.mappings[${i}]` if (images.length > 0) { - warnings.push(context + ".mappings[" + i + "]: A mapping has an image in the 'then'-clause. Remove the image there and use `\"icon\": ` instead. The images found are "+images.join(", ")) + if(!ignore){ + errors.push(`${ctx}: A mapping has an image in the 'then'-clause. Remove the image there and use \`"icon": \` instead. The images found are ${images.join(", ")}. (Ignore this warning by adding "#": "${ignoreToken}" to the mapping`) + }else{ + information.push(`${ctx}: Ignored images in then`) + } + }else if (ignore){ + warnings.push(`${ctx}: unused '${ignoreToken}' - please remove this`) } } return { - warnings, + errors,warnings,information, result: json }; } diff --git a/assets/themes/uk_addresses/uk_addresses.json b/assets/themes/uk_addresses/uk_addresses.json index 6efb7ccdb..4a46793bf 100644 --- a/assets/themes/uk_addresses/uk_addresses.json +++ b/assets/themes/uk_addresses/uk_addresses.json @@ -239,6 +239,7 @@ }, "mappings": [ { + "#": "ignore-image-in-then", "if": "addr:substreet~*", "then": "
The envelope below shows the address that we have recorded. You can change this by answering any remaining questions above, or by clicking the pencil icons below. We do not need you to provide a recipient's name or any of the parts shown in [blue].
{addr:unit} {addr:housename}
{addr:housenumber} {addr:substreet}
{addr:street}
{addr:parentstreet}
[Suburb]
[Town]
[Postal code]
" }