Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: revert the spine/toc nav order check to a WARNING #1056

Merged
merged 2 commits into from
Jul 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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