git.iko.soy/typeable/pandoc
on master help sign in
Merge pull request #1488 from mpickering/epubfixes

EPUB Reader: Improved image extraction

commit3c4079edc88deedb01128663bed8040617f0877c authorJohn MacFarlane <jgm@berkeley.edu> dateThu 7 Aug 2014, 19:00 (12 years ago) parent08bed14090b2da
2 files changed+64−42
src/Text/Pandoc/Readers/EPUB.hs+45−23 tests/features.native+19−19
src/Text/Pandoc/Readers/EPUB.hs+45−23
@@ -22,7 +22,9 @@ import qualified Text.Pandoc.Builder as B
2222import Codec.Archive.Zip ( Archive (..), toArchive, fromEntry
2323 , findEntryByPath, Entry)
2424import qualified Data.ByteString.Lazy as BL (ByteString)
25−import System.FilePath (takeFileName, (</>), dropFileName, normalise)
25+import System.FilePath ( takeFileName, (</>), dropFileName, normalise
26+ , joinPath, dropFileName, splitDirectories
27+ , splitFileName )
2628import qualified Text.Pandoc.UTF8 as UTF8 (toStringLazy)
2729import Control.Applicative ((<$>))
2830import Control.Monad (guard, liftM, when)
@@ -48,13 +50,12 @@ runEPUB = either error id . runExcept
4850-- Note that internal reference are aggresively normalised so that all ids
4951-- are of the form "filename#id"
5052--
51−-- For now all paths are stripped from images
5253archiveToEPUB :: (MonadError String m) => ReaderOptions -> Archive -> m (Pandoc, MediaBag)
5354archiveToEPUB os archive = do
5455 (root, content) <- getManifest archive
5556 meta <- parseMeta content
5657 (cover, items) <- parseManifest content
57− let coverDoc = fromMaybe mempty (imageToPandoc . takeFileName <$> cover)
58+ let coverDoc = fromMaybe mempty (imageToPandoc <$> cover)
5859 spine <- parseSpine items content
5960 let escapedSpine = map (escapeURI . takeFileName . fst) spine
6061 Pandoc _ bs <-
@@ -68,16 +69,19 @@ archiveToEPUB os archive = do
6869 os' = os {readerExtensions = foldr S.insert rs [Ext_epub_html_exts, Ext_raw_html]}
6970 os'' = os' {readerParseRaw = True}
7071 parseSpineElem :: MonadError String m => FilePath -> (FilePath, MIME) -> m Pandoc
71− parseSpineElem r (path, mime) = do
72+ parseSpineElem (normalise -> r) (normalise -> path, mime) = do
7273 when (readerTrace os) (traceM path)
73− doc <- mimeToReader mime (normalise (r </> path))
74+ doc <- mimeToReader mime r path
7475 let docSpan = B.doc $ B.para $ B.spanWith (takeFileName path, [], []) mempty
75− return $ docSpan <> fixInternalReferences (takeFileName path) doc
76− mimeToReader :: MonadError String m => MIME -> FilePath -> m Pandoc
77− mimeToReader "application/xhtml+xml" path = do
78− fname <- findEntryByPathE path archive
79− return $ readHtml os'' . UTF8.toStringLazy $ fromEntry fname
80− mimeToReader s path
76+ return $ docSpan <> doc
77+ mimeToReader :: MonadError String m => MIME -> FilePath -> FilePath -> m Pandoc
78+ mimeToReader "application/xhtml+xml" r path = do
79+ fname <- findEntryByPathE (r </> path) archive
80+ return $ fixInternalReferences (r </> path) .
81+ readHtml os'' .
82+ UTF8.toStringLazy $
83+ fromEntry fname
84+ mimeToReader s _ path
8185 | s `elem` imageMimes = return $ imageToPandoc path
8286 | otherwise = return $ mempty
8387
@@ -86,18 +90,34 @@ fetchImages :: [(FilePath, MIME)]
8690 -> Archive
8791 -> Pandoc
8892 -> MediaBag
89−fetchImages mimes root a (query iq -> links) =
93+fetchImages mimes root arc (query iq -> links) =
9094 foldr (uncurry3 insertMedia) mempty
9195 (mapMaybe getEntry links)
9296 where
93− getEntry l = let mediaPos = normalise (root </> l) in
94− (l , lookup mediaPos mimes, ) . fromEntry
95− <$> findEntryByPath mediaPos a
97+ getEntry (normalise -> l) =
98+ let mediaPos = normalise (root </> l) in
99+ (l , lookup mediaPos mimes, ) . fromEntry
100+ <$> findEntryByPath mediaPos arc
96101
97102iq :: Inline -> [FilePath]
98103iq (Image _ (url, _)) = [url]
99104iq _ = []
100105
106+-- Remove relative paths
107+renameImages :: FilePath -> Inline -> Inline
108+renameImages root (Image a (url, b)) = Image a (collapse (root </> url), b)
109+renameImages _ x = x
110+
111+collapse :: FilePath -> FilePath
112+collapse = joinPath . reverse . foldl go [] . splitDirectories
113+ where
114+ go rs "." = rs
115+ go r@(p:rs) ".." = case p of
116+ ".." -> ("..":r)
117+ "/" -> ("..":r)
118+ _ -> rs
119+ go _ "/" = ["/"]
120+ go rs x = x:rs
101121
102122imageToPandoc :: FilePath -> Pandoc
103123imageToPandoc s = B.doc . B.para $ B.image s "" mempty
@@ -168,11 +188,14 @@ getManifest archive = do
168188
169189-- Fixup
170190
171−fixInternalReferences :: String -> Pandoc -> Pandoc
172−fixInternalReferences s =
173− (walk normalisePath) . (walk $ fixBlockIRs s') . (walk $ fixInlineIRs s')
191+fixInternalReferences :: FilePath -> Pandoc -> Pandoc
192+fixInternalReferences pathToFile =
193+ (walk $ renameImages root)
194+ . (walk normalisePath)
195+ . (walk $ fixBlockIRs filename)
196+ . (walk $ fixInlineIRs filename)
174197 where
175− s' = escapeURI s
198+ (root, escapeURI -> filename) = splitFileName pathToFile
176199
177200fixInlineIRs :: String -> Inline -> Inline
178201fixInlineIRs s (Span as v) =
@@ -227,12 +250,12 @@ foldM' f z (x:xs) = do
227250 z' <- f z x
228251 z' `deepseq` foldM' f z' xs
229252
230−traceM :: Monad m => String -> m ()
231−traceM = flip trace (return ())
232−
233253uncurry3 :: (a -> b -> c -> d) -> (a, b, c) -> d
234254uncurry3 f (a, b, c) = f a b c
235255
256+traceM :: Monad m => String -> m ()
257+traceM = flip trace (return ())
258+
236259-- Utility
237260
238261stripNamespace :: QName -> String
@@ -270,4 +293,3 @@ findElementE e x = mkE ("Unable to find element: " ++ show e) $ findElement e x
270293
271294mkE :: MonadError String m => String -> Maybe a -> m a
272295mkE s = maybe (throwError s) return
273−
tests/features.native+19−19
@@ -49,19 +49,19 @@
4949,RawBlock (Format "html") "<section id=\"img-010\" class=\"ctest\">"
5050,Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "img-010"],Space,Str "GIF"]
5151,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Str "GIF",Space,Str "image",Space,Str "format",Space,Str "is",Space,Str "supported."]
52−,Para [Image [Str "gif",Space,Str "test"] ("check.gif","")]
52+,Para [Image [Str "gif",Space,Str "test"] ("EPUB/img/check.gif","")]
5353,Para [Str "If",Space,Str "a",Space,Str "checkmark",Space,Str "precedes",Space,Str "this",Space,Str "paragaph,",Space,Str "the",Space,Str "test",Space,Str "passes."]
5454,RawBlock (Format "html") "</section>"
5555,RawBlock (Format "html") "<section id=\"img-020\" class=\"ctest\">"
5656,Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "img-020"],Space,Str "PNG"]
5757,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Str "PNG",Space,Str "image",Space,Str "format",Space,Str "is",Space,Str "supported."]
58−,Para [Image [Str "png",Space,Str "test"] ("check.png","")]
58+,Para [Image [Str "png",Space,Str "test"] ("EPUB/img/check.png","")]
5959,Para [Str "If",Space,Str "a",Space,Str "checkmark",Space,Str "precedes",Space,Str "this",Space,Str "paragaph,",Space,Str "the",Space,Str "test",Space,Str "passes."]
6060,RawBlock (Format "html") "</section>"
6161,RawBlock (Format "html") "<section id=\"img-030\" class=\"ctest\">"
6262,Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "img-030"],Space,Str "JPEG"]
6363,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Str "JPEG",Space,Str "image",Space,Str "format",Space,Str "is",Space,Str "supported."]
64−,Para [Image [Str "jpeg",Space,Str "test"] ("check.jpg","")]
64+,Para [Image [Str "jpeg",Space,Str "test"] ("EPUB/img/check.jpg","")]
6565,Para [Str "If",Space,Str "a",Space,Str "checkmark",Space,Str "precedes",Space,Str "this",Space,Str "paragaph,",Space,Str "the",Space,Str "test",Space,Str "passes."]
6666,RawBlock (Format "html") "</section>"
6767,RawBlock (Format "html") "</section>"
@@ -197,65 +197,65 @@
197197,RawBlock (Format "html") "<section id=\"mathml-010\" class=\"ctest\">"
198198,Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "mathml-010"],Space,Str "Rendering"]
199199,Para [Str "Tests",Space,Str "whether",Space,Str "MathML",Space,Str "equation",Space,Str "rendering",Space,Str "is",Space,Str "supported."]
200−,Para [Math DisplayMath "\\int_{-\\mathrm{\8734}}^{\\mathrm{\8734}}e^{-x^{2}} dx=\\sqrt{\\pi}",Space,Math DisplayMath "\\underset{n=1}{\\overset{\\mathrm{\8734}}{\\sum}}\\frac{1}{n^{2}}=\\frac{\\pi^{2}}{6}",Space,Math DisplayMath "x=\\frac{-b\\pm\\sqrt{b^{2}-4ac}}{2a}"]
200+,Para [Math DisplayMath "\\int_{- \\infty}^{\\infty}e^{- x^{2}}\\, dx = \\sqrt{\\pi}",Space,Math DisplayMath "\\sum\\limits_{n = 1}^{\\infty}\\frac{1}{n^{2}} = \\frac{\\pi^{2}}{6}",Space,Math DisplayMath "x = \\frac{- b \\pm \\sqrt{b^{2} - 4ac}}{2a}"]
201201,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "equations",Space,Str "are",Space,Str "not",Space,Str "presented",Space,Str "as",Space,Str "linear",Space,Str "text",Space,Str "(e.g.,",Space,Str "x=-b\177b2-4ac2a),",Space,Str "the",Space,Str "test",Space,Str "passes."]
202202,RawBlock (Format "html") "</section>"
203203,RawBlock (Format "html") "<section id=\"mathml-020\" class=\"otest\">"
204204,Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[OPTIONAL]"],Space,Span ("",["test-id"],[]) [Str "mathml-020"],Space,Str "CSS",Space,Str "Styling",Space,Str "of",Space,Str "the",Space,Code ("",[],[]) "math",Space,Str "element"]
205205,Para [Str "Tests",Space,Str "whether",Space,Str "basic",Space,Str "CSS",Space,Str "styling",Space,Str "of",Space,Str "MathML",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "the",Space,Code ("",[],[]) "math",Space,Str "element."]
206−,Para [Math InlineMath "{2x}{+y-z}"]
206+,Para [Math InlineMath "{2x}{+ y - z}"]
207207,Para [Str "The",Space,Str "test",Space,Str "passes",Space,Str "if",Space,Str "the",Space,Str "equation",Space,Str "has",Space,Str "a",Space,Str "yellow",Space,Str "background",Space,Str "and",Space,Str "a",Space,Str "dashed",Space,Str "border."]
208208,Para [Str "If",Space,Str "the",Space,Str "reading",Space,Str "system",Space,Str "does",Space,Str "not",Space,Str "have",Space,Str "a",Space,Str "viewport,",Space,Str "or",Space,Str "does",Space,Str "not",Space,Str "support",Space,Str "CSS",Space,Str "styles,",Space,Str "this",Space,Str "test",Space,Str "should",Space,Str "be",Space,Str "marked",Space,Code ("",[],[]) "Not Supported",Str "."]
209209,RawBlock (Format "html") "</section>"
210210,RawBlock (Format "html") "<section id=\"mathml-021\" class=\"otest\">"
211211,Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[OPTIONAL]"],Space,Span ("",["test-id"],[]) [Str "mathml-021"],Space,Str "CSS",Space,Str "Styling",Space,Str "of",Space,Str "the",Space,Code ("",[],[]) "mo",Space,Str "element"]
212212,Para [Str "Tests",Space,Str "whether",Space,Str "basic",Space,Str "CSS",Space,Str "styling",Space,Str "of",Space,Str "MathML",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "the",Space,Code ("",[],[]) "mo",Space,Str "element."]
213−,Para [Math InlineMath "{2x}{+y-z}"]
213+,Para [Math InlineMath "{2x}{+ y - z}"]
214214,Para [Str "The",Space,Str "test",Space,Str "passes",Space,Str "if",Space,Str "the",Space,Str "operators",Space,Str "are",Space,Str "enlarged",Space,Str "relative",Space,Str "to",Space,Str "the",Space,Str "other",Space,Str "symbols",Space,Str "and",Space,Str "numbers."]
215215,Para [Str "If",Space,Str "the",Space,Str "reading",Space,Str "system",Space,Str "does",Space,Str "not",Space,Str "have",Space,Str "a",Space,Str "viewport,",Space,Str "or",Space,Str "does",Space,Str "not",Space,Str "support",Space,Str "CSS",Space,Str "styles,",Space,Str "this",Space,Str "test",Space,Str "should",Space,Str "be",Space,Str "marked",Space,Code ("",[],[]) "Not Supported",Str "."]
216216,RawBlock (Format "html") "</section>"
217217,RawBlock (Format "html") "<section id=\"mathml-022\" class=\"otest\">"
218218,Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[OPTIONAL]"],Space,Span ("",["test-id"],[]) [Str "mathml-022"],Space,Str "CSS",Space,Str "Styling",Space,Str "of",Space,Str "the",Space,Code ("",[],[]) "mi",Space,Str "element"]
219219,Para [Str "Tests",Space,Str "whether",Space,Str "basic",Space,Str "CSS",Space,Str "styling",Space,Str "of",Space,Str "MathML",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "the",Space,Code ("",[],[]) "mi",Space,Str "element."]
220−,Para [Math InlineMath "{2x}{+y-z}"]
220+,Para [Math InlineMath "{2x}{+ y - z}"]
221221,Para [Str "The",Space,Str "test",Space,Str "passes",Space,Str "if",Space,Str "the",Space,Str "identifiers",Space,Str "are",Space,Str "bolded",Space,Str "and",Space,Str "blue."]
222222,Para [Str "If",Space,Str "the",Space,Str "reading",Space,Str "system",Space,Str "does",Space,Str "not",Space,Str "have",Space,Str "a",Space,Str "viewport,",Space,Str "or",Space,Str "does",Space,Str "not",Space,Str "support",Space,Str "CSS",Space,Str "styles,",Space,Str "this",Space,Str "test",Space,Str "should",Space,Str "be",Space,Str "marked",Space,Code ("",[],[]) "Not Supported",Str "."]
223223,RawBlock (Format "html") "</section>"
224224,RawBlock (Format "html") "<section id=\"mathml-023\" class=\"otest\">"
225225,Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[OPTIONAL]"],Space,Span ("",["test-id"],[]) [Str "mathml-023"],Space,Str "CSS",Space,Str "Styling",Space,Str "of",Space,Str "the",Space,Code ("",[],[]) "mn",Space,Str "element"]
226226,Para [Str "Tests",Space,Str "whether",Space,Str "basic",Space,Str "CSS",Space,Str "styling",Space,Str "of",Space,Str "MathML",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "the",Space,Code ("",[],[]) "mn",Space,Str "element."]
227−,Para [Math InlineMath "{2x}{+y-z}"]
227+,Para [Math InlineMath "{2x}{+ y - z}"]
228228,Para [Str "The",Space,Str "test",Space,Str "passes",Space,Str "if",Space,Str "the",Space,Str "number",Space,Str "2",Space,Str "is",Space,Str "italicized",Space,Str "and",Space,Str "blue."]
229229,Para [Str "If",Space,Str "the",Space,Str "reading",Space,Str "system",Space,Str "does",Space,Str "not",Space,Str "have",Space,Str "a",Space,Str "viewport,",Space,Str "or",Space,Str "does",Space,Str "not",Space,Str "support",Space,Str "CSS",Space,Str "styles,",Space,Str "this",Space,Str "test",Space,Str "should",Space,Str "be",Space,Str "marked",Space,Code ("",[],[]) "Not Supported",Str "."]
230230,RawBlock (Format "html") "</section>"
231231,RawBlock (Format "html") "<section id=\"mathml-024\" class=\"ctest\">"
232232,Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "mathml-024"],Str "Horizontal",Space,Str "stretch,",Space,Code ("",[],[]) "mover",Str ",",Space,Code ("",[],[]) "munder",Str ",",Space,Str "and",Space,Code ("",[],[]) "mspace",Space,Str "elements"]
233233,Para [Str "Tests",Space,Str "whether",Space,Str "horizontal",Space,Str "stretch,",Space,Code ("",[],[]) "mover",Str ",",Space,Code ("",[],[]) "munder",Str ",",Space,Code ("",[],[]) "mspace",Space,Str "elements",Space,Str "are",Space,Str "supported."]
234−,Para [Math DisplayMath "c=\\overset{\\mathrm{complex\\ number}}{\\overbrace{\\underset{\\mathrm{real}}{\\underbrace{\\qquad a\\qquad}}+\\underset{\\mathrm{imaginary}}{\\underbrace{\\quad bi\\quad}}}}"]
235−,Para [Str "The",Space,Str "test",Space,Str "passes",Space,Str "if",Space,Str "the",Space,Str "rendering",Space,Str "looks",Space,Str "like",Space,Image [Str "description",Space,Str "of",Space,Str "imaginary",Space,Str "number:",Space,Str "c",Space,Str "=",Space,Str "a",Space,Str "+bi",Space,Str "with",Space,Str "an",Space,Str "overbrace",Space,Str "reading",Space,Str "'complex",Space,Str "number'",Space,Str "and",Space,Str "underbraces",Space,Str "below",Space,Str "'a'",Space,Str "and",Space,Str "'b",Space,Str "i'",Space,Str "reading",Space,Str "'real'",Space,Str "and",Space,Str "'imaginary'",Space,Str "respectively."] ("complex_number.png",""),Str "."]
234+,Para [Math DisplayMath "c = \\overset{\\text{complex\\ number}}{\\overbrace{\\underset{\\text{real}}{\\underbrace{\\qquad a\\qquad}} + \\underset{\\text{imaginary}}{\\underbrace{\\quad b{\\mathbb{i}}\\quad}}}}"]
235+,Para [Str "The",Space,Str "test",Space,Str "passes",Space,Str "if",Space,Str "the",Space,Str "rendering",Space,Str "looks",Space,Str "like",Space,Image [Str "description",Space,Str "of",Space,Str "imaginary",Space,Str "number:",Space,Str "c",Space,Str "=",Space,Str "a",Space,Str "+bi",Space,Str "with",Space,Str "an",Space,Str "overbrace",Space,Str "reading",Space,Str "'complex",Space,Str "number'",Space,Str "and",Space,Str "underbraces",Space,Str "below",Space,Str "'a'",Space,Str "and",Space,Str "'b",Space,Str "i'",Space,Str "reading",Space,Str "'real'",Space,Str "and",Space,Str "'imaginary'",Space,Str "respectively."] ("EPUB/img/complex_number.png",""),Str "."]
236236,RawBlock (Format "html") "</section>"
237237,RawBlock (Format "html") "<section id=\"mathml-025\" class=\"ctest\">"
238238,Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "mathml-025"],Str "Testing",Space,Code ("",[],[]) "mtable",Space,Str "with",Space,Code ("",[],[]) "colspan",Space,Str "and",Space,Code ("",[],[]) "rowspan",Space,Str "attributes,",Space,Str "Hebrew",Space,Str "and",Space,Str "Script",Space,Str "fonts"]
239239,Para [Str "Tests",Space,Str "whether",Space,Code ("",[],[]) "mtable",Space,Str "with",Space,Code ("",[],[]) "colspan",Space,Str "and",Space,Code ("",[],[]) "mspace",Space,Str "attributes",Space,Str "(colum",Space,Str "and",Space,Str "row",Space,Str "spanning)",Space,Str "are",Space,Str "supported;",Space,Str "uses",Space,Str "Hebrew",Space,Str "and",Space,Str "Script",Space,Str "alphabets."]
240−,Para [Math DisplayMath "\\begin{array}{llllllllll}\n & \\operatorname{cov}\\left(\\operatorname{\\mathcal{L}}\\right) & \\longrightarrow & \\operatorname{non}\\left(\\operatorname{\\mathcal{K}}\\right) & \\longrightarrow & \\operatorname{cof}\\left(\\operatorname{\\mathcal{K}}\\right) & \\longrightarrow & \\operatorname{cof}\\left(\\operatorname{\\mathcal{L}}\\right) & \\longrightarrow & 2^{\\aleph_{0}} \\\\\n & \\uparrow & & \\uparrow & & \\uparrow & & \\uparrow & & \\\\\n & \\operatorname{\\mathfrak{b}} & \\longrightarrow & \\operatorname{\\mathfrak{d}} & & & & & & \\\\\n & \\uparrow & & \\uparrow & & & & & & \\\\\n\\aleph_{1} & \\longrightarrow & \\operatorname{add}\\left(\\operatorname{\\mathcal{L}}\\right) & \\longrightarrow & \\operatorname{add}\\left(\\operatorname{\\mathcal{K}}\\right) & \\longrightarrow & \\operatorname{cov}\\left(\\operatorname{\\mathcal{K}}\\right) & \\longrightarrow & \\operatorname{non}\\left(\\operatorname{\\mathcal{L}}\\right) & \\\\\n\\end{array}"]
241−,Para [Str "The",Space,Str "test",Space,Str "passes",Space,Str "if",Space,Str "the",Space,Str "rendering",Space,Str "looks",Space,Str "like",Space,Link [Str "Cicho\324's",Space,Str "Diagram"] ("Cicho%C5%84's_diagram",""),Str ":",Space,Image [Str "rendering",Space,Str "of",Space,Str "Cicho\324's",Space,Str "diagram."] ("cichons_diagram.png",""),Str "."]
240+,Para [Math DisplayMath "\\begin{array}{llllllllll}\n & {\\operatorname{cov}\\left( \\mathcal{L} \\right)} & \\longrightarrow & {\\operatorname{non}\\left( \\mathcal{K} \\right)} & \\longrightarrow & {\\operatorname{cof}\\left( \\mathcal{K} \\right)} & \\longrightarrow & {\\operatorname{cof}\\left( \\mathcal{L} \\right)} & \\longrightarrow & 2^{\\aleph_{0}} \\\\\n & \\uparrow & & \\uparrow & & \\uparrow & & \\uparrow & & \\\\\n & {\\mathfrak{b}} & \\longrightarrow & {\\mathfrak{d}} & & & & & & \\\\\n & \\uparrow & & \\uparrow & & & & & & \\\\\n\\aleph_{1} & \\longrightarrow & {\\operatorname{add}\\left( \\mathcal{L} \\right)} & \\longrightarrow & {\\operatorname{add}\\left( \\mathcal{K} \\right)} & \\longrightarrow & {\\operatorname{cov}\\left( \\mathcal{K} \\right)} & \\longrightarrow & {\\operatorname{non}\\left( \\mathcal{L} \\right)} & \\\\\n\\end{array}"]
241+,Para [Str "The",Space,Str "test",Space,Str "passes",Space,Str "if",Space,Str "the",Space,Str "rendering",Space,Str "looks",Space,Str "like",Space,Link [Str "Cicho\324's",Space,Str "Diagram"] ("Cicho%C5%84's_diagram",""),Str ":",Space,Image [Str "rendering",Space,Str "of",Space,Str "Cicho\324's",Space,Str "diagram."] ("EPUB/img/cichons_diagram.png",""),Str "."]
242242,RawBlock (Format "html") "</section>"
243243,RawBlock (Format "html") "<section id=\"mathml-026\" class=\"ctest\">"
244244,Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "mathml-026"],Str "BiDi,",Space,Str "RTL",Space,Str "and",Space,Str "Arabic",Space,Str "alphabets"]
245245,Para [Str "Tests",Space,Str "whether",Space,Str "right-to-left",Space,Str "and",Space,Str "Arabic",Space,Str "alphabets",Space,Str "are",Space,Str "supported."]
246−,Para [Math DisplayMath "{d{\\left(s\\right)}}={\\left\\{\\begin{array}{ll}\n{\\underset{\\operatorname{\\lbrack?\\rbrack}=1}{\\overset{S}{\\sum}}s^{\\operatorname{\\lbrack?\\rbrack}}} & {\\mathrm{\1573\1584\1575\1603\1575\1606}s>0} \\\\\n{\\int_{1}^{S}{s^{\\operatorname{\\lbrack?\\rbrack}}\\operatorname{}s}} & {\\mathrm{\1573\1584\1575\1603\1575\1606}s\\in m} \\\\\n{T\\pi} & {\\mathrm{\1594\1610\1585\1584\1604\1603}{\\left(\\mathrm{\1605\1593}\\pi\\simeq 3,141\\right)}} \\\\\n\\end{array}\\right.}"]
247−,Para [Str "The",Space,Str "test",Space,Str "passes",Space,Str "if",Space,Str "the",Space,Str "rendering",Space,Str "looks",Space,Str "like",Space,Str "the",Space,Str "following",Space,Str "image:",Space,Image [Str "a",Space,Str "piecewise",Space,Str "defined",Space,Str "function",Space,Str "in",Space,Str "Maghreb-style",Space,Str "notation"] ("Maghreb1.png",""),Str "."]
246+,Para [Math DisplayMath "{d\\left( s \\right)} = \\begin{cases}\n{\\sum\\limits_{{\\lbrack?\\rbrack} = 1}^{S}s^{\\lbrack?\\rbrack}} & {\\text{\1573\1584\1575\1603\1575\1606}s > 0} \\\\\n{\\int_{1}^{S}{s^{\\lbrack?\\rbrack}s}} & {\\text{\1573\1584\1575\1603\1575\1606}s \\in m} \\\\\n{T\\pi} & {\\text{\1594\1610\1585\1584\1604\1603}\\left( \\text{\1605\1593}\\pi \\simeq 3,141 \\right)} \\\\\n\\end{cases}"]
247+,Para [Str "The",Space,Str "test",Space,Str "passes",Space,Str "if",Space,Str "the",Space,Str "rendering",Space,Str "looks",Space,Str "like",Space,Str "the",Space,Str "following",Space,Str "image:",Space,Image [Str "a",Space,Str "piecewise",Space,Str "defined",Space,Str "function",Space,Str "in",Space,Str "Maghreb-style",Space,Str "notation"] ("EPUB/img/Maghreb1.png",""),Str "."]
248248,RawBlock (Format "html") "</section>"
249249,RawBlock (Format "html") "<section id=\"mathml-027\" class=\"ctest\">"
250250,Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "mathml-027"],Str "Elementary",Space,Str "math:",Space,Str "long",Space,Str "division",Space,Str "notation"]
251251,Para [Str "Tests",Space,Str "whether",Space,Code ("",[],[]) "mlongdiv",Space,Str "elements",Space,Str "(from",Space,Str "elementary",Space,Str "math)",Space,Str "are",Space,Str "supported."]
252−,Para [Str "The",Space,Str "test",Space,Str "passes",Space,Str "if",Space,Str "the",Space,Str "rendering",Space,Str "looks",Space,Str "like",Space,Str "the",Space,Str "following",Space,Str "image:",Space,Image [Str "A",Space,Str "long",Space,Str "division",Space,Str "dividing",Space,Str "1306",Space,Str "by",Space,Str "3,",Space,Str "presented",Space,Str "in",Space,Str "'lefttop'",Space,Str "(US)",Space,Str "notation"] ("ElementaryMathExample.png",""),Str "."]
252+,Para [Str "The",Space,Str "test",Space,Str "passes",Space,Str "if",Space,Str "the",Space,Str "rendering",Space,Str "looks",Space,Str "like",Space,Str "the",Space,Str "following",Space,Str "image:",Space,Image [Str "A",Space,Str "long",Space,Str "division",Space,Str "dividing",Space,Str "1306",Space,Str "by",Space,Str "3,",Space,Str "presented",Space,Str "in",Space,Str "'lefttop'",Space,Str "(US)",Space,Str "notation"] ("EPUB/img/ElementaryMathExample.png",""),Str "."]
253253,RawBlock (Format "html") "</section>"
254254,RawBlock (Format "html") "<section id=\"mathml-028\" class=\"ctest\">"
255255,Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "mathml-028"],Str "Multiscripts,",Space,Str "Greek",Space,Str "and",Space,Str "Gothic",Space,Str "alphabets"]
256256,Para [Str "Tests",Space,Str "whether",Space,Code ("",[],[]) "mmultiscript",Space,Str "elements",Space,Str "as",Space,Str "well",Space,Str "as",Space,Str "Greek",Space,Str "and",Space,Str "Gothic",Space,Str "alphabets",Space,Str "are",Space,Str "supported."]
257257,Para [Math DisplayMath "\\underset{}{\\overset{}{}}"]
258−,Para [Str "The",Space,Str "test",Space,Str "passes",Space,Str "if",Space,Str "the",Space,Str "rendering",Space,Str "looks",Space,Str "like",Space,Str "the",Space,Str "following",Space,Str "image:",Space,Image [Str "a",Space,Str "large",Space,Str "capital",Space,Str "Pi",Space,Str "with",Space,Str "Gothic",Space,Str "characters",Space,Str "as",Space,Str "multiscripts",Space,Str "which",Space,Str "in",Space,Str "turn",Space,Str "have",Space,Str "Greek",Space,Str "multiscripts"] ("multiscripts_and_greek_alphabet.png",""),Str "."]
258+,Para [Str "The",Space,Str "test",Space,Str "passes",Space,Str "if",Space,Str "the",Space,Str "rendering",Space,Str "looks",Space,Str "like",Space,Str "the",Space,Str "following",Space,Str "image:",Space,Image [Str "a",Space,Str "large",Space,Str "capital",Space,Str "Pi",Space,Str "with",Space,Str "Gothic",Space,Str "characters",Space,Str "as",Space,Str "multiscripts",Space,Str "which",Space,Str "in",Space,Str "turn",Space,Str "have",Space,Str "Greek",Space,Str "multiscripts"] ("EPUB/img/multiscripts_and_greek_alphabet.png",""),Str "."]
259259,RawBlock (Format "html") "</section>"
260260,RawBlock (Format "html") "</section>"
261261,Para [Span ("content-svg-001.xhtml",[],[]) []]
@@ -371,7 +371,7 @@
371371,RawBlock (Format "html") "<section id=\"svg-410\" class=\"ctest\">"
372372,Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "svg-410"],Space,Code ("",[],[]) "img"]
373373,Para [Str "Tests",Space,Str "whether",Space,Str "SVG",Space,Str "is",Space,Str "supported",Space,Str "in",Space,Code ("",[],[]) "img",Space,Str "elements."]
374−,Para [Image [Str "a",Space,Str "grey",Space,Str "circle"] ("circle.svg","")]
374+,Para [Image [Str "a",Space,Str "grey",Space,Str "circle"] ("EPUB/svg/circle.svg","")]
375375,Para [Str "If",Space,Str "a",Space,Str "grey",Space,Str "circle",Space,Str "is",Space,Str "rendered",Space,Str "before",Space,Str "this",Space,Str "paragraph,",Space,Str "the",Space,Str "test",Space,Str "passes."]
376376,RawBlock (Format "html") "</section>"
377377,RawBlock (Format "html") "<section id=\"svg-420\" class=\"ctest\">"
@@ -427,7 +427,7 @@
427427,RawBlock (Format "html") "<section id=\"fallback-010\" class=\"ctest\">"
428428,Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "fallback-010"],Space,Str "Image",Space,Str "fallbacks"]
429429,Para [Str "Tests",Space,Str "whether",Space,Str "manifest",Space,Str "fallbacks",Space,Str "for",Space,Str "non-core",Space,Str "image",Space,Str "media",Space,Str "types",Space,Str "are",Space,Str "supported."]
430−,Para [Image [Str "test"] ("nonimage.xyz","")]
430+,Para [Image [Str "test"] ("EPUB/img/nonimage.xyz","")]
431431,Para [Str "If",Space,Str "an",Space,Str "image",Space,Str "of",Space,Str "a",Space,Str "checkmark",Space,Str "is",Space,Str "rendered",Space,Str "before",Space,Str "this",Space,Str "paragraph,",Space,Str "the",Space,Str "test",Space,Str "passes."]
432432,RawBlock (Format "html") "</section>"
433433,RawBlock (Format "html") "<section id=\"fallback-020\" class=\"ctest\">"
@@ -469,7 +469,7 @@
469469,RawBlock (Format "html") "<section id=\"switch-020\" class=\"otest\">"
470470,Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[OPTIONAL]"],Space,Span ("",["test-id"],[]) [Str "switch-020"],Space,Str "MathML",Space,Str "Embedding"]
471471,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Str "MathML",Space,Str "namespace",Space,Str "is",Space,Str "recognized",Space,Str "when",Space,Str "used",Space,Str "in",Space,Str "an",Space,Code ("",[],[]) "epub:case",Space,Str "element."]
472−,Para [Math InlineMath "{2x}{+y-z}"]
472+,Para [Math InlineMath "{2x}{+ y - z}"]
473473,Para [Str "If",Space,Str "a",Space,Str "MathML",Space,Str "equation",Space,Str "is",Space,Str "rendered",Space,Str "before",Space,Str "this",Space,Str "paragraph,",Space,Str "the",Space,Str "test",Space,Str "passes."]
474474,Para [Str "If",Space,Str "test",Space,Code ("",[],[]) "switch-010",Space,Str "did",Space,Str "not",Space,Str "pass,",Space,Str "this",Space,Str "test",Space,Str "should",Space,Str "be",Space,Str "marked",Space,Code ("",[],[]) "Not Supported",Str "."]
475475,RawBlock (Format "html") "</section>"