Skip to content

Commits on Source 4

......@@ -12,7 +12,8 @@ after_success: .travis/after_success.sh
branches:
only:
- master
- /^next\/.*$/
env:
global:
- secure: gcpUIktuajGHvn95bzMg9Nqay+kGAdKXWOosA6sQHvaK+KCsiP4nhAMX5rWUYvk3XnEs2WlfZUBO7/aDcpX4fjZozs8fHbVuSfftYP+4MIIhEI2FNEXp823EShSRB32cGmEkdUh7OQdv5zN8SEQNW9MJguLSvTkp2FGYEsV3x1g=
- secure: jMv0M898kWiSKiPaky7CpCcvC3QqzEWwauOsmx9WuRNLFO3e/tuM/bPx+06wWlBgy359uPlSFaOch4QFlDx/CTCLtIudpF7cx4Raej9F3yVdqLnT2/9W88Oi5Vxhak1Szs3MUmVWbIqd5ulf2jsV1hMHJVn2tg3i1KYqmFyQ7+A=
- secure: htnYzp+cwnjg16EIjlwuHAgmvuZsppHDVTcYiCfZwbs4hftw8OuU8uPBGOWrz2ESb9h5Loh+ohj0GivTKLOJBhbaYBMbIt8O0i7AJBJ8z9mj++zAzGUKiUZocXVN167vLK+2QIey5hp1qxc+zvsS8jaH2zavw+PKFlhMpv1U2Nk=
- secure: YcEadcDvwKlJJE5ETba+LWmqWTZ/vDfYRa2Ru8dn+2tigOsGHbZu+m3q7jn11rmN0wHSy+0lSL4usp7l+Ei1kXNjvm13+GTvSBpAuga6/kY3c50R1Xr4UQ3GuaLCGsJ9wnEp4OZ4FXRucY2yDN+FTd5ZTD/nl8T63gthqXchR+o=
#!/bin/bash
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
if [[ "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_JOB_NUMBER" == *.1 ]]; then
mvn deploy -DskipTests -Dinvoker.skip=true
else
echo "Skipping Maven deploy."
......
# EPUBCheck change log
<a name="4.1.0"></a>
## [4.1.0](https://github.com/w3c/epubcheck/compare/v4.0.2...v4.1.0) (2018-11-26)
<a name="4.2.2"></a>
# [4.2.2](https://github.com/w3c/epubcheck/compare/v4.2.1...v4.2.2) (2019-07-18)
This is the latest **production-ready** release of EPUBCheck, which provides complete support for checking conformance to the [EPUB 3.2](https://w3c.github.io/publ-epub-revision/epub32/spec/epub-spec.html) family of specifications.
Version 4.2.2 is a maintenance release which reverts the `toc` navigation order check to a mere `WARNING` (it was previously an `ERROR`), following the [recent EPUB CG discussion](https://www.w3.org/2019/07/11-epub3cg-minutes.html). It also includes new translations, notably for Traditional Chinese (thank you @davidmaxlee!).
This release was made by the DAISY Consortium, for the W3C. Many thanks to everyone who contributed!
This EPUBCheck version is also available in the Maven Central Repository as [`org.w3c:epubcheck:4.2.2`](https://search.maven.org/artifact/org.w3c/epubcheck/4.2.2/jar).
### Localization
* complete translation for Traditional Chinese (+ Danish/German/Korean tweaks) ([#1058](https://github.com/w3c/epubcheck/issues/1058)) ([64558be](https://github.com/w3c/epubcheck/commit/64558be)), closes [#1054](https://github.com/w3c/epubcheck/issues/1054)
### Features
* revert the spine/toc nav order check to a `WARNING` ([#1056](https://github.com/w3c/epubcheck/issues/1056)) ([1f6a882](https://github.com/w3c/epubcheck/commit/1f6a882)), closes [#1036](https://github.com/w3c/epubcheck/issues/1036)
<a name="4.2.1"></a>
## [4.2.1](https://github.com/w3c/epubcheck/compare/v4.2.0...v4.2.1) (2019-05-20)
### Bug Fixes
* allow `doc-endnote` on `li` children of `ol` ([275fcd1](https://github.com/w3c/epubcheck/commit/275fcd1)), closes [#1041](https://github.com/w3c/epubcheck/issues/1041)
* update schemas from upstream HTML Checker ([4d5a24d](https://github.com/w3c/epubcheck/commit/4d5a24d))
<a name="4.2.0"></a>
## [4.2.0](https://github.com/w3c/epubcheck/compare/v4.2.0-rc...v4.2.0) (2019-04-23)
### Bug Fixes
* allow any role on `a` elem with no `href` ([b9ed8f6](https://github.com/w3c/epubcheck/commit/b9ed8f6)), closes [#1022](https://github.com/w3c/epubcheck/issues/1022)
* check trailing spaces in mimetype file ([123c69f](https://github.com/w3c/epubcheck/commit/123c69f))
* remove restrictions on MathML annotation-xml ([8a1b650](https://github.com/w3c/epubcheck/commit/8a1b650)), closes [#1024](https://github.com/w3c/epubcheck/issues/1024)
* report ZIP checks after the 'Validating…' message ([73b0ee8](https://github.com/w3c/epubcheck/commit/73b0ee8)), closes [#1025](https://github.com/w3c/epubcheck/issues/1025)
### Features
* add new 'voicing' link relationship ([97e9f1c](https://github.com/w3c/epubcheck/commit/97e9f1c))
### Localization
* update localizedmessages for Danish, French, German, Italian, Japanese, Korean, and Spanish. ([2f0d1716](https://github.com/w3c/epubcheck/commit/2f0d1716))
<a name="4.2.0-rc"></a>
## [4.2.0-rc](https://github.com/w3c/epubcheck/compare/v4.2.0-beta...v4.2.0-rc) (2019-03-18)
### Bug Fixes
This is a maintenance release of EPUBCheck, the conformance validator for EPUB publications. It includes various improvements and bug fixes that have been contributed over the past two years.
* allow `epub:type` on all HTML elements ([2cafe64](https://github.com/w3c/epubcheck/commit/2cafe64)), closes [#986](https://github.com/w3c/epubcheck/issues/986)
* allow ARIA role `doc-glossary` on `section` elements ([0d9462f](https://github.com/w3c/epubcheck/commit/0d9462f)), closes [#997](https://github.com/w3c/epubcheck/issues/997)
* allow images to point to SVG fragments ([18afa9d](https://github.com/w3c/epubcheck/commit/18afa9d)), closes [#987](https://github.com/w3c/epubcheck/issues/987)
* ignore SVG view fragments when checking cross refs ([50b29f1](https://github.com/w3c/epubcheck/commit/50b29f1)), closes [#987](https://github.com/w3c/epubcheck/issues/987)
* localize singular/plurals variants in summary ([93b700f](https://github.com/w3c/epubcheck/commit/93b700f)), closes [#958](https://github.com/w3c/epubcheck/issues/958)
* parse CSS custom properties ([0036e93](https://github.com/w3c/epubcheck/commit/0036e93)), closes [#790](https://github.com/w3c/epubcheck/issues/790)
* report all `epub:type` value checks as `USAGE` ([f248483](https://github.com/w3c/epubcheck/commit/f248483)), closes [#1009](https://github.com/w3c/epubcheck/issues/1009)
* report duplicate landmarks nav entries as `ERROR` ([d7be97c](https://github.com/w3c/epubcheck/commit/d7be97c)), closes [#298](https://github.com/w3c/epubcheck/issues/298)
* revert FXL SVG rules to EPUB 3.0.1’s logic ([ced3c15](https://github.com/w3c/epubcheck/commit/ced3c15))
* revert the deprecation of `display-seq` ([f81d8b8](https://github.com/w3c/epubcheck/commit/f81d8b8)), closes [#990](https://github.com/w3c/epubcheck/issues/990)
* script data blocks don’t need to be declared ([05e5ac2](https://github.com/w3c/epubcheck/commit/05e5ac2))
* support ARIA global attributes in SVG ([56ebcd8](https://github.com/w3c/epubcheck/commit/56ebcd8)), closes [#846](https://github.com/w3c/epubcheck/issues/846)
This release was made by the DAISY Consortium, for the W3C.
### Features
* allow fonts to be remote resources ([4d5a5a9](https://github.com/w3c/epubcheck/commit/4d5a5a9)), closes [#871](https://github.com/w3c/epubcheck/issues/871) [#672](https://github.com/w3c/epubcheck/issues/672)
* allow remote resources in scripted content ([1c90ae9](https://github.com/w3c/epubcheck/commit/1c90ae9)), closes [#869](https://github.com/w3c/epubcheck/issues/869)
* check duplicate IDs in the OCF encryption file ([cab45e6](https://github.com/w3c/epubcheck/commit/cab45e6)), closes [#306](https://github.com/w3c/epubcheck/issues/306)
* check image sources in `picture` and `srcset` ([11bf628](https://github.com/w3c/epubcheck/commit/11bf628)), closes [#781](https://github.com/w3c/epubcheck/issues/781)
* check that toc & page-list nav are in reading order ([8ba384f](https://github.com/w3c/epubcheck/commit/8ba384f)), closes [#888](https://github.com/w3c/epubcheck/issues/888)
* disallow remote links in toc/landmarks/page-list nav ([dd0805f](https://github.com/w3c/epubcheck/commit/dd0805f)), closes [#890](https://github.com/w3c/epubcheck/issues/890)
* report use of non-preferred Core Media Types ([ab13779](https://github.com/w3c/epubcheck/commit/ab13779)), closes [#873](https://github.com/w3c/epubcheck/issues/873)
### Localization
* new localization: Danish ([28ef69b](https://github.com/w3c/epubcheck/commit/28ef69b), [40f7b64](https://github.com/w3c/epubcheck/commit/40f7b64))
* new localization: Chinese (Taiwan) ([46195ad](https://github.com/w3c/epubcheck/commit/46195ad))
* update localized messages for German ([40f7b64](https://github.com/w3c/epubcheck/commit/40f7b64))
* update localized messages for Italian ([d954ae7](https://github.com/w3c/epubcheck/commit/d954ae7), [864282a](https://github.com/w3c/epubcheck/commit/864282a))
Note: the new messages introduced in v4.2.0 are _not_ localized yet.
<a name="4.2.0-beta"></a>
## [4.2.0-beta](https://github.com/w3c/epubcheck/compare/v4.1.1...v4.2.0-beta) (2019-02-25)
### Bug Fixes
* allow foreign namespaces in SVG content documents ([ca29c89](https://github.com/w3c/epubcheck/commit/ca29c89)), closes [#491](https://github.com/w3c/epubcheck/issues/491)
* do not restrict ID refs to non-colon names ([365e6e6](https://github.com/w3c/epubcheck/commit/365e6e6)), closes [#783](https://github.com/w3c/epubcheck/issues/783)
* improve RelaxNG datatypes of date/time/duration attributes ([ef5b94c](https://github.com/w3c/epubcheck/commit/ef5b94c)), closes [#775](https://github.com/w3c/epubcheck/issues/775)
* parse boolean/enumerated HTML attributes as case-insensitive ([5b3533a](https://github.com/w3c/epubcheck/commit/5b3533a)), closes [#941](https://github.com/w3c/epubcheck/issues/941)
### Features
* add `application/javascript` as core media type ([f4566b6](https://github.com/w3c/epubcheck/commit/f4566b6)), closes [#874](https://github.com/w3c/epubcheck/issues/874)
* add new MO-only `aside` epub:type value ([4404fff](https://github.com/w3c/epubcheck/commit/4404fff))
* allow the `Compression` element in the encryption file ([ed6f1c4](https://github.com/w3c/epubcheck/commit/ed6f1c4)), closes [#904](https://github.com/w3c/epubcheck/issues/904)
* basic schema support for HTML custom elements ([356fac0](https://github.com/w3c/epubcheck/commit/356fac0)), closes [#932](https://github.com/w3c/epubcheck/issues/932)
* implement Structure Semantics Vocab changes for EPUB 3.2 ([3454da5](https://github.com/w3c/epubcheck/commit/3454da5)), closes [#531](https://github.com/w3c/epubcheck/issues/531) [#903](https://github.com/w3c/epubcheck/issues/903) [#962](https://github.com/w3c/epubcheck/issues/962) [#963](https://github.com/w3c/epubcheck/issues/963)
* improve wording of message OPF-025 ([cecaa76](https://github.com/w3c/epubcheck/commit/cecaa76)), closes [#959](https://github.com/w3c/epubcheck/issues/959)
* remove `epubsc` from reserved prefixes ([02397ec](https://github.com/w3c/epubcheck/commit/02397ec)), closes [#875](https://github.com/w3c/epubcheck/issues/875)
* report CSS absolute/fixed positioning as USAGE ([672ac6d](https://github.com/w3c/epubcheck/commit/672ac6d)), closes [#889](https://github.com/w3c/epubcheck/issues/889)
* set reported 3.x version to "3.2" ([9965c19](https://github.com/w3c/epubcheck/commit/9965c19)), closes [#943](https://github.com/w3c/epubcheck/issues/943)
* support new rules related to FXL SVG sizing ([17f5eee](https://github.com/w3c/epubcheck/commit/17f5eee)), closes [#902](https://github.com/w3c/epubcheck/issues/902)
* suppress a couple irrelevant USAGE reports ([b342db2](https://github.com/w3c/epubcheck/commit/b342db2))
* update Jing (schema processor) to v20181222 ([cfca41b](https://github.com/w3c/epubcheck/commit/cfca41b))
* update Package vocabularies and link element checks ([99f882a](https://github.com/w3c/epubcheck/commit/99f882a)), closes [#883](https://github.com/w3c/epubcheck/issues/883) [#884](https://github.com/w3c/epubcheck/issues/884) [#885](https://github.com/w3c/epubcheck/issues/885) [#886](https://github.com/w3c/epubcheck/issues/886) [#887](https://github.com/w3c/epubcheck/issues/887)
* update recognized font Core Media types ([ac2f1bd](https://github.com/w3c/epubcheck/commit/ac2f1bd)), closes [#872](https://github.com/w3c/epubcheck/issues/872) [#339](https://github.com/w3c/epubcheck/issues/339)
* update the HTML schemas to the latest Nu HTML Checker version ([8d3c77e](https://github.com/w3c/epubcheck/commit/8d3c77e))
<a name="4.2.0-alpha-1"></a>
## [4.2.0-alpha-1](https://github.com/w3c/epubcheck/compare/v4.1.0...v4.2.0-alpha-1) (2019-01-14)
Many thanks to the various people who contributed to this release, including @bitsgalore, @kalaspuffar, @kamorrissey, @matthew-macgregor, @mkraetke, @murata2makoto, @takahashim, @tledoux… and especially Tobias Fischer (@tofi86), who has been the primary project maintainer after v4.0.2 and before the DAISY Consortium took over the maintenance role in October 2018!
### Bug Fixes
* check MathML and XHTML content in epub:switch ([976b9f6](https://github.com/w3c/epubcheck/commit/976b9f6)), closes [#835](https://github.com/w3c/epubcheck/issues/835)
* messages of missing/incorrect locale cannot be translated ([91fac12](https://github.com/w3c/epubcheck/commit/91fac12))
### Features
* add 'authority' and 'term' as valid package metadata properties ([2fe66cd](https://github.com/w3c/epubcheck/commit/2fe66cd))
* allow missing `alttext` or `annotation-xml` on MathML ([e7bdbd2](https://github.com/w3c/epubcheck/commit/e7bdbd2)), closes [#897](https://github.com/w3c/epubcheck/issues/897)
* deprecate `epub:trigger` and `epub:switch` ([08123b2](https://github.com/w3c/epubcheck/commit/08123b2)), closes [#894](https://github.com/w3c/epubcheck/issues/894) [#895](https://github.com/w3c/epubcheck/issues/895)
* report aria-describedat as an ERROR ([b4a9e7c](https://github.com/w3c/epubcheck/commit/b4a9e7c)), closes [#896](https://github.com/w3c/epubcheck/issues/896)
* update the Package Document schema for EPUB 3.2 ([1f12512](https://github.com/w3c/epubcheck/commit/1f12512)), closes [#883](https://github.com/w3c/epubcheck/issues/883) [#882](https://github.com/w3c/epubcheck/issues/882) [#881](https://github.com/w3c/epubcheck/issues/881) [#880](https://github.com/w3c/epubcheck/issues/880) [#879](https://github.com/w3c/epubcheck/issues/879) [#878](https://github.com/w3c/epubcheck/issues/878) [#877](https://github.com/w3c/epubcheck/issues/877) [#876](https://github.com/w3c/epubcheck/issues/876)
* update XHTML, SVG and MathML schemas ([47d4926](https://github.com/w3c/epubcheck/commit/47d4926)), closes [#892](https://github.com/w3c/epubcheck/issues/892) [#779](https://github.com/w3c/epubcheck/issues/779) [#896](https://github.com/w3c/epubcheck/issues/896) [#893](https://github.com/w3c/epubcheck/issues/893) [#448](https://github.com/w3c/epubcheck/issues/448)
* **API:** deprecate `EpubChecker#processEpubFile` ([3ed77fe](https://github.com/w3c/epubcheck/commit/3ed77fe))
<a name="4.1.1"></a>
## [4.1.1](https://github.com/w3c/epubcheck/compare/v4.1.0...v4.1.1) (2019-01-22)
### Bug Fixes
* `switch` item property doesn't apply to `svg:switch` ([91b84ad](https://github.com/w3c/epubcheck/commit/91b84ad)), closes [#857](https://github.com/w3c/epubcheck/issues/857)
* better check remote resources ([85b5f77](https://github.com/w3c/epubcheck/commit/85b5f77)), closes [#852](https://github.com/w3c/epubcheck/issues/852)
* better support the EPUB Accessibility Vocabulary ([8a9cf63](https://github.com/w3c/epubcheck/commit/8a9cf63)), closes [#810](https://github.com/w3c/epubcheck/issues/810)
* consider all `video/*` as video media types ([27ad571](https://github.com/w3c/epubcheck/commit/27ad571))
* do not check entity references in comment or CDATA ([#949](https://github.com/w3c/epubcheck/issues/949)) ([4307542](https://github.com/w3c/epubcheck/commit/4307542)), closes [#800](https://github.com/w3c/epubcheck/issues/800)
* do not report CSS 'font-size: 0' as an error ([4e17714](https://github.com/w3c/epubcheck/commit/4e17714)), closes [#922](https://github.com/w3c/epubcheck/issues/922)
* keep on processing after failing to read GIFs ([2a244e7](https://github.com/w3c/epubcheck/commit/2a244e7))
* messages of missing/incorrect locale cannot be translated ([91fac12](https://github.com/w3c/epubcheck/commit/91fac12))
* resolve relative URIs against their base ([d42ccd6](https://github.com/w3c/epubcheck/commit/d42ccd6)), closes [#527](https://github.com/w3c/epubcheck/issues/527)
* valid JPEG files were considered 'corrupted' ([c4a2cfa](https://github.com/w3c/epubcheck/commit/c4a2cfa)), closes [#850](https://github.com/w3c/epubcheck/issues/850)
* wrong report of duplicate landmarks in Nav Doc ([#942](https://github.com/w3c/epubcheck/issues/942)) ([e06a552](https://github.com/w3c/epubcheck/commit/e06a552)), closes [#926](https://github.com/w3c/epubcheck/issues/926)
### Features
* update localized messages for several languages ([116e61b](https://github.com/w3c/epubcheck/commit/116e61b))
**Note:** this release does _not_ yet implement support for the newer EPUB 3.2 specifications.
<a name="4.1.0"></a>
## [4.1.0](https://github.com/w3c/epubcheck/compare/v4.0.2...v4.1.0) (2018-11-26)
### Bug Fixes
......
# Code of Conduct
All contributors to this project agree to follow the [W3C Code of Ethics and Professional Conduct](http://www.w3.org/Consortium/cepc/).
If you want to take action, you can contact W3C Staff as explained in [W3C Procedures](http://www.w3.org/Consortium/pwe/#Procedures).
\ No newline at end of file
Contributions to this repository are intended to become part of software
licensed under the [3-clause BSD License](https://opensource.org/licenses/BSD-3-Clause).
If you are not the sole contributor to a contribution (pull request), please
identify all contributors in the pull request comment.
To add a contributor (other than yourself, that's automatic), mark them one
per line as follows:
```
+@github_username
```
If you added a contributor by mistake, you can remove them in a comment with:
```
-@github_username
```
If you are making a pull request on behalf of someone else but you had no part
in designing the feature, you can remove yourself with the above syntax.
For detailed guidelines on how to contribute to EPUBCheck, please refer to the
[contributing guidelines](https://github.com/w3c/epubcheck/wiki/Contribute).
\ No newline at end of file
Copyright (c) 2007 Adobe Systems Incorporated
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright © 2007 Adobe Systems Incorporated
Copyright © 2008 IDPF
Copyright © 2017 W3C (MIT, ERCIM, Keio, Beihang)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
......@@ -7,7 +7,7 @@ EPUBCheck
EPUBCheck is a tool to validate the conformance of EPUB publications against the EPUB specifications.
EPUBCheck can be run as a standalone command-line tool or used as a Java library.
EPUBCheck is open source software, maintained by the [DAISY Consortium](http://www.daisy.org) for the [W3C](https://www.w3.org/publishing/epubcheck_fundraising).
EPUBCheck is open source software, maintained by the [DAISY Consortium](http://www.daisy.org) on behalf of the [W3C](https://www.w3.org/publishing/epubcheck_fundraising).
**We Need Your Support!!**
......@@ -20,8 +20,7 @@ please [help us fund and support EPUBCheck](https://www.w3.org/publishing/epubch
Check the [releases page](https://github.com/w3c/epubcheck/releases) to get the latest distribution.
[EPUBCheck 4.0.2](https://github.com/w3c/epubcheck/releases/tag/v4.0.2) is the latest recommended version to validate both EPUB 2 and 3 files.
[EPUBCheck 4.2.2](https://github.com/w3c/epubcheck/releases/tag/v4.2.2) is the latest production-ready release, to be used to validate both EPUB 2 and 3 files. EPUB 3 publications are checked against the EPUB 3.2 family of specifications.
## Documentation
......@@ -63,16 +62,26 @@ Many thanks are also extended to the numerous people who have contributed to the
The following organizations are supporting the development of EPUBCheck by their contribution to the [fundraising initiative](https://www.w3.org/publishing/epubcheck_fundraising):
<p float="left">
<a href="http://daisy.org"><img alt="DAISY" src="https://github.com/w3c/publishing/blob/master/donators_logos/daisy_high.jpg?raw=true" width="100" hspace="20" align="middle"/></a>
<a href="https://pubhub.dk"><img alt="Publizon A/S" src="https://github.com/w3c/publishing/blob/master/donators_logos/publizon-logo.jpg?raw=true" width="100" hspace="20" align="middle"/></a>
<a href="https://www.wiley.com"><img alt="Wiley" src="https://github.com/w3c/publishing/blob/master/donators_logos/Wiley_Wordmark_black.png?raw=true" width="200" hspace="20" align="middle"/></a>
<a href="https://www.hachette.com"><img alt="Hachette Livre" src="https://github.com/w3c/publishing/blob/master/donators_logos/Hachette%20Livre.jpg?raw=true" width="300" hspace="20" align="middle"/></a>
<a href="https://www.learningmate.com"><img alt="LearningMate Solutions Inc" src="https://github.com/w3c/publishing/blob/master/donators_logos/LearningMate%20Logo.png?raw=true" width="100" hspace="20" align="middle"/></a>
<a href="https://www.voyager.co.jp"><img alt="Voyager Japan, Inc." src="https://github.com/w3c/publishing/blob/master/donators_logos/rectangle_VJstar_logo_512.jpg?raw=true" width="100" hspace="20" align="middle"/></a>
<a href="https://wwnorton.com"><img alt="W. W. Norton" src="https://github.com/w3c/publishing/blob/master/donators_logos/NortonLogo_notagline.jpg?raw=true" width="100" hspace="20" align="middle"/></a>
<a href="https://luminadatamatics.com"><img alt="Lumina Datamatics, Inc." src="https://github.com/w3c/publishing/blob/master/donators_logos/Datamatics_logo.jpg?raw=true" width="100" hspace="20" align="middle"/></a>
<a href="https://www.macmillanlearning.com"><img alt="MacMillan Learning" src="https://www.w3.org/publishing/donators_logos/MacLearn_logo_cmyk.png" width="200" hspace="20" align="middle"/></a>
<a href="https://www.google.com"><img alt="Google" src="https://www.w3.org/publishing/donators_logos/Google.png" width="400" hspace="20" align="middle"/></a>
<a href="http://daisy.org"><img alt="DAISY" src="https://www.w3.org/publishing/donators_logos/daisy_high.jpg" width="100" hspace="20" align="middle"/></a>
<a href="https://pubhub.dk"><img alt="Publizon A/S" src="https://www.w3.org/publishing/donators_logos/publizon-logo.jpg" width="100" hspace="20" align="middle"/></a>
<a href="https://www.wiley.com"><img alt="Wiley" src="https://www.w3.org/publishing/donators_logos/Wiley_Wordmark_black.png" width="200" hspace="20" align="middle"/></a>
<a href="https://www.hachette.com"><img alt="Hachette Livre" src="https://www.w3.org/publishing/donators_logos/Hachette%20Livre.jpg" width="300" hspace="20" align="middle"/></a>
<a href="https://www.learningmate.com"><img alt="LearningMate Solutions Inc" src="https://www.w3.org/publishing/donators_logos/LearningMate%20Logo.png" width="100" hspace="20" align="middle"/></a>
<a href="https://www.voyager.co.jp"><img alt="Voyager Japan, Inc." src="https://www.w3.org/publishing/donators_logos/rectangle_VJstar_logo_512.jpg" width="100" hspace="20" align="middle"/></a>
<a href="https://qainfotech.com"><img alt="QA Info Tech" src="https://www.w3.org/publishing/donators_logos/QA%20InfoTech%20Logo%20PNG%20Format.png" width="200" hspace="20" align="middle"/></a>
<a href="https://wwnorton.com"><img alt="W. W. Norton" src="https://www.w3.org/publishing/donators_logos/NortonLogo_notagline.jpg" width="100" hspace="20" align="middle"/></a>
<a href="https://luminadatamatics.com"><img alt="Lumina Datamatics, Inc." src="https://www.w3.org/publishing/donators_logos/Datamatics_logo.jpg" width="100" hspace="20" align="middle"/></a>
<a href="https://www.harpercollins.com"><img alt="Harper Collins" src="https://www.w3.org/publishing/donators_logos/HarperCollins.png" width="200" hspace="20" align="middle"/></a>
<a href="https://www.vitalsource.com"><img alt="Vital Source" src="https://www.w3.org/publishing/donators_logos/VS_Logo_HOR_Ingram_Tag(RGB).jpg" width="300" hspace="20" align="middle"/></a>
<a href="https://www.beck.de/"><img alt="Verlag C.H. Beck oHG" src="https://www.w3.org/publishing/donators_logos/Beck_LogoVektor_sw.jpg" width="100" hspace="20" align="middle"/></a>
<a href="https://info.libreka.de"><img alt="Libreka" src="https://www.w3.org/publishing/donators_logos/logo_libreka.png" width="100" hspace="20" align="middle"/></a>
<a href="https://zeilenwert.de"><img alt="Zeilenwert" src="https://www.w3.org/publishing/donators_logos/logo_zeilenwert.jpg" width="100" hspace="20" align="middle"/></a>
<a href="https://www.cenveopublisherservices.com"><img alt="Cenveo Publisher Services" src="https://www.w3.org/publishing/donators_logos/CVO%20Pub%20Serv_Logo.jpg" width="100" hspace="20" align="middle"/></a>
<a href="https://www.booknetcanada.ca"><img alt="BookNet Canada" src="https://www.w3.org/publishing/donators_logos/BNC_Logo_Horizontal_RGB_1000px.png" width="100" hspace="20" align="middle"/></a>
</p>
## License
EPUBCheck is made available under the terms of the [New BSD License](http://opensource.org/licenses/BSD-3-Clause)
EPUBCheck is made available under the terms of the [3-Clause BSD License](http://opensource.org/licenses/BSD-3-Clause)
epubcheck (4.2.2-1) unstable; urgency=medium
* New upstream release
* Use secure copyright file specification URI.
* Update Standards-Version to 4.4.0
-- Eugene Zhukov <eugene@debian.org> Thu, 01 Aug 2019 10:32:26 +0300
epubcheck (4.1.0-1) unstable; urgency=medium
* New upstream release
......
......@@ -15,7 +15,7 @@ Build-Depends: debhelper (>= 9),
libxml-maven-plugin-java,
libmaven-dependency-plugin-java,
libjackson-json-java
Standards-Version: 4.2.1.3
Standards-Version: 4.4.0
Vcs-Browser: https://salsa.debian.org/java-team/epubcheck
Vcs-Git: https://salsa.debian.org/java-team/epubcheck.git
Homepage: https://github.com/IDPF/epubcheck
......
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: epubcheck
Upstream-Contact: Peter Sorotokin, Garth Conboy, Markus Gylling, Piotr Kula, Paul Norton
Source: https://github.com/IDPF/epubcheck
......
......@@ -9,26 +9,25 @@
<version>7</version>
</parent>
<groupId>org.idpf</groupId>
<groupId>org.w3c</groupId>
<artifactId>epubcheck</artifactId>
<version>4.1.0</version>
<version>4.2.2</version>
<packaging>jar</packaging>
<name>EPUBCheck :: Validation Tool for EPUB</name>
<description>EPUBCheck is a tool to validate IDPF EPUB files. It can detect many types of errors in EPUB.
OCF container structure, OPF and OPS mark-up, and internal reference consistency are checked.
EPUBCheck can be run as a standalone command-line tool, installed as a Java server-side web application
or used as a Java library.</description>
<url>http://code.google.com/p/epubcheck/</url>
<description>EPUBCheck is a tool to validate the conformance of EPUB publications against
the EPUB specifications. EPUBCheck can be run as a standalone command-line tool or used
as a Java library.</description>
<url>https://github.com/w3c/epubcheck</url>
<inceptionYear>2007</inceptionYear>
<organization>
<name>International Digital Publishing Forum</name>
<url>http://www.idpf.org/</url>
<name>The World Wide Web Consortium (W3C)</name>
<url>https://www.w3.org</url>
</organization>
<licenses>
<license>
<name>New BSD License</name>
<name>BSD 3-Clause License</name>
<url>http://www.opensource.org/licenses/bsd-license.php</url>
</license>
</licenses>
......@@ -141,14 +140,14 @@
</mailingList>
</mailingLists>
<scm>
<connection>scm:git:ssh://git@github.com:IDPF/epubcheck.git</connection>
<developerConnection>scm:git:ssh://git@github.com:IDPF/epubcheckgit</developerConnection>
<url>https://github.com/IDPF/epubcheck</url>
<tag>v4.1.0</tag>
<connection>scm:git:ssh://git@github.com:w3c/epubcheck.git</connection>
<developerConnection>scm:git:ssh://git@github.com:w3c/epubcheckgit</developerConnection>
<url>https://github.com/w3c/epubcheck</url>
<tag>v4.2.2</tag>
</scm>
<issueManagement>
<system>Github</system>
<url>https://github.com/IDPF/epubcheck/issues</url>
<url>https://github.com/w3c/epubcheck/issues</url>
</issueManagement>
<properties>
......@@ -181,9 +180,9 @@
</exclusions>
</dependency>
<dependency>
<groupId>org.daisy.libs</groupId>
<groupId>org.relaxng</groupId>
<artifactId>jing</artifactId>
<version>20120724.0.0</version>
<version>20181222</version>
<exclusions>
<exclusion>
<groupId>xml-apis</groupId>
......@@ -210,7 +209,7 @@
<dependency>
<groupId>com.twelvemonkeys.imageio</groupId>
<artifactId>imageio-jpeg</artifactId>
<version>3.1.2</version>
<version>3.4.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
......@@ -285,7 +284,7 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.5.4</version>
<version>3.2.0</version>
<extensions>true</extensions>
<executions>
<execution>
......@@ -298,6 +297,10 @@
</executions>
<configuration>
<instructions>
<Import-Package>
net.sf.saxon.*;version="[9.8.0,9.8.1)",
*
</Import-Package>
<_removeheaders>Include-Resource,Private-Package, Bnd-LastModified, Build-Jdk, Built-By</_removeheaders>
</instructions>
</configuration>
......@@ -307,7 +310,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<argLine>-Xmx1g -Duser.language=en</argLine>
<argLine>-Xmx1g</argLine>
<workingDirectory>${project.build.directory}/test-classes</workingDirectory>
<!-- manifestFile>${project.build.directory}/classes/META-INF/MANIFEST.MF</manifestFile -->
</configuration>
......@@ -409,10 +412,7 @@
</goals>
<configuration>
<includedScopes>runtime,compile</includedScopes>
<fileTemplate>src/main/licenses/third-party.ftl</fileTemplate>
<useMissingFile>true</useMissingFile>
<missingFile>src/main/licenses/third-party.properties</missingFile>
<deployMissingFile>false</deployMissingFile>
<fileTemplate>${project.basedir}/src/main/licenses/third-party.ftl</fileTemplate>
</configuration>
</execution>
</executions>
......@@ -464,6 +464,7 @@
</dependencies>
<configuration>
<tagNameFormat>v@{project.version}</tagNameFormat>
<scmCommentPrefix xml:space="preserve">chore: </scmCommentPrefix>
</configuration>
</plugin>
<plugin>
......
#!/bin/bash
# bash script to update and normalize
# pulled transifex properties files
# Mac only bash script to update and normalize
# Java properties files pulled from Transifex
#
# Author: Tobias Fischer (https://github.com/tofi86)
# Project: IDPF/EPUBCheck (https://github.com/IDPF/epubcheck)
# Project: W3C/EPUBCheck (https://github.com/w3c/epubcheck)
#
# Date: 2018-08-25
# Date: 2018-11-26
# License: MIT License
#
param1=$1
......@@ -81,20 +80,21 @@ fi
# Show help if no language parameter is passed to the script or --help
if [[ -z ${param1} || ${param1} == "--help" ]] ; then
echo "usage: transifex-pull.sh [--all | <2-digit-country-code>]"
echo "usage: transifex-pull.sh [--all | <locale>]"
echo "examples:"
echo " transifex-pull.sh --all"
echo " transifex-pull.sh de"
echo " transifex-pull.sh ko_KR"
# Pull ALL translations
elif [ ${param1} == "--all" ] ; then
minimum_percent_translated=$(awk -F "=" '/minimum_perc/ {print $2}' .tx/config)
echo "Pulling ALL EPUBCheck translations (>${minimum_percent_translated}% done) from Transifex..."
echo "Pulling *ALL* EPUBCheck translations (>${minimum_percent_translated}% done) from Transifex..."
echo ""
tx pull -f | tee /dev/stderr | grep "> [a-z][a-z]: " | awk '{print $NF}' | while read f; do processFile ${f}; done
tx pull -f | tee /dev/stderr | egrep "> [a-z][a-z](_[A-Z][A-Z])?:" | awk '{print $NF}' | while read f; do processFile ${f}; done
# Pull translations for a 2-digit-language-code
elif [ ${#param1} -eq 2 ] ; then
# Pull translations for a specific locale
elif [[ ${param1} =~ ^[a-z][a-z](_[A-Z][A-Z])?$ ]] ; then
echo "Pulling EPUBCheck translation '${param1}' from Transifex..."
echo ""
tx pull -f -l ${param1} | tee /dev/stderr | grep "${param1}: " | awk '{print $NF}' | while read f; do processFile ${f}; done
......
......@@ -7,7 +7,10 @@ EPUBCheck is a tool to validate the conformance of EPUB publications against
the EPUB specifications. EPUBCheck can be run as a standalone command-line tool
or used as a Java library.
EPUBCheck project home: https://github.com/idpf/epubcheck
EPUBCheck is open source software, maintained by the DAISY Consortium on behalf
of the W3C.
EPUBCheck project home: https://github.com/w3c/epubcheck
RUNNING
......@@ -31,7 +34,7 @@ USING AS A LIBRARY
------------------
You can also use EPUBCheck as a library in your Java application. EPUBCheck
public interfaces can be found in the `com.adobe.epubcheck.api package`.
public interfaces can be found in the `com.adobe.epubcheck.api` package.
EPUBCheck class can be used to instantiate a validation engine. Use one of its
constructors and then call validate() method. Report is an interface that you
can implement to get a list of the errors and warnings reported by the
......@@ -41,9 +44,11 @@ validation engine (instead of the error list being printed out).
LICENSING
---------
EPUBCheck is made available under the terms of the New BSD License.
EPUBCheck is made available under the terms of the 3-Clause BSD License, a
copy of which is available in the file LICENSE.txt.
See details in COPYING.txt and THIRD-PARTY.txt
The list of licenses of third-party software components is detailed in the
file THIRD-PARTY.txt
AUTHORS / CONTRIBUTORS
......@@ -57,21 +62,26 @@ Previous contributors include:
- Alexander Walters
- Andrew Neitsch
- Arwen Pond
- Bobby Tung
- Bogdan Iordache
- Dave Cramer
- dilbirligi
- Emiliano Molina
- Elisa Molinari (Fondazione LIA)
- Francisco Sanchez
- Garth Conboy
- George Bina
- Gregorio Pellegrino (Fondazione LIA)
- Ionut-Maxim Margelatu
- Jessica Hekman
- Jostein Austvik Jacobsen
- Liza Daly
- Marianne Gulstad (Publizon)
- Markus Gylling
- Martin Kraetke
- Masayoshi Takahashi
- Matt Garrish
- Merijn de Haen
- MURATA Makoto
- Paul Norton
- Peter Sorotokin
......@@ -80,10 +90,13 @@ Previous contributors include:
- Satoshi KOJIMA
- Stephan Kreutzer
- Steve Antoch
- Thiago de Oliveira Pereira
- Thomas Ledoux
- Tobias Fischer
- Tomohiko Hayashi
- Tzviya Siegman
- Vincent Gros
- Woongyoung Park
Most of the EPUBCheck functionality comes from the schema validation tool Jing
......
......@@ -8,10 +8,12 @@
</formats>
<files>
<file>
<source>COPYING.txt</source>
<source>LICENSE.md</source>
<destName>LICENSE.txt</destName>
</file>
<file>
<source>CHANGELOG.md</source>
<destName>CHANGELOG.txt</destName>
</file>
<file>
<source>src/main/assembly/README-dist.txt</source>
......
......@@ -22,7 +22,6 @@
package com.adobe.epubcheck.api;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
......@@ -41,7 +40,6 @@ import com.adobe.epubcheck.ocf.OCFZipPackage;
import com.adobe.epubcheck.opf.DocumentValidator;
import com.adobe.epubcheck.opf.OPFData;
import com.adobe.epubcheck.opf.ValidationContext.ValidationContextBuilder;
import com.adobe.epubcheck.util.CheckUtil;
import com.adobe.epubcheck.util.DefaultReportImpl;
import com.adobe.epubcheck.util.EPUBVersion;
import com.adobe.epubcheck.util.ResourceUtil;
......@@ -210,7 +208,6 @@ public class EpubCheck implements DocumentValidator
public int doValidate()
{
ZipFile zip = null;
FileInputStream epubIn = null;
try
{
if (!epubFile.exists())
......@@ -219,13 +216,11 @@ public class EpubCheck implements DocumentValidator
return 2;
}
epubIn = new FileInputStream(epubFile);
checkEpubHeader(epubIn);
zip = new ZipFile(epubFile);
OCFPackage ocf = new OCFZipPackage(zip);
OCFChecker checker = new OCFChecker(new ValidationContextBuilder().ocf(ocf).report(report)
.profile(profile).build());
OCFChecker checker = new OCFChecker(new ValidationContextBuilder()
.path(epubFile.getAbsolutePath()).ocf(ocf).report(report).profile(profile).build());
checker.runChecks();
String extension = ResourceUtil.getExtension(epubFile.getName());
......@@ -236,16 +231,14 @@ public class EpubCheck implements DocumentValidator
c.checkPackage();
} catch (IOException e)
{
// run ZIP header checks in any case before returning
OCFChecker.checkZipHeader(epubFile, report);
report.message(MessageId.PKG_008, EPUBLocation.create(epubFile.getName(), ""),
e.getMessage());
} finally
{
try
{
if (epubIn != null)
{
epubIn.close();
}
if (zip != null)
{
zip.close();
......@@ -285,62 +278,4 @@ public class EpubCheck implements DocumentValidator
}
}
void checkEpubHeader(FileInputStream epubIn)
throws IOException
{
byte[] header = new byte[58];
int readCount = epubIn.read(header);
if (readCount != -1)
{
while (readCount < header.length)
{
int read = epubIn.read(header, readCount, header.length - readCount);
// break on eof
if (read == -1)
{
break;
}
readCount += read;
}
}
if (readCount != header.length)
{
report.message(MessageId.PKG_003, EPUBLocation.create(epubFile.getName(), ""));
}
else
{
int fnsize = getIntFromBytes(header, 26);
int extsize = getIntFromBytes(header, 28);
if (header[0] != 'P' && header[1] != 'K')
{
report.message(MessageId.PKG_004, EPUBLocation.create(epubFile.getName()));
}
else if (fnsize != 8)
{
report.message(MessageId.PKG_006, EPUBLocation.create(epubFile.getName()));
}
else if (extsize != 0)
{
report.message(MessageId.PKG_005, EPUBLocation.create(epubFile.getName()), extsize);
}
else if (!CheckUtil.checkString(header, 30, "mimetype"))
{
report.message(MessageId.PKG_006, EPUBLocation.create(epubFile.getName()));
}
else if (!CheckUtil.checkString(header, 38, "application/epub+zip"))
{
report.message(MessageId.PKG_007, EPUBLocation.create("mimetype"));
}
}
}
private int getIntFromBytes(byte[] bytes, int offset)
{
int hi = 0xFF & bytes[offset + 1];
int lo = 0xFF & bytes[offset];
return hi << 8 | lo;
}
}
......@@ -158,7 +158,7 @@ public class BitmapChecker implements ContentChecker
report.message(MessageId.PKG_021, EPUBLocation.create(imgFileName));
return null;
}
catch (IllegalArgumentException argex)
catch (RuntimeException argex)
{
report.message(MessageId.PKG_021, EPUBLocation.create(imgFileName));
return null;
......
......@@ -97,8 +97,7 @@ public class CSSChecker implements ContentChecker
return;
}
CSSHandler handler = new CSSHandler(path, context.xrefChecker.orNull(), report,
context.version);
CSSHandler handler = new CSSHandler(context);
if (this.mode == Mode.STRING && this.line > -1)
{
handler.setStartingLineNumber(this.line);
......
package com.adobe.epubcheck.css;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
......@@ -19,14 +21,21 @@ import com.adobe.epubcheck.api.Report;
import com.adobe.epubcheck.messages.MessageId;
import com.adobe.epubcheck.opf.OPFChecker;
import com.adobe.epubcheck.opf.OPFChecker30;
import com.adobe.epubcheck.opf.ValidationContext;
import com.adobe.epubcheck.opf.XRefChecker;
import com.adobe.epubcheck.opf.XRefChecker.Type;
import com.adobe.epubcheck.util.EPUBVersion;
import com.adobe.epubcheck.util.FeatureEnum;
import com.adobe.epubcheck.util.PathUtil;
import com.adobe.epubcheck.vocab.PackageVocabs;
import com.adobe.epubcheck.vocab.PackageVocabs.ITEM_PROPERTIES;
import com.adobe.epubcheck.vocab.Property;
import com.google.common.base.CharMatcher;
import com.google.common.collect.Sets;
public class CSSHandler implements CssContentHandler, CssErrorHandler
{
final ValidationContext context;
final String path;
final XRefChecker xrefChecker;
final Report report;
......@@ -45,13 +54,16 @@ public class CSSHandler implements CssContentHandler, CssErrorHandler
boolean inKeyFrames = false;
CssAtRule atRule = null;
public CSSHandler(String path, XRefChecker xrefChecker, Report report,
EPUBVersion version)
// properties the must be declared on the related OPF item
final Set<ITEM_PROPERTIES> detectedProperties = EnumSet.noneOf(ITEM_PROPERTIES.class);
public CSSHandler(ValidationContext context)
{
this.path = path;
this.xrefChecker = xrefChecker;
this.report = report;
this.version = version;
this.context = context;
this.path = context.path;
this.xrefChecker = context.xrefChecker.orNull();
this.report = context.report;
this.version = context.version;
}
private EPUBLocation getCorrectedEPUBLocation(String fileName, int lineNumber, int columnNumber, String context)
......@@ -104,6 +116,7 @@ public class CSSHandler implements CssContentHandler, CssErrorHandler
@Override
public void endDocument()
{
checkProperties();
}
static final Pattern keyframesPattern = Pattern.compile("@((keyframes)|(-moz-keyframes)|(-webkit-keyframes)|(-o-keyframes))");
......@@ -135,7 +148,7 @@ public class CSSHandler implements CssContentHandler, CssErrorHandler
}
if (uri != null)
{
resolveAndRegister(uri, line, col, atRule.toCssString());
resolveAndRegister(uri, line, col, atRule.toCssString(), Type.GENERIC);
}
}
}
......@@ -254,7 +267,7 @@ public class CSSHandler implements CssContentHandler, CssErrorHandler
if (construct.getType() == CssConstruct.Type.URI)
{
fontUri = ((CssURI) construct).toUriString();
fontUri = PathUtil.resolveRelativeReference(path, fontUri, null);
fontUri = PathUtil.resolveRelativeReference(path, fontUri);
// check font mimetypes
String fontMimeType = xrefChecker.getMimeType(fontUri);
if (fontMimeType != null)
......@@ -298,17 +311,20 @@ public class CSSHandler implements CssContentHandler, CssErrorHandler
{
if (construct.getType() == CssConstruct.Type.URI)
{
resolveAndRegister(((CssURI) construct).toUriString(), line, col, construct.toCssString());
resolveAndRegister(((CssURI) construct).toUriString(), line, col, construct.toCssString(), inFontFace?Type.FONT:Type.GENERIC);
}
}
}
private void resolveAndRegister(String relativeRef, int line, int col, String context)
private void resolveAndRegister(String uri, int line, int col, String context, Type type)
{
if (relativeRef != null && relativeRef.trim().length() > 0)
if (uri != null && uri.trim().length() > 0)
{
String resolved = PathUtil.resolveRelativeReference(path, relativeRef, null);
xrefChecker.registerReference(path, line + startingLineNumber, col, resolved, XRefChecker.Type.GENERIC);
String resolved = PathUtil.resolveRelativeReference(path, uri);
xrefChecker.registerReference(path, correctedLineNumber(line), correctedColumnNumber(line, col), resolved, type);
if (PathUtil.isRemote(resolved)) {
detectedProperties.add(ITEM_PROPERTIES.REMOTE_RESOURCES);
}
}
else
{
......@@ -340,6 +356,33 @@ public class CSSHandler implements CssContentHandler, CssErrorHandler
}
}
protected void checkProperties() {
// Exit early if we don't have container-level info (single file validation)
if (!context.ocf.isPresent()) // single file validation
{
return;
}
Set<ITEM_PROPERTIES> declaredProperties = Property.filter(context.properties, ITEM_PROPERTIES.class);
// Check that all properties found in the doc are declared on the OPF item
for (ITEM_PROPERTIES property : Sets.difference(detectedProperties, declaredProperties))
{
report.message(MessageId.OPF_014, EPUBLocation.create(path, startingLineNumber, startingLineNumber),
PackageVocabs.ITEM_VOCAB.getName(property));
}
// Check that properties declared in the OPF item were found in the content
Set<ITEM_PROPERTIES> uncheckedProperties = Sets.difference(declaredProperties, detectedProperties)
.copyInto(EnumSet.noneOf(ITEM_PROPERTIES.class));
if (uncheckedProperties.contains(ITEM_PROPERTIES.REMOTE_RESOURCES))
{
uncheckedProperties.remove(ITEM_PROPERTIES.REMOTE_RESOURCES);
report.message(MessageId.OPF_018, EPUBLocation.create(path, startingLineNumber, startingLineNumber));
}
}
public void setStartingLineNumber(int offset)
{
this.startingLineNumber = offset - 1;
......
......@@ -176,7 +176,7 @@ public class EpubCSSCheck implements DocumentValidator
String fileToParse;
if (epack.getPackageMainPath() != null && epack.getPackageMainPath().length() > 0)
{
fileToParse = PathUtil.resolveRelativeReference(epack.getPackageMainFile(), itemEntry.getHref(), null);
fileToParse = PathUtil.resolveRelativeReference(epack.getPackageMainFile(), itemEntry.getHref());
}
else
{
......