diff --git a/doc/org.md b/doc/org.md index c9f37b166..522ccc23c 100644 --- a/doc/org.md +++ b/doc/org.md @@ -22,7 +22,8 @@ The following export keywords are supported: - EMAIL: author email address; passed as plain-text metadata field `email`, but not used by any default templates. -- LANGUAGE: currently unsupported; use `#+LANG:` instead. +- LANGUAGE: document language; included as plain-text metadata + field `lang`. The value should be a [BCP47 language tag]. - SELECT_TAGS: tags which select a tree for export. Currently *unsupported*. @@ -36,6 +37,8 @@ The following export keywords are supported: defaults to stdout unless a target has to be given as a command line option. +[BCP47 language tag]: https://tools.ietf.org/html/bcp47 + Format-specific options ----------------------- diff --git a/src/Text/Pandoc/Readers/Org/Meta.hs b/src/Text/Pandoc/Readers/Org/Meta.hs index 43de04ffa..4864d9478 100644 --- a/src/Text/Pandoc/Readers/Org/Meta.hs +++ b/src/Text/Pandoc/Readers/Org/Meta.hs @@ -93,6 +93,8 @@ keywordHandlers = Map.fromList , "institute" ~~> lineOfInlines `parseThen` collectLines "institute" -- topic keywords , "keywords" ~~> lineOfInlines `parseThen` collectLines "keywords" + -- document language + , "language" ~~> fmap pure anyLine `parseThen` B.setMeta "lang" -- LaTeX-specific export settings , "latex_class" ~~> fmap pure anyLine `parseThen` B.setMeta "documentclass" , "latex_class_options" ~~> diff --git a/test/Tests/Readers/Org/Meta.hs b/test/Tests/Readers/Org/Meta.hs index 3290e718b..041016f64 100644 --- a/test/Tests/Readers/Org/Meta.hs +++ b/test/Tests/Readers/Org/Meta.hs @@ -112,6 +112,10 @@ tests = "#+institute: ACME Inc." =?> Pandoc (setMeta "institute" ("ACME Inc." :: Inlines) nullMeta) mempty + , "Document language" =: + "#+LANGUAGE: de-DE" =?> + Pandoc (setMeta "lang" (MetaString "de-DE") nullMeta) mempty + , testGroup "LaTeX" [ "LATEX_HEADER" =: "#+latex_header: \\usepackage{tikz}" =?>