git.iko.soy/typeable/pandoc
on master help sign in
EPUB writer: use metadata field `css` instead of `stylesheet`
7e6f13cmb21
MANUAL.txt+3−3
@@ -976,8 +976,8 @@ Options affecting specific writers {.options}
976 include multiple files. They will be included in the order specified.
976 include multiple files. They will be included in the order specified.
977
977
978 A stylesheet is required for generating EPUB. If none is
978 A stylesheet is required for generating EPUB. If none is
979− provided using this option (or the `stylesheet` metadata
979+ provided using this option (or the deprecated `stylesheet`
980− field), pandoc will look for a file `epub.css` in the
980+ metadata field), pandoc will look for a file `epub.css` in the
981 user data directory (see `--data-dir`). If it is not
981 user data directory (see `--data-dir`). If it is not
982 found there, sensible defaults will be used.
982 found there, sensible defaults will be used.
983
983
@@ -4613,7 +4613,7 @@ The following fields are recognized:
4613`cover-image`
4613`cover-image`
4614 ~ A string value (path to cover image).
4614 ~ A string value (path to cover image).
4615
4615
4616−`stylesheet`
4616+`css` (or legacy: `stylesheet`)
4617 ~ A string value (path to CSS stylesheet).
4617 ~ A string value (path to CSS stylesheet).
4618
4618
4619`page-progression-direction`
4619`page-progression-direction`
src/Text/Pandoc/Writers/EPUB.hs+4−3
@@ -36,6 +36,7 @@ module Text.Pandoc.Writers.EPUB ( writeEPUB2, writeEPUB3 ) where
36import Prelude
36import Prelude
37import Codec.Archive.Zip (Entry, addEntryToArchive, eRelativePath, emptyArchive,
37import Codec.Archive.Zip (Entry, addEntryToArchive, eRelativePath, emptyArchive,
38 fromArchive, fromEntry, toEntry)
38 fromArchive, fromEntry, toEntry)
39+import Control.Applicative ( (<|>) )
39import Control.Monad (mplus, unless, when, zipWithM)
40import Control.Monad (mplus, unless, when, zipWithM)
40import Control.Monad.Except (catchError, throwError)
41import Control.Monad.Except (catchError, throwError)
41import Control.Monad.State.Strict (State, StateT, evalState, evalStateT, get,
42import Control.Monad.State.Strict (State, StateT, evalState, evalStateT, get,
@@ -351,9 +352,9 @@ metadataFromMeta opts meta = EPUBMetadata{
351 rights = metaValueToString <$> lookupMeta "rights" meta
352 rights = metaValueToString <$> lookupMeta "rights" meta
352 coverImage = lookup "epub-cover-image" (writerVariables opts) `mplus`
353 coverImage = lookup "epub-cover-image" (writerVariables opts) `mplus`
353 (metaValueToString <$> lookupMeta "cover-image" meta)
354 (metaValueToString <$> lookupMeta "cover-image" meta)
355+ mCss = lookupMeta "css" meta <|> lookupMeta "stylesheet" meta
354− stylesheets = fromMaybe []
356+ stylesheets = fromMaybe [] (metaValueToPaths <$> mCss) ++
355− (metaValueToPaths <$> lookupMeta "stylesheet" meta) ++
356− [f | ("css",f) <- writerVariables opts]
357+ [f | ("css",f) <- writerVariables opts]
357 pageDirection = case map toLower . metaValueToString <$>
358 pageDirection = case map toLower . metaValueToString <$>
358 lookupMeta "page-progression-direction" meta of
359 lookupMeta "page-progression-direction" meta of
359 Just "ltr" -> Just LTR
360 Just "ltr" -> Just LTR