From 88e15ec99782be223814e8217773d46f5b95ff86 Mon Sep 17 00:00:00 2001 From: Romain Deltour Date: Fri, 9 Dec 2022 11:59:00 +0100 Subject: [PATCH] refactor: set 'hreflang' schema type to 'datatype.languagecode' This change is quite transparent and does not impact test, but makes the schema typing more consistent. Also adds a spec ref tag to the valid test case. Fix #1385 --- .../resources/com/adobe/epubcheck/schema/30/package-30.rnc | 4 ++-- .../epub3/05-package-document/package-document.feature | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) 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 26aadf1c7..050b4c46e 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 @@ -30,7 +30,7 @@ opf.property.attr = attribute property { datatype.property } opf.rel.attr = attribute rel { datatype.properties } - opf.hreflang.attr = attribute hreflang { "" | datatype.string.nonempty } + opf.hreflang.attr = attribute hreflang { "" | datatype.languagecode } opf.scheme.attr = attribute scheme { datatype.property } opf.refines.attr = attribute refines { datatype.URI } @@ -129,5 +129,5 @@ opf.href.attr = attribute href { datatype.URI } 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.xml.lang.attr = attribute xml:lang { "" | datatype.languagecode } opf.dir.attr = attribute dir { 'ltr' | 'rtl' | 'auto' } diff --git a/src/test/resources/epub3/05-package-document/package-document.feature b/src/test/resources/epub3/05-package-document/package-document.feature index cf9991e69..b03c3b1cd 100644 --- a/src/test/resources/epub3/05-package-document/package-document.feature +++ b/src/test/resources/epub3/05-package-document/package-document.feature @@ -361,7 +361,8 @@ Feature: EPUB 3 — Package document When checking file 'link-rel-record-properties-undefined-error.opf' Then error OPF-027 is reported And no other errors or warnings are reported - + + @spec @xref:sec-link-elem Scenario: the 'link' element can have an 'hreflang' attribute When checking file 'link-hreflang-valid.opf' Then no other errors or warnings are reported