Skip to content

Commit

Permalink
feat: revert the spine/toc nav order check to a WARNING (#1056)
Browse files Browse the repository at this point in the history
* feat: revert the spine/toc nav order check to a WARNING

As agreed on the 2019-07-11 EPUB CG call:
https://www.w3.org/2019/07/11-epub3cg-minutes.html

- changes the behavior introduced in #999
- adds an INFO message about NAV_011 being subject to change

Fixes #1036
  • Loading branch information
rdeltour authored Jul 17, 2019
1 parent ead7480 commit 1f6a882
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ private void initialize()
{
return;
}
// Info
severities.put(MessageId.INF_001, Severity.INFO);

// Accessibility
severities.put(MessageId.ACC_001, Severity.USAGE);
Expand Down Expand Up @@ -154,7 +156,7 @@ private void initialize()
severities.put(MessageId.NAV_008, Severity.USAGE);
severities.put(MessageId.NAV_009, Severity.ERROR);
severities.put(MessageId.NAV_010, Severity.ERROR);
severities.put(MessageId.NAV_011, Severity.ERROR);
severities.put(MessageId.NAV_011, Severity.WARNING);

// NCX
severities.put(MessageId.NCX_001, Severity.ERROR);
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/adobe/epubcheck/messages/MessageId.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@

public enum MessageId implements Comparable<MessageId>
{
// General info messages
INF_001("INF-001"),

// Messages relating to accessibility
ACC_001("ACC-001"),
ACC_002("ACC-002"),
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/adobe/epubcheck/opf/XRefChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,8 @@ private void checkReadingOrder(Queue<Reference> references, int lastSpinePositio
report.message(MessageId.NAV_011,
EPUBLocation.create(ref.source, ref.lineNumber, ref.columnNumber),
(ref.type == Type.NAV_TOC_LINK) ? "toc" : "page-list", ref.value, orderContext);
report.message(MessageId.INF_001,
EPUBLocation.create(ref.source, ref.lineNumber, ref.columnNumber), "ERROR", "https://github.com/w3c/publ-epub-revision/issues/1283");
lastSpinePosition = targetSpinePosition;
lastAnchorPosition = -1;
}
Expand All @@ -570,6 +572,8 @@ private void checkReadingOrder(Queue<Reference> references, int lastSpinePositio
report.message(MessageId.NAV_011,
EPUBLocation.create(ref.source, ref.lineNumber, ref.columnNumber),
(ref.type == Type.NAV_TOC_LINK) ? "toc" : "page-list", ref.value, orderContext);
report.message(MessageId.INF_001,
EPUBLocation.create(ref.source, ref.lineNumber, ref.columnNumber), "ERROR", "https://github.com/w3c/publ-epub-revision/issues/1283");
}
lastAnchorPosition = targetAnchorPosition;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# This is the default MessageBundle.properties file

#Info
INF_001=The previous rule is under review and may change to an '%1$s' in a future release. See the discussion at %2$s

#Accessibility
ACC_001='img' or 'area' HTML element has no 'alt' attribute.
ACC_002='input' HTML element is not referenced by a corresponding label element.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,17 @@ public void testValidateNav_TocInReadingOrder()
public void testValidateNav_TocWrongOrderInSpine()
{
// test that toc nav links MUST be in spine order
expectedErrors.add(MessageId.NAV_011);
expectedWarnings.add(MessageId.NAV_011);
expectedInfos.add(MessageId.INF_001);
testValidateDocument("invalid/nav-toc-unordered-spine");
}

@Test
public void testValidateNav_TocWrongOrderOfFragments()
{
// test that toc nav links MUST be in document order
expectedErrors.addAll(Collections.nCopies(2, MessageId.NAV_011));
expectedWarnings.addAll(Collections.nCopies(2, MessageId.NAV_011));
expectedInfos.add(MessageId.INF_001);
testValidateDocument("invalid/nav-toc-unordered-fragments");
}

Expand All @@ -236,15 +238,17 @@ public void testValidateNav_PageListInReadingOrder()
public void testValidateNav_PageListWrongOrderInSpine()
{
// test that page-list nav links MUST be in spine order
expectedErrors.add(MessageId.NAV_011);
expectedWarnings.add(MessageId.NAV_011);
expectedInfos.add(MessageId.INF_001);
testValidateDocument("invalid/nav-page-list-unordered-spine");
}

@Test
public void testValidateNav_PageListWrongOrderOfFragments()
{
// test that page-list nav links MUST be in document order
expectedErrors.add(MessageId.NAV_011);
expectedWarnings.add(MessageId.NAV_011);
expectedInfos.add(MessageId.INF_001);
testValidateDocument("invalid/nav-page-list-unordered-fragments");
}

Expand Down

0 comments on commit 1f6a882

Please sign in to comment.