From 3874ba82288624fc9f75ac61938bce56d7dcbf25 Mon Sep 17 00:00:00 2001 From: Kesara Rathnayake Date: Tue, 20 Feb 2024 10:23:38 +1300 Subject: [PATCH] fix: Allow non-ASCII values in all attributes 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..17ebd1cc 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 they are intentional.') if not (c.tag, a) in space_attributes: vv = v.strip() if vv != v: