Skip to content

Commit d1727d8

Browse files
committed
fix: allow the 'glossary' manifest item property
The `glossary` manifest item property is defined in the EPUB dictionaries and Glossaries 1.0 specification: http://idpf.org/epub/dict/epub-dict.html#sec-2.5.3 This fix allows the property to be defined on XHTML manifest items when the content contains an element with a `glossary` `epub:type` attribute. Fixes #1170
1 parent 57d7276 commit d1727d8

15 files changed

Lines changed: 142 additions & 1 deletion

File tree

src/main/java/com/adobe/epubcheck/ops/OPSHandler30.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,10 @@ protected void checkTypes(Set<EPUB_TYPES> types)
245245
allowedProperties.add(ITEM_PROPERTIES.INDEX);
246246
context.featureReport.report(FeatureEnum.INDEX, parser.getLocation(), null);
247247
}
248+
if (types.contains(EPUB_TYPES.GLOSSARY))
249+
{
250+
allowedProperties.add(ITEM_PROPERTIES.GLOSSARY);
251+
}
248252
}
249253

250254
@Override

src/test/resources/epub-dictionaries/dictionaries-publication.feature

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,16 @@ Feature: EPUB Dictionaries and Glossaries ▸ Full Publication Checks
9797
When checking EPUB 'dictionary-multiple-no-content-error'
9898
Then error OPF-078 is reported
9999
And no other errors or warnings are reported
100+
101+
### 2.5.2 Glossary Identification
102+
103+
Scenario: Verify a publication with a single glossary
104+
Given EPUBCheck configured with the 'default' profile
105+
When checking EPUB 'glossary-single-valid'
106+
Then no errors or warnings are reported
107+
108+
Scenario: Verify the 'glossary' manifest item property is not mandatory in the default checking profile
109+
Note: we cannot check that the property is mandatory in EPUB Glossaries, as there is no dedicated profile for these
110+
Given EPUBCheck configured with the 'default' profile
111+
When checking EPUB 'glossary-single-package-property-not-defined-error'
112+
Then no errors or warnings are reported
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" xmlns:epub="http://www.idpf.org/2007/ops">
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>Minimal EPUB</title>
6+
</head>
7+
<body>
8+
<h2>Glossary</h2>
9+
<section epub:type="glossary">
10+
<dl>
11+
<dt id="term">term</dt>
12+
<dd>definition</dd>
13+
</dl>
14+
</section>
15+
</body>
16+
</html>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xml:lang="en" lang="en">
3+
<head>
4+
<meta charset="utf-8"/>
5+
<title>Minimal Nav</title>
6+
</head>
7+
<body>
8+
<nav epub:type="toc">
9+
<ol>
10+
<li><a href="content_001.xhtml">content 001</a></li>
11+
</ol>
12+
</nav>
13+
</body>
14+
</html>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<package xmlns="http://www.idpf.org/2007/opf" version="3.0" xml:lang="en" unique-identifier="q">
3+
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/">
4+
<dc:title id="title">Minimal EPUB 3.0</dc:title>
5+
<dc:language>en</dc:language>
6+
<dc:identifier id="q">NOID</dc:identifier>
7+
<meta property="dcterms:modified">2017-06-14T00:00:01Z</meta>
8+
</metadata>
9+
<manifest>
10+
<item id="content_001" href="content_001.xhtml" media-type="application/xhtml+xml"/>
11+
<item id="nav" href="nav.xhtml" media-type="application/xhtml+xml" properties="nav"/>
12+
<item id="skm" href="search.xml" properties="glossary search-key-map" media-type="application/vnd.epub.search-key-map+xml"/>
13+
</manifest>
14+
<spine>
15+
<itemref idref="content_001" />
16+
</spine>
17+
</package>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<search-key-map xml:lang="en" xmlns="http://www.idpf.org/2007/ops">
3+
<search-key-group href="content_001.xhtml#term">
4+
<match value="term">
5+
<value value="term"/>
6+
</match>
7+
</search-key-group>
8+
</search-key-map>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<container xmlns="urn:oasis:names:tc:opendocument:xmlns:container" version="1.0">
3+
<rootfiles>
4+
<rootfile full-path="EPUB/package.opf" media-type="application/oebps-package+xml"/>
5+
</rootfiles>
6+
</container>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
application/epub+zip
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" xmlns:epub="http://www.idpf.org/2007/ops">
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>Minimal EPUB</title>
6+
</head>
7+
<body>
8+
<h2>Glossary</h2>
9+
<section epub:type="glossary">
10+
<dl>
11+
<dt id="term">term</dt>
12+
<dd>definition</dd>
13+
</dl>
14+
</section>
15+
</body>
16+
</html>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xml:lang="en" lang="en">
3+
<head>
4+
<meta charset="utf-8"/>
5+
<title>Minimal Nav</title>
6+
</head>
7+
<body>
8+
<nav epub:type="toc">
9+
<ol>
10+
<li><a href="content_001.xhtml">content 001</a></li>
11+
</ol>
12+
</nav>
13+
</body>
14+
</html>

0 commit comments

Comments
 (0)