aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-08-12 12:34:36 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2017-08-12 12:34:36 -0700
commitf035f0ffe3ef70abb6fa3ad0e39ac0f9c1f45c5e (patch)
treeaf0d6bc66f53af6ab7b728a7be515bad23064f03
parent444f8e9569bef7fc0f92923a5acc4970ce9f710f (diff)
downloadpandoc-f035f0ffe3ef70abb6fa3ad0e39ac0f9c1f45c5e.tar.gz
LaTeX reader: have `\setmainlanguage` set `lang` in metadata.
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index 1fe4594ed..c382ce440 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -59,7 +59,7 @@ import Text.Pandoc.Class (PandocMonad, PandocPure, lookupEnv,
readFileFromDirs, report, setResourcePath,
getResourcePath, setTranslations, translateTerm)
import qualified Text.Pandoc.Translations as Translations
-import Text.Pandoc.BCP47 (Lang(..))
+import Text.Pandoc.BCP47 (Lang(..), renderLang)
import Text.Pandoc.Highlighting (fromListingsLanguage, languagesByExtension)
import Text.Pandoc.ImageSize (numUnit, showFl)
import Text.Pandoc.Logging
@@ -2225,9 +2225,11 @@ setDefaultLanguage = do
<$> rawopt
polylang <- toksToString <$> braced
case polyglossiaLangToBCP47 polylang o of
- Nothing -> return () -- TODO mzero? warning?
- Just l -> setTranslations l
- return mempty
+ Nothing -> return mempty -- TODO mzero? warning?
+ Just l -> do
+ setTranslations l
+ updateState $ setMeta "lang" $ str (renderLang l)
+ return mempty
polyglossiaLangToBCP47 :: String -> String -> Maybe Lang
polyglossiaLangToBCP47 s o =