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

fix: do not require the Navigation Document to have an index #1210

Merged
merged 1 commit into from
Feb 26, 2021
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
11 changes: 5 additions & 6 deletions src/main/java/com/adobe/epubcheck/nav/NavChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ public class NavChecker implements ContentChecker, DocumentValidator
@SuppressWarnings("unchecked")
private final static ValidatorMap validatorMap = ValidatorMap.builder()
.putAll(XMLValidators.NAV_30_RNC, XMLValidators.XHTML_30_SCH, XMLValidators.NAV_30_SCH)
.putAll(and(Predicates.or(profile(EPUBProfile.EDUPUB), hasPubType(OPFData.DC_TYPE_EDUPUB)),
not(
hasProp(EpubCheckVocab.VOCAB.get(EpubCheckVocab.PROPERTIES.FIXED_LAYOUT))),
.putAll(
and(Predicates.or(profile(EPUBProfile.EDUPUB), hasPubType(OPFData.DC_TYPE_EDUPUB)),
not(hasProp(EpubCheckVocab.VOCAB.get(EpubCheckVocab.PROPERTIES.FIXED_LAYOUT))),
not(hasProp(EpubCheckVocab.VOCAB.get(EpubCheckVocab.PROPERTIES.NON_LINEAR)))),
XMLValidators.XHTML_EDUPUB_STRUCTURE_SCH, XMLValidators.XHTML_EDUPUB_SEMANTICS_SCH,
XMLValidators.XHTML_IDX_SCH)
Expand All @@ -61,10 +61,9 @@ public class NavChecker implements ContentChecker, DocumentValidator
mimetype("application/xhtml+xml"), version(EPUBVersion.VERSION_3)),
XMLValidators.XHTML_DICT_SCH)
.putAll(
and(or(profile(EPUBProfile.IDX), hasPubType(OPFData.DC_TYPE_INDEX),
hasProp(PackageVocabs.ITEM_VOCAB.get(PackageVocabs.ITEM_PROPERTIES.INDEX)),
and(or(hasProp(PackageVocabs.ITEM_VOCAB.get(PackageVocabs.ITEM_PROPERTIES.INDEX)),
hasProp(EpubCheckVocab.VOCAB.get(EpubCheckVocab.PROPERTIES.IN_INDEX_COLLECTION))),
mimetype("application/xhtml+xml"), version(EPUBVersion.VERSION_3)),
mimetype("application/xhtml+xml"), version(EPUBVersion.VERSION_3)),
XMLValidators.XHTML_IDX_SCH, XMLValidators.XHTML_IDX_INDEX_SCH)
.build();

Expand Down
9 changes: 1 addition & 8 deletions src/test/resources/epub-indexes/indexes-publication.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ Feature: EPUB Indexes ▸ Full Publication Checks
When checking EPUB 'index-whole-pub-content-model-error'
Then error RSC-005 is reported
And the message contains 'An "index" must contain one and only one "index-entry-list"'
# FIXME #1122 this error shouldn’t be reported on the Nav Doc
Then error RSC-005 is reported
And the message contains 'At least one "index" element must be present in a document declared as an index in the OPF'
And no other errors or warnings are reported

Scenario: Report a single-file index with an invalid content model
Expand All @@ -47,16 +44,12 @@ Feature: EPUB Indexes ▸ Full Publication Checks
Scenario: Verify an index publication
Given EPUBCheck configured with the 'idx' profile
When checking EPUB 'index-whole-pub-valid'
# FIXME #1122 this error shouldn’t be reported on the Nav Doc
Then error RSC-005 is reported
And the message contains 'At least one "index" element must be present in a document declared as an index in the OPF'
And no other errors or warnings are reported

Scenario: Report an index publication without an index
Given EPUBCheck configured with the 'idx' profile
When checking EPUB 'index-whole-pub-no-index-error'
# FIXME #1122 this error shouldn’t be reported on the Nav Doc
Then error RSC-005 is reported 2 times
Then error RSC-005 is reported
And the message contains 'At least one "index" element must be present in a document declared as an index in the OPF'
And no other errors or warnings are reported

Expand Down