git.iko.soy/typeable/pandoc
on master help sign in
Merge pull request #1644 from mpickering/master
5bab957John MacFarlane
README+12−1
@@ -710,6 +710,16 @@ Math rendering in HTML
710 formulas to images. The formula will be concatenated with the URL
710 formulas to images. The formula will be concatenated with the URL
711 provided. If *URL* is not specified, the Google Chart API will be used.
711 provided. If *URL* is not specified, the Google Chart API will be used.
712
712
713+`--katex`[=*URL*]
714+: Use [KaTeX] to display embedded TeX math in HTML output.
715+ The *URL* should point to the `katex.js` load script. If a *URL* is
716+ not provided, a link to the KaTeX CDN will be inserted.
717+
718+`--katex-stylesheet=*URL*`
719+: The *URL* should point to the `katex.css` stylesheet. If this option is
720+ not specified, a link to the KaTeX CDN will be inserted. Note that this
721+ option does not imply `--katex`.
722+
713Options for wrapper scripts
723Options for wrapper scripts
714---------------------------
724---------------------------
715
725
@@ -1652,7 +1662,7 @@ proportionally spaced fonts, as it does not require lining up columns.
1652
1662
1653#### Extension: `table_captions` ####
1663#### Extension: `table_captions` ####
1654
1664
1655−A caption may optionally be provided with all 4 kinds of tables (as
1665+A caption may optionally be provided with all 4 kinds of tables (as
1656illustrated in the examples below). A caption is a paragraph beginning
1666illustrated in the examples below). A caption is a paragraph beginning
1657with the string `Table:` (or just `:`), which will be stripped off.
1667with the string `Table:` (or just `:`), which will be stripped off.
1658It may appear either before or after the table.
1668It may appear either before or after the table.
@@ -3177,3 +3187,4 @@ Rosenthal.
3177[txt2tags]: http://txt2tags.org/
3187[txt2tags]: http://txt2tags.org/
3178[EPUB]: http://idpf.org/epub
3188[EPUB]: http://idpf.org/epub
3179[EPUBspine]: http://www.idpf.org/epub/301/spec/epub-publications.html#sec-spine-elem
3189[EPUBspine]: http://www.idpf.org/epub/301/spec/epub-publications.html#sec-spine-elem
3190+[KaTeX]: https://github.com/Khan/KaTeX
pandoc.hs+32−3
@@ -58,7 +58,7 @@ import qualified Control.Exception as E
58import Control.Exception.Extensible ( throwIO )
58import Control.Exception.Extensible ( throwIO )
59import qualified Text.Pandoc.UTF8 as UTF8
59import qualified Text.Pandoc.UTF8 as UTF8
60import Control.Monad (when, unless, (>=>))
60import Control.Monad (when, unless, (>=>))
61−import Data.Maybe (isJust)
61+import Data.Maybe (isJust, fromMaybe)
62import Data.Foldable (foldrM)
62import Data.Foldable (foldrM)
63import Network.URI (parseURI, isURI, URI(..))
63import Network.URI (parseURI, isURI, URI(..))
64import qualified Data.ByteString.Lazy as B
64import qualified Data.ByteString.Lazy as B
@@ -68,7 +68,7 @@ import qualified Data.Map as M
68import Data.Yaml (decode)
68import Data.Yaml (decode)
69import qualified Data.Yaml as Yaml
69import qualified Data.Yaml as Yaml
70import qualified Data.Text as T
70import qualified Data.Text as T
71−import Control.Applicative ((<$>))
71+import Control.Applicative ((<$>), (<|>))
72import Text.Pandoc.Readers.Txt2Tags (getT2TMeta)
72import Text.Pandoc.Readers.Txt2Tags (getT2TMeta)
73import Data.Monoid
73import Data.Monoid
74
74
@@ -205,6 +205,8 @@ data Opt = Opt
205 , optExtractMedia :: Maybe FilePath -- ^ Path to extract embedded media
205 , optExtractMedia :: Maybe FilePath -- ^ Path to extract embedded media
206 , optTrace :: Bool -- ^ Print debug information
206 , optTrace :: Bool -- ^ Print debug information
207 , optTrackChanges :: TrackChanges -- ^ Accept or reject MS Word track-changes.
207 , optTrackChanges :: TrackChanges -- ^ Accept or reject MS Word track-changes.
208+ , optKaTeXStylesheet :: Maybe String -- ^ Path to stylesheet for KaTeX
209+ , optKaTeXJS :: Maybe String -- ^ Path to js file for KaTeX
208 }
210 }
209
211
210-- | Defaults for command-line options.
212-- | Defaults for command-line options.
@@ -263,6 +265,8 @@ defaultOpts = Opt
263 , optExtractMedia = Nothing
265 , optExtractMedia = Nothing
264 , optTrace = False
266 , optTrace = False
265 , optTrackChanges = AcceptChanges
267 , optTrackChanges = AcceptChanges
268+ , optKaTeXStylesheet = Nothing
269+ , optKaTeXJS = Nothing
266 }
270 }
267
271
268-- | A list of functions, each transforming the options data structure
272-- | A list of functions, each transforming the options data structure
@@ -818,6 +822,21 @@ options =
818 return opt { optHTMLMathMethod = MathJax url'})
822 return opt { optHTMLMathMethod = MathJax url'})
819 "URL")
823 "URL")
820 "" -- "Use MathJax for HTML math"
824 "" -- "Use MathJax for HTML math"
825+ , Option "" ["katex"]
826+ (OptArg
827+ (\arg opt ->
828+ return opt
829+ { optKaTeXJS =
830+ arg <|> Just "http://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.1.0/katex.min.js"})
831+ "URL")
832+ "" -- Use KaTeX for HTML Math
833+
834+ , Option "" ["katex-stylesheet"]
835+ (ReqArg
836+ (\arg opt ->
837+ return opt { optKaTeXStylesheet = Just arg })
838+ "URL")
839+ "" -- Set the KaTeX Stylesheet location
821
840
822 , Option "" ["gladtex"]
841 , Option "" ["gladtex"]
823 (NoArg
842 (NoArg
@@ -860,6 +879,7 @@ options =
860
879
861 ]
880 ]
862
881
882+
863addMetadata :: String -> MetaValue -> M.Map String MetaValue
883addMetadata :: String -> MetaValue -> M.Map String MetaValue
864 -> M.Map String MetaValue
884 -> M.Map String MetaValue
865addMetadata k v m = case M.lookup k m of
885addMetadata k v m = case M.lookup k m of
@@ -1027,7 +1047,7 @@ main = do
1027 , optHighlight = highlight
1047 , optHighlight = highlight
1028 , optHighlightStyle = highlightStyle
1048 , optHighlightStyle = highlightStyle
1029 , optChapters = chapters
1049 , optChapters = chapters
1030− , optHTMLMathMethod = mathMethod
1050+ , optHTMLMathMethod = mathMethod'
1031 , optReferenceODT = referenceODT
1051 , optReferenceODT = referenceODT
1032 , optReferenceDocx = referenceDocx
1052 , optReferenceDocx = referenceDocx
1033 , optEpubStylesheet = epubStylesheet
1053 , optEpubStylesheet = epubStylesheet
@@ -1056,6 +1076,8 @@ main = do
1056 , optExtractMedia = mbExtractMedia
1076 , optExtractMedia = mbExtractMedia
1057 , optTrace = trace
1077 , optTrace = trace
1058 , optTrackChanges = trackChanges
1078 , optTrackChanges = trackChanges
1079+ , optKaTeXStylesheet = katexStylesheet
1080+ , optKaTeXJS = katexJS
1059 } = opts
1081 } = opts
1060
1082
1061 when dumpArgs $
1083 when dumpArgs $
@@ -1063,6 +1085,13 @@ main = do
1063 mapM_ (\arg -> UTF8.hPutStrLn stdout arg) args
1085 mapM_ (\arg -> UTF8.hPutStrLn stdout arg) args
1064 exitWith ExitSuccess
1086 exitWith ExitSuccess
1065
1087
1088+ let csscdn = "http://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.1.0/katex.min.css"
1089+ let mathMethod =
1090+ case (katexJS, katexStylesheet) of
1091+ (Nothing, _) -> mathMethod'
1092+ (Just js, ss) -> KaTeX js (fromMaybe csscdn ss)
1093+
1094+
1066 -- --bibliography implies -F pandoc-citeproc for backwards compatibility:
1095 -- --bibliography implies -F pandoc-citeproc for backwards compatibility:
1067 let needsCiteproc = isJust (M.lookup "bibliography" metadata) &&
1096 let needsCiteproc = isJust (M.lookup "bibliography" metadata) &&
1068 optCiteMethod opts `notElem` [Natbib, Biblatex] &&
1097 optCiteMethod opts `notElem` [Natbib, Biblatex] &&
src/Text/Pandoc/MediaBag.hs+5−5
@@ -51,7 +51,7 @@ import System.IO (stderr)
51-- mime types. Note that a 'MediaBag' is a Monoid, so 'mempty'
51-- mime types. Note that a 'MediaBag' is a Monoid, so 'mempty'
52-- can be used for an empty 'MediaBag', and '<>' can be used to append
52-- can be used for an empty 'MediaBag', and '<>' can be used to append
53-- two 'MediaBag's.
53-- two 'MediaBag's.
54−newtype MediaBag = MediaBag (M.Map String (MimeType, BL.ByteString))
54+newtype MediaBag = MediaBag (M.Map [String] (MimeType, BL.ByteString))
55 deriving (Monoid)
55 deriving (Monoid)
56
56
57instance Show MediaBag where
57instance Show MediaBag where
@@ -65,7 +65,7 @@ insertMedia :: FilePath -- ^ relative path and canonical name of resource
65 -> MediaBag
65 -> MediaBag
66 -> MediaBag
66 -> MediaBag
67insertMedia fp mbMime contents (MediaBag mediamap) =
67insertMedia fp mbMime contents (MediaBag mediamap) =
68− MediaBag (M.insert fp (mime, contents) mediamap)
68+ MediaBag (M.insert (splitPath fp) (mime, contents) mediamap)
69 where mime = fromMaybe fallback mbMime
69 where mime = fromMaybe fallback mbMime
70 fallback = case takeExtension fp of
70 fallback = case takeExtension fp of
71 ".gz" -> getMimeTypeDef $ dropExtension fp
71 ".gz" -> getMimeTypeDef $ dropExtension fp
@@ -75,14 +75,14 @@ insertMedia fp mbMime contents (MediaBag mediamap) =
75lookupMedia :: FilePath
75lookupMedia :: FilePath
76 -> MediaBag
76 -> MediaBag
77 -> Maybe (MimeType, BL.ByteString)
77 -> Maybe (MimeType, BL.ByteString)
78−lookupMedia fp (MediaBag mediamap) = M.lookup fp mediamap
78+lookupMedia fp (MediaBag mediamap) = M.lookup (splitPath fp) mediamap
79
79
80-- | Get a list of the file paths stored in a 'MediaBag', with
80-- | Get a list of the file paths stored in a 'MediaBag', with
81-- their corresponding mime types and the lengths in bytes of the contents.
81-- their corresponding mime types and the lengths in bytes of the contents.
82mediaDirectory :: MediaBag -> [(String, MimeType, Int)]
82mediaDirectory :: MediaBag -> [(String, MimeType, Int)]
83mediaDirectory (MediaBag mediamap) =
83mediaDirectory (MediaBag mediamap) =
84 M.foldWithKey (\fp (mime,contents) ->
84 M.foldWithKey (\fp (mime,contents) ->
85− ((fp, mime, fromIntegral $ BL.length contents):)) [] mediamap
85+ (((joinPath fp), mime, fromIntegral $ BL.length contents):)) [] mediamap
86
86
87-- | Extract contents of MediaBag to a given directory. Print informational
87-- | Extract contents of MediaBag to a given directory. Print informational
88-- messages if 'verbose' is true.
88-- messages if 'verbose' is true.
@@ -93,7 +93,7 @@ extractMediaBag :: Bool
93extractMediaBag verbose dir (MediaBag mediamap) = do
93extractMediaBag verbose dir (MediaBag mediamap) = do
94 sequence_ $ M.foldWithKey
94 sequence_ $ M.foldWithKey
95 (\fp (_ ,contents) ->
95 (\fp (_ ,contents) ->
96− ((writeMedia verbose dir (fp, contents)):)) [] mediamap
96+ ((writeMedia verbose dir (joinPath fp, contents)):)) [] mediamap
97
97
98writeMedia :: Bool -> FilePath -> (FilePath, BL.ByteString) -> IO ()
98writeMedia :: Bool -> FilePath -> (FilePath, BL.ByteString) -> IO ()
99writeMedia verbose dir (subpath, bs) = do
99writeMedia verbose dir (subpath, bs) = do
src/Text/Pandoc/Options.hs+1
@@ -251,6 +251,7 @@ data HTMLMathMethod = PlainMath
251 | WebTeX String -- url of TeX->image script.
251 | WebTeX String -- url of TeX->image script.
252 | MathML (Maybe String) -- url of MathMLinHTML.js
252 | MathML (Maybe String) -- url of MathMLinHTML.js
253 | MathJax String -- url of MathJax.js
253 | MathJax String -- url of MathJax.js
254+ | KaTeX String String -- url of stylesheet and katex.js
254 deriving (Show, Read, Eq)
255 deriving (Show, Read, Eq)
255
256
256data CiteMethod = Citeproc -- use citeproc to render them
257data CiteMethod = Citeproc -- use citeproc to render them
src/Text/Pandoc/Readers/HTML.hs+6−1
@@ -440,7 +440,7 @@ pCodeBlock :: TagParser Blocks
440pCodeBlock = try $ do
440pCodeBlock = try $ do
441 TagOpen _ attr <- pSatisfy (~== TagOpen "pre" [])
441 TagOpen _ attr <- pSatisfy (~== TagOpen "pre" [])
442 contents <- manyTill pAnyTag (pCloses "pre" <|> eof)
442 contents <- manyTill pAnyTag (pCloses "pre" <|> eof)
443− let rawText = concatMap fromTagText $ filter isTagText contents
443+ let rawText = concatMap tagToString contents
444 -- drop leading newline if any
444 -- drop leading newline if any
445 let result' = case rawText of
445 let result' = case rawText of
446 '\n':xs -> xs
446 '\n':xs -> xs
@@ -451,6 +451,11 @@ pCodeBlock = try $ do
451 _ -> result'
451 _ -> result'
452 return $ B.codeBlockWith (mkAttr attr) result
452 return $ B.codeBlockWith (mkAttr attr) result
453
453
454+tagToString :: Tag String -> String
455+tagToString (TagText s) = s
456+tagToString (TagOpen "br" _) = "\n"
457+tagToString _ = ""
458+
454inline :: TagParser Inlines
459inline :: TagParser Inlines
455inline = choice
460inline = choice
456 [ eNoteref
461 [ eNoteref
src/Text/Pandoc/Readers/Org.hs+1−1
@@ -863,7 +863,7 @@ definitionListItem parseMarkerGetLength = try $ do
863 line1 <- anyLineNewline
863 line1 <- anyLineNewline
864 blank <- option "" ("\n" <$ blankline)
864 blank <- option "" ("\n" <$ blankline)
865 cont <- concat <$> many (listContinuation markerLength)
865 cont <- concat <$> many (listContinuation markerLength)
866− term' <- parseFromString inline term
866+ term' <- parseFromString parseInlines term
867 contents' <- parseFromString parseBlocks $ line1 ++ blank ++ cont
867 contents' <- parseFromString parseBlocks $ line1 ++ blank ++ cont
868 return $ (,) <$> term' <*> fmap (:[]) contents'
868 return $ (,) <$> term' <*> fmap (:[]) contents'
869
869
src/Text/Pandoc/Shared.hs+9−5
@@ -1,5 +1,6 @@
1{-# LANGUAGE DeriveDataTypeable, CPP, MultiParamTypeClasses,
1{-# LANGUAGE DeriveDataTypeable, CPP, MultiParamTypeClasses,
2− FlexibleContexts, ScopedTypeVariables, PatternGuards #-}
2+ FlexibleContexts, ScopedTypeVariables, PatternGuards,
3+ ViewPatterns #-}
3{-
4{-
4Copyright (C) 2006-2014 John MacFarlane <jgm@berkeley.edu>
5Copyright (C) 2006-2014 John MacFarlane <jgm@berkeley.edu>
5
6
@@ -106,7 +107,7 @@ import Network.URI ( escapeURIString, isURI, nonStrictRelativeTo,
106 unEscapeString, parseURIReference, isAllowedInURI )
107 unEscapeString, parseURIReference, isAllowedInURI )
107import qualified Data.Set as Set
108import qualified Data.Set as Set
108import System.Directory
109import System.Directory
109−import System.FilePath (joinPath, splitDirectories)
110+import System.FilePath (joinPath, splitDirectories, pathSeparator, isPathSeparator)
110import Text.Pandoc.MIME (MimeType, getMimeType)
111import Text.Pandoc.MIME (MimeType, getMimeType)
111import System.FilePath ( (</>), takeExtension, dropExtension)
112import System.FilePath ( (</>), takeExtension, dropExtension)
112import Data.Generics (Typeable, Data)
113import Data.Generics (Typeable, Data)
@@ -871,11 +872,14 @@ collapseFilePath = joinPath . reverse . foldl go [] . splitDirectories
871 go rs "." = rs
872 go rs "." = rs
872 go r@(p:rs) ".." = case p of
873 go r@(p:rs) ".." = case p of
873 ".." -> ("..":r)
874 ".." -> ("..":r)
874− "/" -> ("..":r)
875+ (checkPathSeperator -> Just True) -> ("..":r)
875 _ -> rs
876 _ -> rs
876− go _ "/" = ["/"]
877+ go _ (checkPathSeperator -> Just True) = [[pathSeparator]]
877 go rs x = x:rs
878 go rs x = x:rs
878−
879+ isSingleton [] = Nothing
880+ isSingleton [x] = Just x
881+ isSingleton _ = Nothing
882+ checkPathSeperator = fmap isPathSeparator . isSingleton
879
883
880--
884--
881-- Safe read
885-- Safe read
src/Text/Pandoc/Writers/HTML.hs+39−6
@@ -1,4 +1,4 @@
1−{-# LANGUAGE OverloadedStrings, CPP #-}
1+{-# LANGUAGE OverloadedStrings, CPP, ViewPatterns #-}
2{-# OPTIONS_GHC -fno-warn-deprecations #-}
2{-# OPTIONS_GHC -fno-warn-deprecations #-}
3{-
3{-
4Copyright (C) 2006-2014 John MacFarlane <jgm@berkeley.edu>
4Copyright (C) 2006-2014 John MacFarlane <jgm@berkeley.edu>
@@ -60,6 +60,8 @@ import qualified Text.Blaze.XHtml1.Transitional.Attributes as A
60import Text.Blaze.Renderer.String (renderHtml)
60import Text.Blaze.Renderer.String (renderHtml)
61import Text.TeXMath
61import Text.TeXMath
62import Text.XML.Light.Output
62import Text.XML.Light.Output
63+import Text.XML.Light (unode, elChildren, add_attr, unqual)
64+import qualified Text.XML.Light as XML
63import System.FilePath (takeExtension)
65import System.FilePath (takeExtension)
64import Data.Monoid
66import Data.Monoid
65import Data.Aeson (Value)
67import Data.Aeson (Value)
@@ -155,6 +157,10 @@ pandocToHtml opts (Pandoc meta blocks) = do
155 H.script ! A.src (toValue url)
157 H.script ! A.src (toValue url)
156 ! A.type_ "text/javascript"
158 ! A.type_ "text/javascript"
157 $ mempty
159 $ mempty
160+ KaTeX js css ->
161+ (H.script ! A.src (toValue js) $ mempty) <>
162+ (H.link ! A.rel "stylesheet" ! A.href (toValue css)) <>
163+ (H.script ! A.type_ "text/javascript" $ toHtml renderKaTeX)
158 _ -> case lookup "mathml-script" (writerVariables opts) of
164 _ -> case lookup "mathml-script" (writerVariables opts) of
159 Just s | not (writerHtml5 opts) ->
165 Just s | not (writerHtml5 opts) ->
160 H.script ! A.type_ "text/javascript"
166 H.script ! A.type_ "text/javascript"
@@ -342,10 +348,10 @@ parseMailto s = do
342 _ -> fail "not a mailto: URL"
348 _ -> fail "not a mailto: URL"
343
349
344-- | Obfuscate a "mailto:" link.
350-- | Obfuscate a "mailto:" link.
345−obfuscateLink :: WriterOptions -> String -> String -> Html
351+obfuscateLink :: WriterOptions -> Html -> String -> Html
346obfuscateLink opts txt s | writerEmailObfuscation opts == NoObfuscation =
352obfuscateLink opts txt s | writerEmailObfuscation opts == NoObfuscation =
347− H.a ! A.href (toValue s) $ toHtml txt
353+ H.a ! A.href (toValue s) $ txt
348−obfuscateLink opts txt s =
354+obfuscateLink opts (renderHtml -> txt) s =
349 let meth = writerEmailObfuscation opts
355 let meth = writerEmailObfuscation opts
350 s' = map toLower (take 7 s) ++ drop 7 s
356 s' = map toLower (take 7 s) ++ drop 7 s
351 in case parseMailto s' of
357 in case parseMailto s' of
@@ -615,6 +621,18 @@ inlineListToHtml :: WriterOptions -> [Inline] -> State WriterState Html
615inlineListToHtml opts lst =
621inlineListToHtml opts lst =
616 mapM (inlineToHtml opts) lst >>= return . mconcat
622 mapM (inlineToHtml opts) lst >>= return . mconcat
617
623
624+-- | Annotates a MathML expression with the tex source
625+annotateMML :: XML.Element -> String -> XML.Element
626+annotateMML e tex = math (unode "semantics" [cs, unode "annotation" (annotAttrs, tex)])
627+ where
628+ cs = case elChildren e of
629+ [] -> unode "mrow" ()
630+ [x] -> x
631+ xs -> unode "mrow" xs
632+ math = add_attr (XML.Attr (unqual "xmlns") "http://www.w3.org/1998/Math/MathML") . unode "math"
633+ annotAttrs = [XML.Attr (unqual "encoding") "application/x-tex"]
634+
635+
618-- | Convert Pandoc inline element to HTML.
636-- | Convert Pandoc inline element to HTML.
619inlineToHtml :: WriterOptions -> Inline -> State WriterState Html
637inlineToHtml :: WriterOptions -> Inline -> State WriterState Html
620inlineToHtml opts inline =
638inlineToHtml opts inline =
@@ -706,7 +724,7 @@ inlineToHtml opts inline =
706 defaultConfigPP
724 defaultConfigPP
707 case writeMathML dt <$> readTeX str of
725 case writeMathML dt <$> readTeX str of
708 Right r -> return $ preEscapedString $
726 Right r -> return $ preEscapedString $
709− ppcElement conf r
727+ ppcElement conf (annotateMML r str)
710 Left _ -> inlineListToHtml opts
728 Left _ -> inlineListToHtml opts
711 (texMathToInlines t str) >>=
729 (texMathToInlines t str) >>=
712 return . (H.span ! A.class_ "math")
730 return . (H.span ! A.class_ "math")
@@ -714,6 +732,10 @@ inlineToHtml opts inline =
714 case t of
732 case t of
715 InlineMath -> "\\(" ++ str ++ "\\)"
733 InlineMath -> "\\(" ++ str ++ "\\)"
716 DisplayMath -> "\\[" ++ str ++ "\\]"
734 DisplayMath -> "\\[" ++ str ++ "\\]"
735+ KaTeX _ _ -> return $ H.span ! A.class_ "math" $
736+ toHtml (case t of
737+ InlineMath -> str
738+ DisplayMath -> "\\displaystyle " ++ str)
717 PlainMath -> do
739 PlainMath -> do
718 x <- inlineListToHtml opts (texMathToInlines t str)
740 x <- inlineListToHtml opts (texMathToInlines t str)
719 let m = H.span ! A.class_ "math" $ x
741 let m = H.span ! A.class_ "math" $ x
@@ -731,7 +753,7 @@ inlineToHtml opts inline =
731 | otherwise -> return mempty
753 | otherwise -> return mempty
732 (Link txt (s,_)) | "mailto:" `isPrefixOf` s -> do
754 (Link txt (s,_)) | "mailto:" `isPrefixOf` s -> do
733 linkText <- inlineListToHtml opts txt
755 linkText <- inlineListToHtml opts txt
734− return $ obfuscateLink opts (renderHtml linkText) s
756+ return $ obfuscateLink opts linkText s
735 (Link txt (s,tit)) -> do
757 (Link txt (s,tit)) -> do
736 linkText <- inlineListToHtml opts txt
758 linkText <- inlineListToHtml opts txt
737 let s' = case s of
759 let s' = case s of
@@ -815,3 +837,14 @@ blockListToNote opts ref blocks =
815 Just EPUB3 -> noteItem ! customAttribute "epub:type" "footnote"
837 Just EPUB3 -> noteItem ! customAttribute "epub:type" "footnote"
816 _ -> noteItem
838 _ -> noteItem
817 return $ nl opts >> noteItem'
839 return $ nl opts >> noteItem'
840+
841+-- Javascript snippet to render all KaTeX elements
842+renderKaTeX :: String
843+renderKaTeX = unlines [
844+ "window.onload = function(){var mathElements = document.getElementsByClassName(\"math\");"
845+ , "for (var i=0; i < mathElements.length; i++)"
846+ , "{"
847+ , " var texText = mathElements[i].firstChild"
848+ , " katex.render(texText.data, mathElements[i])"
849+ , "}}"
850+ ]
tests/Tests/Readers/EPUB.hs+3−2
@@ -8,6 +8,7 @@ import qualified Data.ByteString.Lazy as BL
8import Text.Pandoc.Readers.EPUB
8import Text.Pandoc.Readers.EPUB
9import Text.Pandoc.MediaBag (MediaBag, mediaDirectory)
9import Text.Pandoc.MediaBag (MediaBag, mediaDirectory)
10import Control.Applicative
10import Control.Applicative
11+import System.FilePath (joinPath)
11
12
12getMediaBag :: FilePath -> IO MediaBag
13getMediaBag :: FilePath -> IO MediaBag
13getMediaBag fp = snd . readEPUB def <$> BL.readFile fp
14getMediaBag fp = snd . readEPUB def <$> BL.readFile fp
@@ -22,12 +23,12 @@ testMediaBag fp bag = do
22 (actBag == bag)
23 (actBag == bag)
23
24
24featuresBag :: [(String, String, Int)]
25featuresBag :: [(String, String, Int)]
25−featuresBag = [("img/ElementaryMathExample.png","image/png",1331),("img/Maghreb1.png","image/png",2520),("img/check.gif","image/gif",1340),("img/check.jpg","image/jpeg",2661),("img/check.png","image/png",2815),("img/cichons_diagram.png","image/png",7045),("img/complex_number.png","image/png",5238),("img/multiscripts_and_greek_alphabet.png","image/png",10060)]
26+featuresBag = [(joinPath ["img","check.gif"],"image/gif",1340),(joinPath ["img","check.jpg"],"image/jpeg",2661),(joinPath ["img","check.png"],"image/png",2815),(joinPath ["img","multiscripts_and_greek_alphabet.png"],"image/png",10060)]
26
27
27tests :: [Test]
28tests :: [Test]
28tests =
29tests =
29 [ testGroup "EPUB Mediabag"
30 [ testGroup "EPUB Mediabag"
30 [ testCase "features bag"
31 [ testCase "features bag"
31− (testMediaBag "epub/features.epub" featuresBag)
32+ (testMediaBag "epub/img.epub" featuresBag)
32 ]
33 ]
33 ]
34 ]
tests/Tests/Readers/Org.hs+3−1
@@ -702,7 +702,9 @@ tests =
702 ]
702 ]
703 ])
703 ])
704 ]
704 ]
705−
705+ , "Definition list with multi-word term" =:
706+ " - Elijah Wood :: He plays Frodo" =?>
707+ definitionList [ ("Elijah" <> space <> "Wood", [plain $ "He" <> space <> "plays" <> space <> "Frodo"])]
706 , "Compact definition list" =:
708 , "Compact definition list" =:
707 unlines [ "- ATP :: adenosine 5' triphosphate"
709 unlines [ "- ATP :: adenosine 5' triphosphate"
708 , "- DNA :: deoxyribonucleic acid"
710 , "- DNA :: deoxyribonucleic acid"
tests/Tests/Shared.hs+19−18
@@ -9,6 +9,7 @@ import Test.Framework.Providers.HUnit
9import Test.HUnit ( assertBool, (@?=) )
9import Test.HUnit ( assertBool, (@?=) )
10import Text.Pandoc.Builder
10import Text.Pandoc.Builder
11import Data.Monoid
11import Data.Monoid
12+import System.FilePath (joinPath)
12
13
13tests :: [Test]
14tests :: [Test]
14tests = [ testGroup "normalize"
15tests = [ testGroup "normalize"
@@ -40,21 +41,21 @@ p_normalize_no_trailing_spaces ils = null ils' || last ils' /= Space
40
41
41testCollapse :: [Test]
42testCollapse :: [Test]
42testCollapse = map (testCase "collapse")
43testCollapse = map (testCase "collapse")
43− [ (collapseFilePath "" @?= "")
44+ [ (collapseFilePath (joinPath [ ""]) @?= (joinPath [ ""]))
44− , (collapseFilePath "./foo" @?= "foo")
45+ , (collapseFilePath (joinPath [ ".","foo"]) @?= (joinPath [ "foo"]))
45− , (collapseFilePath "././../foo" @?= "../foo")
46+ , (collapseFilePath (joinPath [ ".",".","..","foo"]) @?= (joinPath [ joinPath ["..", "foo"]]))
46− , (collapseFilePath "../foo" @?= "../foo")
47+ , (collapseFilePath (joinPath [ "..","foo"]) @?= (joinPath [ "..","foo"]))
47− , (collapseFilePath "/bar/../baz" @?= "/baz")
48+ , (collapseFilePath (joinPath [ "","bar","..","baz"]) @?= (joinPath [ "","baz"]))
48− , (collapseFilePath "/../baz" @?= "/../baz")
49+ , (collapseFilePath (joinPath [ "","..","baz"]) @?= (joinPath [ "","..","baz"]))
49− , (collapseFilePath "./foo/.././bar/../././baz" @?= "baz")
50+ , (collapseFilePath (joinPath [ ".","foo","..",".","bar","..",".",".","baz"]) @?= (joinPath [ "baz"]))
50− , (collapseFilePath "./" @?= "")
51+ , (collapseFilePath (joinPath [ ".",""]) @?= (joinPath [ ""]))
51− , (collapseFilePath "././" @?= "")
52+ , (collapseFilePath (joinPath [ ".",".",""]) @?= (joinPath [ ""]))
52− , (collapseFilePath "../" @?= "..")
53+ , (collapseFilePath (joinPath [ "..",""]) @?= (joinPath [ ".."]))
53− , (collapseFilePath ".././" @?= "..")
54+ , (collapseFilePath (joinPath [ "..",".",""]) @?= (joinPath [ ".."]))
54− , (collapseFilePath "./../" @?= "..")
55+ , (collapseFilePath (joinPath [ ".","..",""]) @?= (joinPath [ ".."]))
55− , (collapseFilePath "../../" @?= "../..")
56+ , (collapseFilePath (joinPath [ "..","..",""]) @?= (joinPath [ "..",".."]))
56− , (collapseFilePath "parent/foo/baz/../bar" @?= "parent/foo/bar")
57+ , (collapseFilePath (joinPath [ "parent","foo","baz","..","bar"]) @?= (joinPath [ "parent","foo","bar"]))
57− , (collapseFilePath "parent/foo/baz/../../bar" @?= "parent/bar")
58+ , (collapseFilePath (joinPath [ "parent","foo","baz","..","..","bar"]) @?= (joinPath [ "parent","bar"]))
58− , (collapseFilePath "parent/foo/.." @?= "parent")
59+ , (collapseFilePath (joinPath [ "parent","foo",".."]) @?= (joinPath [ "parent"]))
59− , (collapseFilePath "/parent/foo/../../bar" @?= "/bar")
60+ , (collapseFilePath (joinPath [ "","parent","foo","..","..","bar"]) @?= (joinPath [ "","bar"]))
60− , (collapseFilePath "/./parent/foo" @?= "/parent/foo")]
61+ , (collapseFilePath (joinPath [ "",".","parent","foo"]) @?= (joinPath [ "","parent","foo"]))]
tests/epub/features.epub

Binary file not shown.

tests/epub/features.native+5−33
@@ -1,5 +1,4 @@
1−[Para [Image [] ("img/multiscripts_and_greek_alphabet.png","")]
2−,Para [Span ("front.xhtml",[],[]) []]
1+[Para [Span ("front.xhtml",[],[]) []]
3,RawBlock (Format "html") "<section>"
2,RawBlock (Format "html") "<section>"
4,Header 1 ("",[],[]) [Str "Reflowable",Space,Str "EPUB",Space,Str "3",Space,Str "Conformance",Space,Str "Test",Space,Str "Document:",Space,Str "0100"]
3,Header 1 ("",[],[]) [Str "Reflowable",Space,Str "EPUB",Space,Str "3",Space,Str "Conformance",Space,Str "Test",Space,Str "Document:",Space,Str "0100"]
5,RawBlock (Format "html") "<section>"
4,RawBlock (Format "html") "<section>"
@@ -28,31 +27,6 @@
28 [[Plain [Str "@@@TODO",Space,Str "provide",Space,Str "info",Space,Str "on",Space,Str "where",Space,Str "to",Space,Str "get",Space,Str "the",Space,Str "results",Space,Str "form"]]])]
27 [[Plain [Str "@@@TODO",Space,Str "provide",Space,Str "info",Space,Str "on",Space,Str "where",Space,Str "to",Space,Str "get",Space,Str "the",Space,Str "results",Space,Str "form"]]])]
29,RawBlock (Format "html") "</section>"
28,RawBlock (Format "html") "</section>"
30,RawBlock (Format "html") "</section>"
29,RawBlock (Format "html") "</section>"
31−,Para [Span ("content-images-001.xhtml",[],[]) []]
32−,RawBlock (Format "html") "<section>"
33−,Header 2 ("content-images-001.xhtml#multimedia",[],[]) [Str "Multimedia"]
34−,RawBlock (Format "html") "<section>"
35−,Header 3 ("content-images-001.xhtml#images",[],[]) [Str "Images"]
36−,RawBlock (Format "html") "<section id=\"img-010\" class=\"ctest\">"
37−,Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "img-010"],Space,Str "GIF"]
38−,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Str "GIF",Space,Str "image",Space,Str "format",Space,Str "is",Space,Str "supported."]
39−,Para [Image [Str "gif",Space,Str "test"] ("img/check.gif","")]
40−,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."]
41−,RawBlock (Format "html") "</section>"
42−,RawBlock (Format "html") "<section id=\"img-020\" class=\"ctest\">"
43−,Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "img-020"],Space,Str "PNG"]
44−,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Str "PNG",Space,Str "image",Space,Str "format",Space,Str "is",Space,Str "supported."]
45−,Para [Image [Str "png",Space,Str "test"] ("img/check.png","")]
46−,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."]
47−,RawBlock (Format "html") "</section>"
48−,RawBlock (Format "html") "<section id=\"img-030\" class=\"ctest\">"
49−,Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "img-030"],Space,Str "JPEG"]
50−,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Str "JPEG",Space,Str "image",Space,Str "format",Space,Str "is",Space,Str "supported."]
51−,Para [Image [Str "jpeg",Space,Str "test"] ("img/check.jpg","")]
52−,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."]
53−,RawBlock (Format "html") "</section>"
54−,RawBlock (Format "html") "</section>"
55−,RawBlock (Format "html") "</section>"
56,Para [Span ("content-mathml-001.xhtml",[],[]) []]
30,Para [Span ("content-mathml-001.xhtml",[],[]) []]
57,RawBlock (Format "html") "<section>"
31,RawBlock (Format "html") "<section>"
58,Header 2 ("content-mathml-001.xhtml#mathml",[],[]) [Str "MathML"]
32,Header 2 ("content-mathml-001.xhtml#mathml",[],[]) [Str "MathML"]
@@ -94,13 +68,13 @@
94,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"]
68,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"]
95,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."]
69,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."]
96,Para [Math DisplayMath "c = \\overset{\\text{complex\\ number}}{\\overbrace{\\underset{\\text{real}}{\\underbrace{\\mspace{20mu} a\\mspace{20mu}}} + \\underset{\\text{imaginary}}{\\underbrace{\\quad b{\\mathbb{i}}\\quad}}}}"]
70,Para [Math DisplayMath "c = \\overset{\\text{complex\\ number}}{\\overbrace{\\underset{\\text{real}}{\\underbrace{\\mspace{20mu} a\\mspace{20mu}}} + \\underset{\\text{imaginary}}{\\underbrace{\\quad b{\\mathbb{i}}\\quad}}}}"]
97−,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."] ("img/complex_number.png",""),Str "."]
71+,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 "."]
98,RawBlock (Format "html") "</section>"
72,RawBlock (Format "html") "</section>"
99,RawBlock (Format "html") "<section id=\"mathml-025\" class=\"ctest\">"
73,RawBlock (Format "html") "<section id=\"mathml-025\" class=\"ctest\">"
100,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"]
74,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"]
101,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."]
75,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."]
102,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}"]
76,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}"]
103−,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."] ("img/cichons_diagram.png",""),Str "."]
77+,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,Str "."]
104,RawBlock (Format "html") "</section>"
78,RawBlock (Format "html") "</section>"
105,RawBlock (Format "html") "<section id=\"mathml-026\" class=\"ctest\">"
79,RawBlock (Format "html") "<section id=\"mathml-026\" class=\"ctest\">"
106,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"]
80,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"]
@@ -111,7 +85,7 @@
111,RawBlock (Format "html") "<section id=\"mathml-027\" class=\"ctest\">"
85,RawBlock (Format "html") "<section id=\"mathml-027\" class=\"ctest\">"
112,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"]
86,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"]
113,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."]
87,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."]
114−,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"] ("img/ElementaryMathExample.png",""),Str "."]
88+,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,Str "."]
115,RawBlock (Format "html") "</section>"
89,RawBlock (Format "html") "</section>"
116,RawBlock (Format "html") "</section>"
90,RawBlock (Format "html") "</section>"
117,Para [Span ("content-switch-001.xhtml",[],[]) []]
91,Para [Span ("content-switch-001.xhtml",[],[]) []]
@@ -130,6 +104,4 @@
130,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."]
104,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."]
131,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 "."]
105,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 "."]
132,RawBlock (Format "html") "</section>"
106,RawBlock (Format "html") "</section>"
133−,RawBlock (Format "html") "</section>"
107+,RawBlock (Format "html") "</section>"]
134−,Para [Span ("Maghreb1.png",[],[]) []]
135−,Para [Image [] ("img/Maghreb1.png","")]]
tests/epub/img.epubnew file

Binary file not shown.