Org reader: parse #+LANGUAGE into lang metadata field

Fixes: #6845
This commit is contained in:
Albert Krewinkel 2020-11-22 12:50:08 +01:00
parent ae52918faa
commit 5344dab8eb
No known key found for this signature in database
GPG key ID: 388DC0B21F631124
3 changed files with 10 additions and 1 deletions

View file

@ -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
-----------------------

View file

@ -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" ~~>

View file

@ -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}" =?>