aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-11-25 17:50:27 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2019-11-25 17:50:27 -0800
commit421ae44cdfb5d1049246d61cabf647d6056eb554 (patch)
tree513fd07129fe12d358704d6bf556847c648c869c
parentce0a4f8c4742a26950237196163f7ca213f62551 (diff)
downloadpandoc-421ae44cdfb5d1049246d61cabf647d6056eb554.tar.gz
EPUB writer: Fix regression with `--css option.
Closes #5937.
-rw-r--r--src/Text/Pandoc/Writers/EPUB.hs22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs
index 4a1c27ce6..b3cf79ba2 100644
--- a/src/Text/Pandoc/Writers/EPUB.hs
+++ b/src/Text/Pandoc/Writers/EPUB.hs
@@ -357,8 +357,12 @@ metadataFromMeta opts meta = EPUBMetadata{
`mplus` (metaValueToString <$> lookupMeta "cover-image" meta)
mCss = lookupMeta "css" meta <|> lookupMeta "stylesheet" meta
stylesheets = fromMaybe [] (metaValueToPaths <$> mCss) ++
- maybe [] (\t -> [TS.unpack t])
- (lookupContext "css" (writerVariables opts))
+ case lookupContext "css" (writerVariables opts) of
+ Just xs -> map TS.unpack xs
+ Nothing ->
+ case lookupContext "css" (writerVariables opts) of
+ Just x -> [TS.unpack x]
+ Nothing -> []
pageDirection = case map toLower . metaValueToString <$>
lookupMeta "page-progression-direction" meta of
Just "ltr" -> Just LTR
@@ -440,13 +444,13 @@ pandocToEPUB version opts doc = do
M.insert "lang" (toVal' $ epubLanguage metadata)
$ unContext $ writerVariables opts
- let cssvars useprefix = Context $ M.fromList $ map
- (\e -> ("css", toVal' $
- (if useprefix
- then "../"
- else "")
- ++ makeRelative epubSubdir (eRelativePath e)))
- stylesheetEntries
+ let cssvars useprefix = Context $ M.insert "css"
+ (ListVal $ map
+ (\e -> toVal' $
+ (if useprefix then "../" else "") <>
+ makeRelative epubSubdir (eRelativePath e))
+ stylesheetEntries)
+ mempty
let opts' = opts{ writerEmailObfuscation = NoObfuscation
, writerSectionDivs = True