diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2012-01-01 14:32:27 -0800 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2012-01-01 14:32:27 -0800 |
commit | 4e30f24974a2aa698afcb7b3e639030c816e0a41 (patch) | |
tree | ddc3074827e0bb5e3ba94808f6b1eb4460d37af3 /src/Text | |
parent | da8425598a8ab4a98388e8ee346a2ae7ec540aa0 (diff) | |
download | pandoc-4e30f24974a2aa698afcb7b3e639030c816e0a41.tar.gz |
EPUB writer: Allow `lang` variable to set language in metadata.
Defaults to locale language if `lang` is not set.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Writers/EPUB.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs index a817f07a5..af907a809 100644 --- a/src/Text/Pandoc/Writers/EPUB.hs +++ b/src/Text/Pandoc/Writers/EPUB.hs @@ -120,8 +120,11 @@ writeEPUB mbStylesheet opts doc@(Pandoc meta _) = do let chapterEntries = zipWith chapterToEntry [1..] chapters -- contents.opf - lang <- catch (liftM (takeWhile (/='.')) $ getEnv "LANG") - (\_ -> return "en-US") + localeLang <- catch (liftM (takeWhile (/='.')) $ getEnv "LANG") + (\_ -> return "en-US") + let lang = case lookup "lang" (writerVariables opts') of + Just x -> x + Nothing -> localeLang uuid <- getRandomUUID let chapterNode ent = unode "item" ! [("id", takeBaseName $ eRelativePath ent), |