git.iko.soy/typeable/pandoc
on master help sign in
EPUB writer: Fixed various things with new EPUB structure.
commit2b3e8cb718d527640c237486d84cefa741221035 authorJohn MacFarlane <jgm@berkeley.edu> dateThu 22 Jun 2017, 12:38 (9 years ago) parent24d215a
1 file changed+6−6
src/Text/Pandoc/Writers/EPUB.hs+6−6
src/Text/Pandoc/Writers/EPUB.hs+6−6
@@ -394,7 +394,7 @@ pandocToEPUB version opts doc@(Pandoc meta _) = do
394394 stylesheets [(1 :: Int)..]
395395
396396 let vars = ("epub3", if epub3 then "true" else "false")
397− : map (\e -> ("css", eRelativePath e)) stylesheetEntries
397+ : map (\e -> ("css", "../" ++ eRelativePath e)) stylesheetEntries
398398 ++ [(x,y) | (x,y) <- writerVariables opts, x /= "css"]
399399 let opts' = opts{ writerEmailObfuscation = NoObfuscation
400400 , writerSectionDivs = True
@@ -521,7 +521,7 @@ pandocToEPUB version opts doc@(Pandoc meta _) = do
521521 chapters'
522522
523523 let chapToEntry num (Chapter mbnum bs) =
524− mkEntry (showChapter num) <$>
524+ mkEntry ("text/" ++ showChapter num) <$>
525525 (writeHtml opts'{ writerNumberOffset = fromMaybe [] mbnum }
526526 $ case bs of
527527 (Header _ _ xs : _) ->
@@ -888,7 +888,6 @@ modifyMediaRef :: PandocMonad m
888888modifyMediaRef _ "" = return ""
889889modifyMediaRef opts oldsrc = do
890890 media <- gets stMediaPaths
891− let epubSubdir = writerEpubSubdirectory opts
892891 case lookup oldsrc media of
893892 Just (n,_) -> return n
894893 Nothing -> catchError
@@ -924,12 +923,13 @@ transformInline :: PandocMonad m
924923 -> E m Inline
925924transformInline opts (Image attr lab (src,tit)) = do
926925 newsrc <- modifyMediaRef opts src
927− return $ Image attr lab (newsrc, tit)
926+ return $ Image attr lab ("../" ++ newsrc, tit)
928927transformInline opts (x@(Math t m))
929928 | WebTeX url <- writerHTMLMathMethod opts = do
930929 newsrc <- modifyMediaRef opts (url ++ urlEncode m)
931930 let mathclass = if t == DisplayMath then "display" else "inline"
932− return $ Span ("",["math",mathclass],[]) [Image nullAttr [x] (newsrc, "")]
931+ return $ Span ("",["math",mathclass],[])
932+ [Image nullAttr [x] ("../" ++ newsrc, "")]
933933transformInline opts (RawInline fmt raw)
934934 | fmt == Format "html" = do
935935 let tags = parseTags raw
@@ -963,7 +963,7 @@ mediaTypeOf x =
963963
964964-- Returns filename for chapter number.
965965showChapter :: Int -> String
966−showChapter = printf "text/ch%03d.xhtml"
966+showChapter = printf "ch%03d.xhtml"
967967
968968-- Add identifiers to any headers without them.
969969addIdentifiers :: [Block] -> [Block]