diff options
author | Alexander Krotov <ilabdsf@gmail.com> | 2017-12-28 16:02:42 +0300 |
---|---|---|
committer | Alexander Krotov <ilabdsf@gmail.com> | 2017-12-28 16:03:18 +0300 |
commit | 0fd7ed0cab165821346b71055bd3ca7f94a825e4 (patch) | |
tree | f76745b6fe8389b1fbbcd31956b60c682227960c /src/Text | |
parent | 52a4cf669970881424b426c654dc5a2f544786e3 (diff) | |
download | pandoc-0fd7ed0cab165821346b71055bd3ca7f94a825e4.tar.gz |
FB2 writer: add cover image specified by "cover-image" meta
Fixes #4195
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Writers/FB2.hs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/FB2.hs b/src/Text/Pandoc/Writers/FB2.hs index 633f42442..0a4130ca4 100644 --- a/src/Text/Pandoc/Writers/FB2.hs +++ b/src/Text/Pandoc/Writers/FB2.hs @@ -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] |