From 20a5b30d9e08bd21184335fb12918ed0d4fe7c4c Mon Sep 17 00:00:00 2001 From: Kesara Rathnayake Date: Wed, 21 Feb 2024 13:09:46 +1300 Subject: [PATCH] fix: Allow non-ASCII values in all attributes (#1106) PR #1017 allowed Unicord characters everywhere. This fixes a bug that xml2rfc was guarding against non-ASCII characters in attribute values. With `--warn-bare-unicode`, xml2rfc will warn if non-ASCII characters are present in attribute values. Fixes #1105 --- xml2rfc/writers/preptool.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xml2rfc/writers/preptool.py b/xml2rfc/writers/preptool.py index 2d27b26e..4722d721 100644 --- a/xml2rfc/writers/preptool.py +++ b/xml2rfc/writers/preptool.py @@ -439,9 +439,9 @@ def check_attribute_values(self, e, p): if (c.tag, a) in latinscript_attributes: if not is_script(v, 'Latin'): self.err(c, 'Found non-Latin-script content in <%s> attribute value %s="%s"' % (c.tag, a, v)) - else: + if self.options.warn_bare_unicode: if not isascii(v): - self.err(c, 'Found non-ASCII content in <%s> attribute value %s="%s"' % (c.tag, a, v)) + self.warn(c, f'Found non-ASCII content in {c.tag} attribute value {a}="{v}" that should be inspected to ensure it is intentional.') if not (c.tag, a) in space_attributes: vv = v.strip() if vv != v: