From 3c8dab363161be9e7f074d09fe9bba59425b3d39 Mon Sep 17 00:00:00 2001 From: Romain Deltour Date: Fri, 21 Apr 2023 17:09:16 +0200 Subject: [PATCH] fix: allow nav items containing multiple images A bug in the Schematron XPath expressions caused a fatal error to be reported when nav doc items contained multiple images. This commit fix the relevant expressions by using the `string-join` function instead of `concat`, allowing to join arbitrary sequences of text nodes. Fix #1476 --- .../schema/30/edupub/edu-structure.sch | 4 ++-- .../adobe/epubcheck/schema/30/epub-nav-30.sch | 6 +++--- ...ontent-model-a-multiple-images-valid.xhtml | 14 +++++++++++++ ...model-li-label-multiple-images-valid.xhtml | 20 +++++++++++++++++++ .../navigation-document.feature | 10 ++++++++++ 5 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 src/test/resources/epub3/07-navigation-document/files/content-model-a-multiple-images-valid.xhtml create mode 100644 src/test/resources/epub3/07-navigation-document/files/content-model-li-label-multiple-images-valid.xhtml diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/edupub/edu-structure.sch b/src/main/resources/com/adobe/epubcheck/schema/30/edupub/edu-structure.sch index 494c29ef9..3f55f8092 100644 --- a/src/main/resources/com/adobe/epubcheck/schema/30/edupub/edu-structure.sch +++ b/src/main/resources/com/adobe/epubcheck/schema/30/edupub/edu-structure.sch @@ -35,7 +35,7 @@ More than one ranked heading found as direct descendant of body. - Empty ranked heading detected. + Empty ranked heading detected. The value of the "aria-label" attribute must not be the same as the content of the heading. @@ -53,7 +53,7 @@ More than one ranked heading found as direct descendant of . - Empty ranked heading detected. + Empty ranked heading detected. The value of the "aria-label" attribute must not be the same as the content of the heading. diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/epub-nav-30.sch b/src/main/resources/com/adobe/epubcheck/schema/30/epub-nav-30.sch index e9856ee53..a32720abb 100644 --- a/src/main/resources/com/adobe/epubcheck/schema/30/epub-nav-30.sch +++ b/src/main/resources/com/adobe/epubcheck/schema/30/epub-nav-30.sch @@ -47,7 +47,7 @@ Anchors within nav elements must contain text @@ -55,7 +55,7 @@ Spans within nav elements must contain text @@ -72,7 +72,7 @@ Heading elements must contain text diff --git a/src/test/resources/epub3/07-navigation-document/files/content-model-a-multiple-images-valid.xhtml b/src/test/resources/epub3/07-navigation-document/files/content-model-a-multiple-images-valid.xhtml new file mode 100644 index 000000000..71bd0b1a0 --- /dev/null +++ b/src/test/resources/epub3/07-navigation-document/files/content-model-a-multiple-images-valid.xhtml @@ -0,0 +1,14 @@ + + + + + Minimal Nav + + + + + diff --git a/src/test/resources/epub3/07-navigation-document/files/content-model-li-label-multiple-images-valid.xhtml b/src/test/resources/epub3/07-navigation-document/files/content-model-li-label-multiple-images-valid.xhtml new file mode 100644 index 000000000..c8aef1699 --- /dev/null +++ b/src/test/resources/epub3/07-navigation-document/files/content-model-li-label-multiple-images-valid.xhtml @@ -0,0 +1,20 @@ + + + + + Minimal Nav + + + + + diff --git a/src/test/resources/epub3/07-navigation-document/navigation-document.feature b/src/test/resources/epub3/07-navigation-document/navigation-document.feature index aadd65907..8dca377ed 100644 --- a/src/test/resources/epub3/07-navigation-document/navigation-document.feature +++ b/src/test/resources/epub3/07-navigation-document/navigation-document.feature @@ -63,6 +63,11 @@ Feature: EPUB 3 — Navigation Document Then error RSC-005 is reported And the message contains 'Spans within nav elements must contain text' And no other errors or warnings are reported + + Scenario: Allow multiple images in a list item label + Given EPUBCheck configured to check a navigation document + When checking document 'content-model-li-label-multiple-images-valid.xhtml' + Then no errors or warnings are reported @spec @xref:sec-nav-def-model Scenario: Report a leaf list item with no link (just a span label) @@ -79,6 +84,11 @@ Feature: EPUB 3 — Navigation Document Then error RSC-005 is reported And the message contains 'Anchors within nav elements must contain text' And no other errors or warnings are reported + + Scenario: Allow multiple images in a nav hyperlink + Given EPUBCheck configured to check a navigation document + When checking document 'content-model-a-multiple-images-valid.xhtml' + Then no errors or warnings are reported @spec @xref:sec-nav-def-model Scenario: Report a nav hyperlink without content (but an empty nested span)