git.iko.soy/typeable/pandoc
on master help sign in
EPUB writer: Improved handling of CSS.
7f5e2afJohn MacFarlane
src/Text/Pandoc/Writers/EPUB.hs+6−2
@@ -75,7 +75,9 @@ writeEPUB version opts doc@(Pandoc meta _) = do
75 let epub3 = version == EPUB3
75 let epub3 = version == EPUB3
76 epochtime <- floor `fmap` getPOSIXTime
76 epochtime <- floor `fmap` getPOSIXTime
77 let mkEntry path content = toEntry path epochtime content
77 let mkEntry path content = toEntry path epochtime content
78− let vars = ("epub3", if epub3 then "true" else "false"):writerVariables opts
78+ let vars = ("epub3", if epub3 then "true" else "false")
79+ : ("css", "stylesheet.css")
80+ : writerVariables opts
79 let opts' = opts{ writerEmailObfuscation = NoObfuscation
81 let opts' = opts{ writerEmailObfuscation = NoObfuscation
80 , writerStandalone = True
82 , writerStandalone = True
81 , writerSectionDivs = True
83 , writerSectionDivs = True
@@ -400,7 +402,9 @@ transformInlines (MathML _) _ _ (x@(Math _ _) : xs) = do
400 let writeHtmlInline opts z = trimr $
402 let writeHtmlInline opts z = trimr $
401 writeHtmlString opts $ Pandoc (Meta [] [] []) [Plain [z]]
403 writeHtmlString opts $ Pandoc (Meta [] [] []) [Plain [z]]
402 mathml = writeHtmlInline def{writerHTMLMathMethod = MathML Nothing } x
404 mathml = writeHtmlInline def{writerHTMLMathMethod = MathML Nothing } x
405+ -- we use mathjax to get raw latex, since readers tend to
406+ -- fall back to using mathjax...
403− fallback = writeHtmlInline def{writerHTMLMathMethod = PlainMath } x
407+ fallback = writeHtmlInline def{writerHTMLMathMethod = MathJax "" } x
404 inSwitch = "<epub:switch><epub:case required-namespace=" ++
408 inSwitch = "<epub:switch><epub:case required-namespace=" ++
405 "\"http://www.w3.org/1998/Math/MathML\">" ++ mathml ++
409 "\"http://www.w3.org/1998/Math/MathML\">" ++ mathml ++
406 "</epub:case><epub:default>" ++ fallback ++
410 "</epub:case><epub:default>" ++ fallback ++
templates+1−1

Submodule changed.