From 557308ef1daf89ee9a847043ce21b7e5e9acc12e Mon Sep 17 00:00:00 2001 From: Tobias Fischer Date: Tue, 3 Jan 2017 16:07:52 +0100 Subject: [PATCH] issue a warning when landmarks anchors are not unique // refs #493 --- .../adobe/epubcheck/schema/30/epub-nav-30.sch | 17 +++++++-- .../adobe/epubcheck/nav/NavCheckerTest.java | 8 +++++ .../invalid/nav-landmarks-duplicates.xhtml | 35 +++++++++++++++++++ 3 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 src/test/resources/30/single/nav/invalid/nav-landmarks-duplicates.xhtml 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 2f9fb54f5..de8c558b7 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 @@ -24,8 +24,21 @@ - Missing epub:type attribute on anchor inside 'landmarks' nav - element + + + + + Missing epub:type attribute on anchor inside 'landmarks' nav element + + + WARNING: Duplicate 'a' elements with the same 'epub:type' and 'href' attributes inside 'landmarks' nav element diff --git a/src/test/java/com/adobe/epubcheck/nav/NavCheckerTest.java b/src/test/java/com/adobe/epubcheck/nav/NavCheckerTest.java index ce1b1cd47..39b3cd741 100644 --- a/src/test/java/com/adobe/epubcheck/nav/NavCheckerTest.java +++ b/src/test/java/com/adobe/epubcheck/nav/NavCheckerTest.java @@ -172,6 +172,14 @@ public void testValidateDocumentNavLandmarks002() testValidateDocument("invalid/nav-landmarks-002.xhtml"); } + @Test + public void testValidateDocumentNavLandmarksDuplicates() + { + // Multiple occurrences of the 'landmarks' nav element + Collections.addAll(expectedWarnings, MessageId.RSC_017, MessageId.RSC_017); + testValidateDocument("invalid/nav-landmarks-duplicates.xhtml"); + } + @Test public void testValidateDocumentNavNoPagelist001() { diff --git a/src/test/resources/30/single/nav/invalid/nav-landmarks-duplicates.xhtml b/src/test/resources/30/single/nav/invalid/nav-landmarks-duplicates.xhtml new file mode 100644 index 000000000..8cc9010d8 --- /dev/null +++ b/src/test/resources/30/single/nav/invalid/nav-landmarks-duplicates.xhtml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + +