From 5d529e30c7690146e7f082e0baa616b68da3e594 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Tue, 2 May 2017 09:57:08 +0300 Subject: FB2 writer: Add support for "lang" metadata (#3625) --- src/Text/Pandoc/Writers/FB2.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/Text/Pandoc/Writers') 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 ] -- cgit v1.2.3