git.iko.soy/typeable/pandoc
on master help sign in
FB2 writer: use genre metadata field (#5478)
2fa8c0dJohn
src/Text/Pandoc/Writers/FB2.hs+4−1
@@ -40,6 +40,7 @@ import Text.Pandoc.Definition
40import Text.Pandoc.Logging
40import Text.Pandoc.Logging
41import Text.Pandoc.Options (HTMLMathMethod (..), WriterOptions (..), def)
41import Text.Pandoc.Options (HTMLMathMethod (..), WriterOptions (..), def)
42import Text.Pandoc.Shared (capitalize, isURI, orderedListMarkers, hierarchicalize)
42import Text.Pandoc.Shared (capitalize, isURI, orderedListMarkers, hierarchicalize)
43+import Text.Pandoc.Writers.Shared (lookupMetaString)
43import qualified Text.Pandoc.Shared as Shared (Element(Blk, Sec))
44import qualified Text.Pandoc.Shared as Shared (Element(Blk, Sec))
44
45
45-- | Data to be written at the end of the document:
46-- | Data to be written at the end of the document:
@@ -96,7 +97,9 @@ pandocToFB2 opts (Pandoc meta blocks) = do
96
97
97description :: PandocMonad m => Meta -> FBM m Content
98description :: PandocMonad m => Meta -> FBM m Content
98description meta' = do
99description meta' = do
100+ let genre = case lookupMetaString "genre" meta' of
99− let genre = el "genre" "unrecognised"
101+ "" -> el "genre" "unrecognised"
102+ s -> el "genre" s
100 bt <- booktitle meta'
103 bt <- booktitle meta'
101 let as = authors meta'
104 let as = authors meta'
102 dd <- docdate meta'
105 dd <- docdate meta'