FB2 writer: add cover image specified by "cover-image" meta
Fixes #4195
This commit is contained in:
parent
52a4cf6699
commit
0fd7ed0cab
1 changed files with 10 additions and 1 deletions
|
@ -121,9 +121,18 @@ description meta' = do
|
|||
Just (MetaString s) -> [el "lang" $ iso639 s]
|
||||
_ -> []
|
||||
where iso639 = takeWhile (/= '-') -- Convert BCP 47 to ISO 639
|
||||
let coverimage url = do
|
||||
let img = Image nullAttr mempty (url, "")
|
||||
im <- insertImage InlineImage img
|
||||
return [el "coverpage" im]
|
||||
coverpage <- case lookupMeta "cover-image" meta' of
|
||||
Just (MetaInlines [Str s]) -> coverimage s
|
||||
Just (MetaString s) -> coverimage s
|
||||
_ -> return []
|
||||
return $ el "description"
|
||||
[ el "title-info" (genre : (bt ++ as ++ dd ++ lang))
|
||||
, el "document-info" [ el "program-used" "pandoc" ] -- FIXME: +version
|
||||
, el "document-info" ([ el "program-used" "pandoc" ] -- FIXME: +version
|
||||
++ coverpage)
|
||||
]
|
||||
|
||||
booktitle :: PandocMonad m => Meta -> FBM m [Content]
|
||||
|
|
Loading…
Reference in a new issue