Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FB2 writer: Add support for "lang" metadata #3625

Merged
merged 1 commit into from
May 2, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
FB2 writer: Add support for "lang" metadata
  • Loading branch information
Alexander Krotov committed May 1, 2017
commit d6a3997d17e4f5921ed37c96b917d6527fec898f
9 changes: 7 additions & 2 deletions src/Text/Pandoc/Writers/FB2.hs
Original file line number Diff line number Diff line change
@@ -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
]