Skip to content

Commit

Permalink
fix: allow epub:type on all HTML elements
Browse files Browse the repository at this point in the history
Fix #986
  • Loading branch information
rdeltour committed Mar 15, 2019
1 parent 0036e93 commit 2cafe64
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
}

## "reset" the definition of nav.attrs to what it was
## before epub:type was set to augment common.attrs
## before epub:type was set to augment common.attrs.basic
nav.attrs.noepubtype =
( common.attrs.basic
( common.attrs.id?
& common.attrs.class?
& common.attrs.title?
& common.attrs.base?
& common.attrs.space?
& common.attrs.i18n
& common.attrs.present
& common.attrs.other
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
## common.attrs.other is augmented by other schemas.
## We therefore augment common.attrs (and also attrobute
## lists that are not based on common.attrs)
common.attrs &= epub.type.attr?
a.attrs &= epub.type.attr?
area.attrs &= epub.type.attr?
common.attrs.basic &= epub.type.attr?

epub.type.attr = attribute epub:type { datatype.properties }
7 changes: 7 additions & 0 deletions src/test/java/com/adobe/epubcheck/ops/OPSCheckerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,13 @@ public void testEPUBTypeFromSructureVocab()
testValidateDocument("xhtml/valid/epubtype.xhtml", "application/xhtml+xml",
EPUBVersion.VERSION_3);
}

@Test
public void testEPUBTypeInHead()
{
testValidateDocument("xhtml/valid/epubtype-in-head.xhtml", "application/xhtml+xml",
EPUBVersion.VERSION_3);
}

@Test
public void testEPUBTypeFromReservedVocab()
Expand Down
11 changes: 11 additions & 0 deletions src/test/resources/30/single/xhtml/valid/epubtype-in-head.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops"
epub:prefix="my: https://example.org/vocab/#" lang="en">
<head>
<title>Test</title>
<meta name="creator" content="Herman Melville" epub:type="my:creator" />
</head>
<body>
<h1>Test</h1>
</body>
</html>

0 comments on commit 2cafe64

Please sign in to comment.