git.iko.soy/typeable/pandoc
on master help sign in
EPUB writer: fix image paths with empty `--epub-subdirectory`.
commit36449d3ea4708009e474507de27077c1b936adad authorJohn MacFarlane <jgm@berkeley.edu> dateTue 7 Nov 2017, 08:30 (9 years ago) parentdd2455c
1 file changed+9−3
src/Text/Pandoc/Writers/EPUB.hs+9−3
src/Text/Pandoc/Writers/EPUB.hs+9−3
@@ -959,15 +959,21 @@ transformInline :: PandocMonad m
959959 => WriterOptions
960960 -> Inline
961961 -> E m Inline
962−transformInline _opts (Image attr lab (src,tit)) = do
962+transformInline opts (Image attr lab (src,tit)) = do
963963 newsrc <- modifyMediaRef src
964− return $ Image attr lab ("../" ++ newsrc, tit)
964+ let pref = if null (writerEpubSubdirectory opts)
965+ then ""
966+ else "../"
967+ return $ Image attr lab (pref ++ newsrc, tit)
965968transformInline opts (x@(Math t m))
966969 | WebTeX url <- writerHTMLMathMethod opts = do
967970 newsrc <- modifyMediaRef (url ++ urlEncode m)
968971 let mathclass = if t == DisplayMath then "display" else "inline"
972+ let pref = if null (writerEpubSubdirectory opts)
973+ then ""
974+ else "../"
969975 return $ Span ("",["math",mathclass],[])
970− [Image nullAttr [x] ("../" ++ newsrc, "")]
976+ [Image nullAttr [x] (pref ++ newsrc, "")]
971977transformInline _opts (RawInline fmt raw)
972978 | fmt == Format "html" = do
973979 let tags = parseTags raw