-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: check references between Media Overlays and Content documents
Add the following new errors: - Error MED-010 when an item is missing a media-overlay attribute - Error MED-011 when the media-overlay attribute references the wrong overlay - Error MED-012 when the media-overlay attribute references an overlay that does not reference the underlying content document - Error MED-013 when a content doc is referenced from multiple overlays Also Add tests for the new errors. Implementation note: - pull the unique references from the text elements while parsing the overlay documents - then run checks on the affected content documents in the post-processing function.
- Loading branch information
1 parent
11b652e
commit f49aa84
Showing
46 changed files
with
492 additions
and
5 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
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
35 changes: 35 additions & 0 deletions
35
src/main/java/com/adobe/epubcheck/overlay/OverlayTextChecker.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,35 @@ | ||
package com.adobe.epubcheck.overlay; | ||
|
||
import java.util.Map; | ||
import java.util.HashMap; | ||
|
||
public class OverlayTextChecker { | ||
|
||
private Map<String,String> refs; | ||
|
||
public OverlayTextChecker() { | ||
refs = new HashMap<String,String>(); | ||
} | ||
|
||
public boolean add(String ref, String overlay) { | ||
if (!refs.containsKey(ref)) { | ||
refs.put(ref, overlay); | ||
return true; | ||
} | ||
else if (!refs.get(ref).equalsIgnoreCase(overlay)) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
public boolean isReferencedByOverlay(String path) { | ||
if (path == null || path.equals("")) { | ||
return false; | ||
} | ||
return refs.containsKey(path) ? true : false; | ||
} | ||
|
||
public boolean isCorrectOverlay(String path, String overlay) { | ||
return overlay.equalsIgnoreCase(refs.get(path)) ? true : false; | ||
} | ||
} |
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
Binary file added
BIN
+10.1 KB
...est/resources/epub3/files/epub/mediaoverlays-incorrect-overlay-ref-error/EPUB/content.mp3
Binary file not shown.
13 changes: 13 additions & 0 deletions
13
...esources/epub3/files/epub/mediaoverlays-incorrect-overlay-ref-error/EPUB/content_001.smil
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,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<smil xmlns="http://www.w3.org/ns/SMIL" xmlns:epub="http://www.idpf.org/2007/ops" version="3.0"> | ||
<body> | ||
<par id="par1"> | ||
<text src="content_001.xhtml#c01"/> | ||
<audio src="content.mp3"/> | ||
</par> | ||
<par id="par2"> | ||
<text src="content_002.xhtml#c02"/> | ||
<audio src="content.mp3"/> | ||
</par> | ||
</body> | ||
</smil> |
11 changes: 11 additions & 0 deletions
11
...sources/epub3/files/epub/mediaoverlays-incorrect-overlay-ref-error/EPUB/content_001.xhtml
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,11 @@ | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Minimal EPUB</title> | ||
</head> | ||
<body> | ||
<h1 id="c01">Loomings</h1> | ||
<p>Call me Ishmael.</p> | ||
</body> | ||
</html> |
9 changes: 9 additions & 0 deletions
9
...esources/epub3/files/epub/mediaoverlays-incorrect-overlay-ref-error/EPUB/content_002.smil
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,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<smil xmlns="http://www.w3.org/ns/SMIL" xmlns:epub="http://www.idpf.org/2007/ops" version="3.0"> | ||
<body> | ||
<par id="par1"> | ||
<text src="content_003.xhtml#c03"/> | ||
<audio src="content.mp3"/> | ||
</par> | ||
</body> | ||
</smil> |
11 changes: 11 additions & 0 deletions
11
...sources/epub3/files/epub/mediaoverlays-incorrect-overlay-ref-error/EPUB/content_002.xhtml
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,11 @@ | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Minimal EPUB</title> | ||
</head> | ||
<body> | ||
<h1 id="c02">Loomings</h1> | ||
<p>Call me Ishmael.</p> | ||
</body> | ||
</html> |
11 changes: 11 additions & 0 deletions
11
...sources/epub3/files/epub/mediaoverlays-incorrect-overlay-ref-error/EPUB/content_003.xhtml
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,11 @@ | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Minimal EPUB</title> | ||
</head> | ||
<body> | ||
<h1 id="c03">Loomings</h1> | ||
<p>Call me Ishmael.</p> | ||
</body> | ||
</html> |
Oops, something went wrong.