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