summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/EPUB.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-06-22 12:38:08 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2017-06-22 12:38:08 +0200
commit2b3e8cb718d527640c237486d84cefa741221035 (patch)
tree26a68849d6704ab875c9b88c5a98de36fdc4c575 /src/Text/Pandoc/Writers/EPUB.hs
parent24d215acf584a52ad3ea3a9a3f97c751d26e08a4 (diff)
EPUB writer: Fixed various things with new EPUB structure.
Diffstat (limited to 'src/Text/Pandoc/Writers/EPUB.hs')
-rw-r--r--src/Text/Pandoc/Writers/EPUB.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs
index 96c8847df..ab9f873c8 100644
--- a/src/Text/Pandoc/Writers/EPUB.hs
+++ b/src/Text/Pandoc/Writers/EPUB.hs
@@ -394,7 +394,7 @@ pandocToEPUB version opts doc@(Pandoc meta _) = do
stylesheets [(1 :: Int)..]
let vars = ("epub3", if epub3 then "true" else "false")
- : map (\e -> ("css", eRelativePath e)) stylesheetEntries
+ : map (\e -> ("css", "../" ++ eRelativePath e)) stylesheetEntries
++ [(x,y) | (x,y) <- writerVariables opts, x /= "css"]
let opts' = opts{ writerEmailObfuscation = NoObfuscation
, writerSectionDivs = True
@@ -521,7 +521,7 @@ pandocToEPUB version opts doc@(Pandoc meta _) = do
chapters'
let chapToEntry num (Chapter mbnum bs) =
- mkEntry (showChapter num) <$>
+ mkEntry ("text/" ++ showChapter num) <$>
(writeHtml opts'{ writerNumberOffset = fromMaybe [] mbnum }
$ case bs of
(Header _ _ xs : _) ->
@@ -888,7 +888,6 @@ modifyMediaRef :: PandocMonad m
modifyMediaRef _ "" = return ""
modifyMediaRef opts oldsrc = do
media <- gets stMediaPaths
- let epubSubdir = writerEpubSubdirectory opts
case lookup oldsrc media of
Just (n,_) -> return n
Nothing -> catchError
@@ -924,12 +923,13 @@ transformInline :: PandocMonad m
-> E m Inline
transformInline opts (Image attr lab (src,tit)) = do
newsrc <- modifyMediaRef opts src
- return $ Image attr lab (newsrc, tit)
+ return $ Image attr lab ("../" ++ newsrc, tit)
transformInline opts (x@(Math t m))
| WebTeX url <- writerHTMLMathMethod opts = do
newsrc <- modifyMediaRef opts (url ++ urlEncode m)
let mathclass = if t == DisplayMath then "display" else "inline"
- return $ Span ("",["math",mathclass],[]) [Image nullAttr [x] (newsrc, "")]
+ return $ Span ("",["math",mathclass],[])
+ [Image nullAttr [x] ("../" ++ newsrc, "")]
transformInline opts (RawInline fmt raw)
| fmt == Format "html" = do
let tags = parseTags raw
@@ -963,7 +963,7 @@ mediaTypeOf x =
-- Returns filename for chapter number.
showChapter :: Int -> String
-showChapter = printf "text/ch%03d.xhtml"
+showChapter = printf "ch%03d.xhtml"
-- Add identifiers to any headers without them.
addIdentifiers :: [Block] -> [Block]