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

Fixes and Enhancements from the tracker

commit5bab9574f615ef41bc0ae85c161e2a88a55bd86c authorJohn MacFarlane <jgm@berkeley.edu> dateSat 27 Sep 2014, 16:18 (12 years ago) parent7b01edcfa2d11c
14 files changed+135−76
README+12−1 pandoc.hs+32−3 src/Text/Pandoc/MediaBag.hs+5−5 src/Text/Pandoc/Options.hs+1 src/Text/Pandoc/Readers/HTML.hs+6−1 src/Text/Pandoc/Readers/Org.hs+1−1 src/Text/Pandoc/Shared.hs+9−5 src/Text/Pandoc/Writers/HTML.hs+39−6 tests/Tests/Readers/EPUB.hs+3−2 tests/Tests/Readers/Org.hs+3−1 tests/Tests/Shared.hs+19−18 tests/epub/features.epub tests/epub/features.native+5−33 tests/epub/img.epub
README+12−1
@@ -710,6 +710,16 @@ Math rendering in HTML
710710 formulas to images. The formula will be concatenated with the URL
711711 provided. If *URL* is not specified, the Google Chart API will be used.
712712
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+
713723Options for wrapper scripts
714724---------------------------
715725
@@ -1652,7 +1662,7 @@ proportionally spaced fonts, as it does not require lining up columns.
16521662
16531663#### Extension: `table_captions` ####
16541664
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
16561666illustrated in the examples below). A caption is a paragraph beginning
16571667with the string `Table:` (or just `:`), which will be stripped off.
16581668It may appear either before or after the table.
@@ -3177,3 +3187,4 @@ Rosenthal.
31773187[txt2tags]: http://txt2tags.org/
31783188[EPUB]: http://idpf.org/epub
31793189[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
5858import Control.Exception.Extensible ( throwIO )
5959import qualified Text.Pandoc.UTF8 as UTF8
6060import Control.Monad (when, unless, (>=>))
61−import Data.Maybe (isJust)
61+import Data.Maybe (isJust, fromMaybe)
6262import Data.Foldable (foldrM)
6363import Network.URI (parseURI, isURI, URI(..))
6464import qualified Data.ByteString.Lazy as B
@@ -68,7 +68,7 @@ import qualified Data.Map as M
6868import Data.Yaml (decode)
6969import qualified Data.Yaml as Yaml
7070import qualified Data.Text as T
71−import Control.Applicative ((<$>))
71+import Control.Applicative ((<$>), (<|>))
7272import Text.Pandoc.Readers.Txt2Tags (getT2TMeta)
7373import Data.Monoid
7474
@@ -205,6 +205,8 @@ data Opt = Opt
205205 , optExtractMedia :: Maybe FilePath -- ^ Path to extract embedded media
206206 , optTrace :: Bool -- ^ Print debug information
207207 , 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
208210 }
209211
210212-- | Defaults for command-line options.
@@ -263,6 +265,8 @@ defaultOpts = Opt
263265 , optExtractMedia = Nothing
264266 , optTrace = False
265267 , optTrackChanges = AcceptChanges
268+ , optKaTeXStylesheet = Nothing
269+ , optKaTeXJS = Nothing
266270 }
267271
268272-- | A list of functions, each transforming the options data structure
@@ -818,6 +822,21 @@ options =
818822 return opt { optHTMLMathMethod = MathJax url'})
819823 "URL")
820824 "" -- "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
821840
822841 , Option "" ["gladtex"]
823842 (NoArg
@@ -860,6 +879,7 @@ options =
860879
861880 ]
862881
882+
863883addMetadata :: String -> MetaValue -> M.Map String MetaValue
864884 -> M.Map String MetaValue
865885addMetadata k v m = case M.lookup k m of
@@ -1027,7 +1047,7 @@ main = do
10271047 , optHighlight = highlight
10281048 , optHighlightStyle = highlightStyle
10291049 , optChapters = chapters
1030− , optHTMLMathMethod = mathMethod
1050+ , optHTMLMathMethod = mathMethod'
10311051 , optReferenceODT = referenceODT
10321052 , optReferenceDocx = referenceDocx
10331053 , optEpubStylesheet = epubStylesheet
@@ -1056,6 +1076,8 @@ main = do
10561076 , optExtractMedia = mbExtractMedia
10571077 , optTrace = trace
10581078 , optTrackChanges = trackChanges
1079+ , optKaTeXStylesheet = katexStylesheet
1080+ , optKaTeXJS = katexJS
10591081 } = opts
10601082
10611083 when dumpArgs $
@@ -1063,6 +1085,13 @@ main = do
10631085 mapM_ (\arg -> UTF8.hPutStrLn stdout arg) args
10641086 exitWith ExitSuccess
10651087
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+
10661095 -- --bibliography implies -F pandoc-citeproc for backwards compatibility:
10671096 let needsCiteproc = isJust (M.lookup "bibliography" metadata) &&
10681097 optCiteMethod opts `notElem` [Natbib, Biblatex] &&
src/Text/Pandoc/MediaBag.hs+5−5
@@ -51,7 +51,7 @@ import System.IO (stderr)
5151-- mime types. Note that a 'MediaBag' is a Monoid, so 'mempty'
5252-- can be used for an empty 'MediaBag', and '<>' can be used to append
5353-- two 'MediaBag's.
54−newtype MediaBag = MediaBag (M.Map String (MimeType, BL.ByteString))
54+newtype MediaBag = MediaBag (M.Map [String] (MimeType, BL.ByteString))
5555 deriving (Monoid)
5656
5757instance Show MediaBag where
@@ -65,7 +65,7 @@ insertMedia :: FilePath -- ^ relative path and canonical name of resource
6565 -> MediaBag
6666 -> MediaBag
6767insertMedia fp mbMime contents (MediaBag mediamap) =
68− MediaBag (M.insert fp (mime, contents) mediamap)
68+ MediaBag (M.insert (splitPath fp) (mime, contents) mediamap)
6969 where mime = fromMaybe fallback mbMime
7070 fallback = case takeExtension fp of
7171 ".gz" -> getMimeTypeDef $ dropExtension fp
@@ -75,14 +75,14 @@ insertMedia fp mbMime contents (MediaBag mediamap) =
7575lookupMedia :: FilePath
7676 -> MediaBag
7777 -> Maybe (MimeType, BL.ByteString)
78−lookupMedia fp (MediaBag mediamap) = M.lookup fp mediamap
78+lookupMedia fp (MediaBag mediamap) = M.lookup (splitPath fp) mediamap
7979
8080-- | Get a list of the file paths stored in a 'MediaBag', with
8181-- their corresponding mime types and the lengths in bytes of the contents.
8282mediaDirectory :: MediaBag -> [(String, MimeType, Int)]
8383mediaDirectory (MediaBag mediamap) =
8484 M.foldWithKey (\fp (mime,contents) ->
85− ((fp, mime, fromIntegral $ BL.length contents):)) [] mediamap
85+ (((joinPath fp), mime, fromIntegral $ BL.length contents):)) [] mediamap
8686
8787-- | Extract contents of MediaBag to a given directory. Print informational
8888-- messages if 'verbose' is true.
@@ -93,7 +93,7 @@ extractMediaBag :: Bool
9393extractMediaBag verbose dir (MediaBag mediamap) = do
9494 sequence_ $ M.foldWithKey
9595 (\fp (_ ,contents) ->
96− ((writeMedia verbose dir (fp, contents)):)) [] mediamap
96+ ((writeMedia verbose dir (joinPath fp, contents)):)) [] mediamap
9797
9898writeMedia :: Bool -> FilePath -> (FilePath, BL.ByteString) -> IO ()
9999writeMedia verbose dir (subpath, bs) = do
src/Text/Pandoc/Options.hs+1
@@ -251,6 +251,7 @@ data HTMLMathMethod = PlainMath
251251 | WebTeX String -- url of TeX->image script.
252252 | MathML (Maybe String) -- url of MathMLinHTML.js
253253 | MathJax String -- url of MathJax.js
254+ | KaTeX String String -- url of stylesheet and katex.js
254255 deriving (Show, Read, Eq)
255256
256257data CiteMethod = Citeproc -- use citeproc to render them
src/Text/Pandoc/Readers/HTML.hs+6−1
@@ -440,7 +440,7 @@ pCodeBlock :: TagParser Blocks
440440pCodeBlock = try $ do
441441 TagOpen _ attr <- pSatisfy (~== TagOpen "pre" [])
442442 contents <- manyTill pAnyTag (pCloses "pre" <|> eof)
443− let rawText = concatMap fromTagText $ filter isTagText contents
443+ let rawText = concatMap tagToString contents
444444 -- drop leading newline if any
445445 let result' = case rawText of
446446 '\n':xs -> xs
@@ -451,6 +451,11 @@ pCodeBlock = try $ do
451451 _ -> result'
452452 return $ B.codeBlockWith (mkAttr attr) result
453453
454+tagToString :: Tag String -> String
455+tagToString (TagText s) = s
456+tagToString (TagOpen "br" _) = "\n"
457+tagToString _ = ""
458+
454459inline :: TagParser Inlines
455460inline = choice
456461 [ eNoteref
src/Text/Pandoc/Readers/Org.hs+1−1
@@ -863,7 +863,7 @@ definitionListItem parseMarkerGetLength = try $ do
863863 line1 <- anyLineNewline
864864 blank <- option "" ("\n" <$ blankline)
865865 cont <- concat <$> many (listContinuation markerLength)
866− term' <- parseFromString inline term
866+ term' <- parseFromString parseInlines term
867867 contents' <- parseFromString parseBlocks $ line1 ++ blank ++ cont
868868 return $ (,) <$> term' <*> fmap (:[]) contents'
869869
src/Text/Pandoc/Shared.hs+9−5
@@ -1,5 +1,6 @@
11{-# LANGUAGE DeriveDataTypeable, CPP, MultiParamTypeClasses,
2− FlexibleContexts, ScopedTypeVariables, PatternGuards #-}
2+ FlexibleContexts, ScopedTypeVariables, PatternGuards,
3+ ViewPatterns #-}
34{-
45Copyright (C) 2006-2014 John MacFarlane <jgm@berkeley.edu>
56
@@ -106,7 +107,7 @@ import Network.URI ( escapeURIString, isURI, nonStrictRelativeTo,
106107 unEscapeString, parseURIReference, isAllowedInURI )
107108import qualified Data.Set as Set
108109import System.Directory
109−import System.FilePath (joinPath, splitDirectories)
110+import System.FilePath (joinPath, splitDirectories, pathSeparator, isPathSeparator)
110111import Text.Pandoc.MIME (MimeType, getMimeType)
111112import System.FilePath ( (</>), takeExtension, dropExtension)
112113import Data.Generics (Typeable, Data)
@@ -871,11 +872,14 @@ collapseFilePath = joinPath . reverse . foldl go [] . splitDirectories
871872 go rs "." = rs
872873 go r@(p:rs) ".." = case p of
873874 ".." -> ("..":r)
874− "/" -> ("..":r)
875+ (checkPathSeperator -> Just True) -> ("..":r)
875876 _ -> rs
876− go _ "/" = ["/"]
877+ go _ (checkPathSeperator -> Just True) = [[pathSeparator]]
877878 go rs x = x:rs
878−
879+ isSingleton [] = Nothing
880+ isSingleton [x] = Just x
881+ isSingleton _ = Nothing
882+ checkPathSeperator = fmap isPathSeparator . isSingleton
879883
880884--
881885-- Safe read
src/Text/Pandoc/Writers/HTML.hs+39−6
@@ -1,4 +1,4 @@
1−{-# LANGUAGE OverloadedStrings, CPP #-}
1+{-# LANGUAGE OverloadedStrings, CPP, ViewPatterns #-}
22{-# OPTIONS_GHC -fno-warn-deprecations #-}
33{-
44Copyright (C) 2006-2014 John MacFarlane <jgm@berkeley.edu>
@@ -60,6 +60,8 @@ import qualified Text.Blaze.XHtml1.Transitional.Attributes as A
6060import Text.Blaze.Renderer.String (renderHtml)
6161import Text.TeXMath
6262import Text.XML.Light.Output
63+import Text.XML.Light (unode, elChildren, add_attr, unqual)
64+import qualified Text.XML.Light as XML
6365import System.FilePath (takeExtension)
6466import Data.Monoid
6567import Data.Aeson (Value)
@@ -155,6 +157,10 @@ pandocToHtml opts (Pandoc meta blocks) = do
155157 H.script ! A.src (toValue url)
156158 ! A.type_ "text/javascript"
157159 $ 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)
158164 _ -> case lookup "mathml-script" (writerVariables opts) of
159165 Just s | not (writerHtml5 opts) ->
160166 H.script ! A.type_ "text/javascript"
@@ -342,10 +348,10 @@ parseMailto s = do
342348 _ -> fail "not a mailto: URL"
343349
344350-- | Obfuscate a "mailto:" link.
345−obfuscateLink :: WriterOptions -> String -> String -> Html
351+obfuscateLink :: WriterOptions -> Html -> String -> Html
346352obfuscateLink opts txt s | writerEmailObfuscation opts == NoObfuscation =
347− H.a ! A.href (toValue s) $ toHtml txt
348−obfuscateLink opts txt s =
353+ H.a ! A.href (toValue s) $ txt
354+obfuscateLink opts (renderHtml -> txt) s =
349355 let meth = writerEmailObfuscation opts
350356 s' = map toLower (take 7 s) ++ drop 7 s
351357 in case parseMailto s' of
@@ -615,6 +621,18 @@ inlineListToHtml :: WriterOptions -> [Inline] -> State WriterState Html
615621inlineListToHtml opts lst =
616622 mapM (inlineToHtml opts) lst >>= return . mconcat
617623
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+
618636-- | Convert Pandoc inline element to HTML.
619637inlineToHtml :: WriterOptions -> Inline -> State WriterState Html
620638inlineToHtml opts inline =
@@ -706,7 +724,7 @@ inlineToHtml opts inline =
706724 defaultConfigPP
707725 case writeMathML dt <$> readTeX str of
708726 Right r -> return $ preEscapedString $
709− ppcElement conf r
727+ ppcElement conf (annotateMML r str)
710728 Left _ -> inlineListToHtml opts
711729 (texMathToInlines t str) >>=
712730 return . (H.span ! A.class_ "math")
@@ -714,6 +732,10 @@ inlineToHtml opts inline =
714732 case t of
715733 InlineMath -> "\\(" ++ str ++ "\\)"
716734 DisplayMath -> "\\[" ++ str ++ "\\]"
735+ KaTeX _ _ -> return $ H.span ! A.class_ "math" $
736+ toHtml (case t of
737+ InlineMath -> str
738+ DisplayMath -> "\\displaystyle " ++ str)
717739 PlainMath -> do
718740 x <- inlineListToHtml opts (texMathToInlines t str)
719741 let m = H.span ! A.class_ "math" $ x
@@ -731,7 +753,7 @@ inlineToHtml opts inline =
731753 | otherwise -> return mempty
732754 (Link txt (s,_)) | "mailto:" `isPrefixOf` s -> do
733755 linkText <- inlineListToHtml opts txt
734− return $ obfuscateLink opts (renderHtml linkText) s
756+ return $ obfuscateLink opts linkText s
735757 (Link txt (s,tit)) -> do
736758 linkText <- inlineListToHtml opts txt
737759 let s' = case s of
@@ -815,3 +837,14 @@ blockListToNote opts ref blocks =
815837 Just EPUB3 -> noteItem ! customAttribute "epub:type" "footnote"
816838 _ -> noteItem
817839 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
88import Text.Pandoc.Readers.EPUB
99import Text.Pandoc.MediaBag (MediaBag, mediaDirectory)
1010import Control.Applicative
11+import System.FilePath (joinPath)
1112
1213getMediaBag :: FilePath -> IO MediaBag
1314getMediaBag fp = snd . readEPUB def <$> BL.readFile fp
@@ -22,12 +23,12 @@ testMediaBag fp bag = do
2223 (actBag == bag)
2324
2425featuresBag :: [(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)]
2627
2728tests :: [Test]
2829tests =
2930 [ testGroup "EPUB Mediabag"
3031 [ testCase "features bag"
31− (testMediaBag "epub/features.epub" featuresBag)
32+ (testMediaBag "epub/img.epub" featuresBag)
3233 ]
3334 ]
tests/Tests/Readers/Org.hs+3−1
@@ -702,7 +702,9 @@ tests =
702702 ]
703703 ])
704704 ]
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"])]
706708 , "Compact definition list" =:
707709 unlines [ "- ATP :: adenosine 5' triphosphate"
708710 , "- DNA :: deoxyribonucleic acid"
tests/Tests/Shared.hs+19−18
@@ -9,6 +9,7 @@ import Test.Framework.Providers.HUnit
99import Test.HUnit ( assertBool, (@?=) )
1010import Text.Pandoc.Builder
1111import Data.Monoid
12+import System.FilePath (joinPath)
1213
1314tests :: [Test]
1415tests = [ testGroup "normalize"
@@ -40,21 +41,21 @@ p_normalize_no_trailing_spaces ils = null ils' || last ils' /= Space
4041
4142testCollapse :: [Test]
4243testCollapse = map (testCase "collapse")
43− [ (collapseFilePath "" @?= "")
44− , (collapseFilePath "./foo" @?= "foo")
45− , (collapseFilePath "././../foo" @?= "../foo")
46− , (collapseFilePath "../foo" @?= "../foo")
47− , (collapseFilePath "/bar/../baz" @?= "/baz")
48− , (collapseFilePath "/../baz" @?= "/../baz")
49− , (collapseFilePath "./foo/.././bar/../././baz" @?= "baz")
50− , (collapseFilePath "./" @?= "")
51− , (collapseFilePath "././" @?= "")
52− , (collapseFilePath "../" @?= "..")
53− , (collapseFilePath ".././" @?= "..")
54− , (collapseFilePath "./../" @?= "..")
55− , (collapseFilePath "../../" @?= "../..")
56− , (collapseFilePath "parent/foo/baz/../bar" @?= "parent/foo/bar")
57− , (collapseFilePath "parent/foo/baz/../../bar" @?= "parent/bar")
58− , (collapseFilePath "parent/foo/.." @?= "parent")
59− , (collapseFilePath "/parent/foo/../../bar" @?= "/bar")
60− , (collapseFilePath "/./parent/foo" @?= "/parent/foo")]
44+ [ (collapseFilePath (joinPath [ ""]) @?= (joinPath [ ""]))
45+ , (collapseFilePath (joinPath [ ".","foo"]) @?= (joinPath [ "foo"]))
46+ , (collapseFilePath (joinPath [ ".",".","..","foo"]) @?= (joinPath [ joinPath ["..", "foo"]]))
47+ , (collapseFilePath (joinPath [ "..","foo"]) @?= (joinPath [ "..","foo"]))
48+ , (collapseFilePath (joinPath [ "","bar","..","baz"]) @?= (joinPath [ "","baz"]))
49+ , (collapseFilePath (joinPath [ "","..","baz"]) @?= (joinPath [ "","..","baz"]))
50+ , (collapseFilePath (joinPath [ ".","foo","..",".","bar","..",".",".","baz"]) @?= (joinPath [ "baz"]))
51+ , (collapseFilePath (joinPath [ ".",""]) @?= (joinPath [ ""]))
52+ , (collapseFilePath (joinPath [ ".",".",""]) @?= (joinPath [ ""]))
53+ , (collapseFilePath (joinPath [ "..",""]) @?= (joinPath [ ".."]))
54+ , (collapseFilePath (joinPath [ "..",".",""]) @?= (joinPath [ ".."]))
55+ , (collapseFilePath (joinPath [ ".","..",""]) @?= (joinPath [ ".."]))
56+ , (collapseFilePath (joinPath [ "..","..",""]) @?= (joinPath [ "..",".."]))
57+ , (collapseFilePath (joinPath [ "parent","foo","baz","..","bar"]) @?= (joinPath [ "parent","foo","bar"]))
58+ , (collapseFilePath (joinPath [ "parent","foo","baz","..","..","bar"]) @?= (joinPath [ "parent","bar"]))
59+ , (collapseFilePath (joinPath [ "parent","foo",".."]) @?= (joinPath [ "parent"]))
60+ , (collapseFilePath (joinPath [ "","parent","foo","..","..","bar"]) @?= (joinPath [ "","bar"]))
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",[],[]) []]
32,RawBlock (Format "html") "<section>"
43,Header 1 ("",[],[]) [Str "Reflowable",Space,Str "EPUB",Space,Str "3",Space,Str "Conformance",Space,Str "Test",Space,Str "Document:",Space,Str "0100"]
54,RawBlock (Format "html") "<section>"
@@ -28,31 +27,6 @@
2827 [[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"]]])]
2928,RawBlock (Format "html") "</section>"
3029,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>"
5630,Para [Span ("content-mathml-001.xhtml",[],[]) []]
5731,RawBlock (Format "html") "<section>"
5832,Header 2 ("content-mathml-001.xhtml#mathml",[],[]) [Str "MathML"]
@@ -94,13 +68,13 @@
9468,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"]
9569,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."]
9670,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 "."]
9872,RawBlock (Format "html") "</section>"
9973,RawBlock (Format "html") "<section id=\"mathml-025\" class=\"ctest\">"
10074,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"]
10175,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."]
10276,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 "."]
10478,RawBlock (Format "html") "</section>"
10579,RawBlock (Format "html") "<section id=\"mathml-026\" class=\"ctest\">"
10680,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 @@
11185,RawBlock (Format "html") "<section id=\"mathml-027\" class=\"ctest\">"
11286,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"]
11387,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 "."]
11589,RawBlock (Format "html") "</section>"
11690,RawBlock (Format "html") "</section>"
11791,Para [Span ("content-switch-001.xhtml",[],[]) []]
@@ -130,6 +104,4 @@
130104,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."]
131105,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 "."]
132106,RawBlock (Format "html") "</section>"
133−,RawBlock (Format "html") "</section>"
134−,Para [Span ("Maghreb1.png",[],[]) []]
135−,Para [Image [] ("img/Maghreb1.png","")]]
107+,RawBlock (Format "html") "</section>"]
tests/epub/img.epubnew file

Binary file not shown.