Skip to content

Commit dd52fb4

Browse files
committed
build: Ignore useless VNU warning about times being mistyped
1 parent 19822df commit dd52fb4

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

se/se_epub_build.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,10 +1344,12 @@ def _run_epubcheck(self, work_compatible_epub_dir: Path) -> None:
13441344
vnu_dom = se.easy_xml.EasyXmlTree(stdout.read().decode().strip())
13451345

13461346
# The Nu Validator will return errors for epub-specific attributes (like `epub:prefix` and `epub:type`) because they're not defined in the XHTML5 spec. So, we simply filter out those errors.
1347-
# We also filter out `section lacks heading` messages, because they are warnings and we may have sections without headings (like dedications, frontispieces).
1348-
# Also filter out warnings about potentially bad values for datetimes, which are raised for years < 1000. This can occur in works like _Omega_ by Camille Flammarion.
1349-
# Also filter out errors about `<p>` being a child of `<hgroup>`. The spec changed but our current VNU version has not caught up.
1350-
messages = vnu_dom.xpath("/messages/*[not(re:test(./message, '^(Attribute (prefix|type) not allowed|(Section|Article) lacks heading.|Potentially bad value.+datetime|Element p not allowed as child of element hgroup in this context.)'))]")
1347+
# Also filter out:
1348+
# - `section lacks heading` messages, because they are warnings and we may have sections without headings (like dedications, frontispieces).
1349+
# - Warnings about potentially bad values for datetimes, which are raised for years < 1000. This can occur in works like _Omega_ by Camille Flammarion.
1350+
# - Errors about `<p>` being a child of `<hgroup>`. The spec changed but our current VNU version has not caught up.
1351+
# - `Year may be mistyped.` errors, because they are warnings about incorrect years, which may be correct for far-future sci fi (like `AD <time>4000</time>`).
1352+
messages = vnu_dom.xpath("/messages/*[not(re:test(./message, '^(Attribute (prefix|type) not allowed|(Section|Article) lacks heading\\.|Potentially bad value.+datetime|Element p not allowed as child of element hgroup in this context\\.|Double-check the text content of element.+Year may be mistyped\\.)'))]")
13511353

13521354
for message in messages:
13531355
message_text = message.xpath("./message")[0].inner_xml()

0 commit comments

Comments
 (0)