aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/OpenDocument.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc/Writers/OpenDocument.hs')
-rw-r--r--src/Text/Pandoc/Writers/OpenDocument.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/OpenDocument.hs b/src/Text/Pandoc/Writers/OpenDocument.hs
index e3d7f2e5c..676a1acb0 100644
--- a/src/Text/Pandoc/Writers/OpenDocument.hs
+++ b/src/Text/Pandoc/Writers/OpenDocument.hs
@@ -226,8 +226,10 @@ handleSpaces s
-- | Convert Pandoc document to string in OpenDocument format.
writeOpenDocument :: PandocMonad m => WriterOptions -> Pandoc -> m Text
writeOpenDocument opts (Pandoc meta blocks) = do
- lang <- fromMaybe (Lang "en" "US" "" []) <$>
- toLang (metaValueToString <$> lookupMeta "lang" meta)
+ let defLang = Lang "en" "US" "" []
+ lang <- case lookupMetaString "lang" meta of
+ "" -> pure defLang
+ s -> fromMaybe defLang <$> toLang (Just s)
setTranslations lang
let colwidth = if writerWrapText opts == WrapAuto
then Just $ writerColumns opts