diff options
author | Alexander Krotov <ilabdsf@gmail.com> | 2017-05-02 09:57:08 +0300 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-05-02 08:57:08 +0200 |
commit | 5d529e30c7690146e7f082e0baa616b68da3e594 (patch) | |
tree | d9f9e6d7d5a319cd8f109806ef3caf698bde6d77 /src/Text/Pandoc/Writers | |
parent | ae21a8bb2a9d892491424f257ed0146c1b2affa2 (diff) | |
download | pandoc-5d529e30c7690146e7f082e0baa616b68da3e594.tar.gz |
FB2 writer: Add support for "lang" metadata (#3625)
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r-- | src/Text/Pandoc/Writers/FB2.hs | 9 |
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 ] |