-
Notifications
You must be signed in to change notification settings - Fork 402
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement Structure Semantics Vocab changes for EPUB 3.2
Fix #531, Fix #903, Fix #962, Fix #963 New messages: - `OPF-086` (`WARNING`) is reported when a deprecated property is used (e.g. in an `epub:type` attribute). - `OPF_086_SUG.<property-name>` messages store the suggested replacement for deprecated properties. - `OPF-087` (`ERROR`) is reported when a disallowed property is used (e.g. `epub:type` properties disallowed in an XHTML context). - `OPF-088` (`USAGE`) is reported when an unprefixed property isn't recognized as defined in the EPUB Structural Semantics Vocabulary. EPUB Structural Semantics Vocabulary changes: - recognize the new properties `endnote`, `endnotes`, and `tip`. - deprecate the properties `annoref`, `annotation`, `help`, `marginalia`, `note`, `rearnote`, `rearnotes`, `sidebar`, `subchapter`, and `warning`. - disallow on XHTML Content Documents the properties `figure`, `list`, `list-item`, table`, `table-cell`, and `table-row`. Internal Vocabulary changes: - new unchecked vocab `PRISM_VOCAB` in the `ForeignVocabs` collection - new vocab `MagazineNavigationVocab`, currently as an unchecked vocab - new unchecked vocab `UNCHECKED_VOCAB` in `StructureVocab`, associated to the SSV URI, to accept properties undefined in the SSV. - update the `EPUB_TYPES` StructureVocab to set the deprecate/disallowed status its properties - register the reserved prefixes `msv` and `prism` as unchecked vocabs in Content Documents - allow undefined properties in `epub:type` (by adding the SSV unchecked vocab to the default aggregated vocab) Internal API changes: - in the `Property` class: - new method `getVocabURI` to get the URI string of the vocab where the property is defined - new method `isDeprecated` to get if the property is deprecated. - new method `isAllowed(Validation context)` to get if the property is allowed in the given validation context. - new interface `PropertyStatus` - holds the deprecated/disallowed status of a property, as getter methods - provides static implementations for 'allowed', 'deprecated', and 'disallowed on Content Documents'. - in the `VocabUtil` class: - the `parseProperty*` methods now use a `ValidationContext` parameter instead of a `Report` parameter, to be allowed to query the allowed state of properties from the context. - the `parserProperty*` methods will now report `OPF_086` and `OPF_087` for deprecated and disallowed properties (resp.). - in the `LocalizedMessages` class: - the method `getSuggestion(String id)` is now public - a new method `getSuggestion(String id, String key)` is available to get a keyed suggestion string for a specific message ID. - new `ThrowingResourceProvider` class, implementing `GenericResourceProvider` to always throw an exception, to be used in tests. Tests changes: - renamed and add new tests for `epub:type` attribute values - remove instances of deprecated `epub:type` properties in other tests
- Loading branch information
Showing
52 changed files
with
784 additions
and
368 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/main/java/com/adobe/epubcheck/util/ThrowingResourceProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.adobe.epubcheck.util; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
|
||
public final class ThrowingResourceProvider implements GenericResourceProvider | ||
{ | ||
|
||
@Override | ||
public InputStream getInputStream(String path) | ||
throws IOException | ||
{ | ||
throw new IOException(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/main/java/com/adobe/epubcheck/vocab/MagazineNavigationVocab.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.adobe.epubcheck.vocab; | ||
|
||
public final class MagazineNavigationVocab | ||
{ | ||
public static final String PREFIX = "msv"; | ||
public static final String URI = "http://www.idpf.org/epub/vocab/structure/magazine/#"; | ||
public static final Vocab VOCAB = new UncheckedVocab(URI, PREFIX); | ||
|
||
|
||
private MagazineNavigationVocab() | ||
{ | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.