From a2e3a77a2f5f5e0123df2f050014d8214a7ecf9a Mon Sep 17 00:00:00 2001 From: Romain Deltour Date: Sat, 13 Nov 2021 12:54:32 +0100 Subject: [PATCH] feat: allow 'auto' value for the 'dir' attribute of Package Documents Fix #1220 --- .../com/adobe/epubcheck/schema/30/package-30.rnc | 2 +- .../package-document/attr-dir-auto-valid.opf | 16 ++++++++++++++++ .../resources/epub3/package-document.feature | 4 ++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 src/test/resources/epub3/files/package-document/attr-dir-auto-valid.opf diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/package-30.rnc b/src/main/resources/com/adobe/epubcheck/schema/30/package-30.rnc index ec9d24969..26aadf1c7 100644 --- a/src/main/resources/com/adobe/epubcheck/schema/30/package-30.rnc +++ b/src/main/resources/com/adobe/epubcheck/schema/30/package-30.rnc @@ -130,4 +130,4 @@ opf.id.attr = attribute id { datatype.ID } opf.i18n.attrs = opf.xml.lang.attr? & opf.dir.attr? opf.xml.lang.attr = attribute xml:lang { "" | datatype.string.nonempty } - opf.dir.attr = attribute dir { 'ltr' | 'rtl' } + opf.dir.attr = attribute dir { 'ltr' | 'rtl' | 'auto' } diff --git a/src/test/resources/epub3/files/package-document/attr-dir-auto-valid.opf b/src/test/resources/epub3/files/package-document/attr-dir-auto-valid.opf new file mode 100644 index 000000000..e97e80eea --- /dev/null +++ b/src/test/resources/epub3/files/package-document/attr-dir-auto-valid.opf @@ -0,0 +1,16 @@ + + + + Title + en + NOID + 2019-01-01T12:00:00Z + + + + + + + + diff --git a/src/test/resources/epub3/package-document.feature b/src/test/resources/epub3/package-document.feature index ffdccd656..9231ead9e 100644 --- a/src/test/resources/epub3/package-document.feature +++ b/src/test/resources/epub3/package-document.feature @@ -87,6 +87,10 @@ Feature: EPUB 3 ▸ Packages ▸ Package Document Checks Then error RSC-005 is reported 2 times (once for each ID) And no other errors or warnings are reported + Scenario: the 'dir' attribute value can be 'auto' + When checking file 'attr-dir-auto-valid.opf' + Then no errors or warnings are reported + Scenario: the 'xml:lang' attribute can be empty When checking file 'attr-lang-empty-valid.opf' Then no other errors or warnings are reported