aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2017-05-02 09:57:08 +0300
committerJohn MacFarlane <jgm@berkeley.edu>2017-05-02 08:57:08 +0200
commit5d529e30c7690146e7f082e0baa616b68da3e594 (patch)
treed9f9e6d7d5a319cd8f109806ef3caf698bde6d77 /src/Text/Pandoc
parentae21a8bb2a9d892491424f257ed0146c1b2affa2 (diff)
downloadpandoc-5d529e30c7690146e7f082e0baa616b68da3e594.tar.gz
FB2 writer: Add support for "lang" metadata (#3625)
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Writers/FB2.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/FB2.hs b/src/Text/Pandoc/Writers/FB2.hs
index 238bd397b..fb232e278 100644
--- a/src/Text/Pandoc/Writers/FB2.hs
+++ b/src/Text/Pandoc/Writers/FB2.hs
@@ -117,8 +117,13 @@ description meta' = do
bt <- booktitle meta'
let as = authors meta'
dd <- docdate meta'
- return $ el "description"
- [ el "title-info" (bt ++ as ++ dd)
+ let lang = case lookupMeta "lang" meta' of
+ Just (MetaInlines [Str s]) -> [el "lang" $ iso639 s]
+ Just (MetaString s) -> [el "lang" $ iso639 s]
+ _ -> []
+ where iso639 = takeWhile (/= '-') -- Convert BCP 47 to ISO 639
+ return $ el "description" $
+ [ el "title-info" (bt ++ as ++ dd ++ lang)
, el "document-info" [ el "program-used" "pandoc" ] -- FIXME: +version
]