@@ -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