aboutsummaryrefslogtreecommitdiff
path: root/test/Tests/Readers/Org
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2020-06-28 17:36:31 +0200
committerAlbert Krewinkel <albert@zeitkraut.de>2020-06-28 18:01:30 +0200
commite3a6d651e17b88df107bf2293dfc5e3e6dbf35d2 (patch)
treee34b46c35ecf63dea7c3b5fb38317e22efe21319 /test/Tests/Readers/Org
parent54f6faa10f79a7e9172c67a9d860689269aa6cc3 (diff)
downloadpandoc-e3a6d651e17b88df107bf2293dfc5e3e6dbf35d2.tar.gz
Org reader: update behavior of author, keywords export settings
The behavior of the `#+AUTHOR` and `#+KEYWORD` export settings has changed: Org now allows multiple such lines and adds a space between the contents of each line. Pandoc now always parses these settings as meta inlines; setting values are no longer treated as comma-separated lists. Note that a Lua filter can be used to restore the previous behavior.
Diffstat (limited to 'test/Tests/Readers/Org')
-rw-r--r--test/Tests/Readers/Org/Meta.hs55
1 files changed, 35 insertions, 20 deletions
diff --git a/test/Tests/Readers/Org/Meta.hs b/test/Tests/Readers/Org/Meta.hs
index 27fd20744..ab6de231b 100644
--- a/test/Tests/Readers/Org/Meta.hs
+++ b/test/Tests/Readers/Org/Meta.hs
@@ -46,18 +46,24 @@ tests =
meta = setMeta "title" (MetaInlines titleInline) nullMeta
in Pandoc meta mempty
- , "Author" =:
- "#+author: John /Emacs-Fanboy/ Doe" =?>
- let author = toList . spcSep $ [ "John", emph "Emacs-Fanboy", "Doe" ]
- meta = setMeta "author" (MetaList [MetaInlines author]) nullMeta
- in Pandoc meta mempty
+ , testGroup "Author"
+ [ "sets 'author' field" =:
+ "#+author: John /Emacs-Fanboy/ Doe" =?>
+ let author = toList . spcSep $ [ "John", emph "Emacs-Fanboy", "Doe" ]
+ meta = setMeta "author" (MetaInlines author) nullMeta
+ in Pandoc meta mempty
- , "Multiple authors" =:
- "#+author: James Dewey Watson, Francis Harry Compton Crick " =?>
- let watson = MetaInlines $ toList "James Dewey Watson"
- crick = MetaInlines $ toList "Francis Harry Compton Crick"
- meta = setMeta "author" (MetaList [watson, crick]) nullMeta
- in Pandoc meta mempty
+ , "Multiple author lines" =:
+ T.unlines [ "#+author: James Dewey Watson,"
+ , "#+author: Francis Harry Compton Crick"
+ ] =?>
+ let watson = toList "James Dewey Watson,"
+ crick = toList "Francis Harry Compton Crick"
+ meta = setMeta "author"
+ (MetaInlines (watson ++ SoftBreak : crick))
+ nullMeta
+ in Pandoc meta mempty
+ ]
, "Date" =:
"#+Date: Feb. *28*, 2014" =?>
@@ -83,6 +89,14 @@ tests =
in Pandoc meta mempty
]
+ , "Keywords" =:
+ T.unlines [ "#+KEYWORDS: pandoc, testing,"
+ , "#+KEYWORDS: Org"
+ ] =?>
+ let keywords = toList $ "pandoc, testing," <> softbreak <> "Org"
+ meta = setMeta "keywords" (MetaInlines keywords) nullMeta
+ in Pandoc meta mempty
+
, "Properties drawer" =:
T.unlines [ " :PROPERTIES:"
, " :setting: foo"
@@ -97,11 +111,20 @@ tests =
meta = setMeta "header-includes" inclList nullMeta
in Pandoc meta mempty
- , "LaTeX_class option is translated to documentclass" =:
+ , testGroup "LaTeX_CLASS"
+ [ "LaTeX_class option is translated to documentclass" =:
"#+LATEX_CLASS: article" =?>
let meta = setMeta "documentclass" (MetaString "article") nullMeta
in Pandoc meta mempty
+ , "last definition takes precedence" =:
+ T.unlines [ "#+LATEX_CLASS: this will not be used"
+ , "#+LATEX_CLASS: report"
+ ] =?>
+ let meta = setMeta "documentclass" (MetaString "report") nullMeta
+ in Pandoc meta mempty
+ ]
+
, "LaTeX_class_options is translated to classoption" =:
"#+LATEX_CLASS_OPTIONS: [a4paper]" =?>
let meta = setMeta "classoption" (MetaString "a4paper") nullMeta
@@ -114,14 +137,6 @@ tests =
meta = setMeta "header-includes" inclList nullMeta
in Pandoc meta mempty
- , "later meta definitions take precedence" =:
- T.unlines [ "#+AUTHOR: this will not be used"
- , "#+author: Max"
- ] =?>
- let author = MetaInlines [Str "Max"]
- meta = setMeta "author" (MetaList [author]) nullMeta
- in Pandoc meta mempty
-
, "Logbook drawer" =:
T.unlines [ " :LogBook:"
, " - State \"DONE\" from \"TODO\" [2014-03-03 Mon 11:00]"