@@ -467,7 +467,14 @@ tests =
467467 , "Author" =:
468468 "#+author: Albert /Emacs-Fanboy/ Krewinkel" =?>
469469 let author = toList . spcSep $ [ "Albert", emph "Emacs-Fanboy", "Krewinkel" ]
470− meta = setMeta "author" (MetaInlines author) $ nullMeta
470+ meta = setMeta "author" (MetaList [MetaInlines author]) $ nullMeta
471+ in Pandoc meta mempty
472+
473+ , "Multiple authors" =:
474+ "#+author: James Dewey Watson, Francis Harry Compton Crick " =?>
475+ let watson = MetaInlines $ toList "James Dewey Watson"
476+ crick = MetaInlines $ toList "Francis Harry Compton Crick"
477+ meta = setMeta "author" (MetaList [watson, crick]) $ nullMeta
471478 in Pandoc meta mempty
472479
473480 , "Date" =:
@@ -478,8 +485,8 @@ tests =
478485
479486 , "Description" =:
480487 "#+DESCRIPTION: Explanatory text" =?>
481− let description = toList . spcSep $ [ "Explanatory", "text" ]
482− meta = setMeta "description" (MetaInlines description) $ nullMeta
488+ let description = "Explanatory text"
489+ meta = setMeta "description" (MetaString description) $ nullMeta
483490 in Pandoc meta mempty
484491
485492 , "Properties drawer" =:
@@ -489,6 +496,38 @@ tests =
489496 ] =?>
490497 (mempty::Blocks)
491498
499+ , "LaTeX_headers options are translated to header-includes" =:
500+ "#+LaTeX_header: \\usepackage{tikz}" =?>
501+ let latexInlines = rawInline "latex" "\\usepackage{tikz}"
502+ inclList = MetaList [MetaInlines (toList latexInlines)]
503+ meta = setMeta "header-includes" inclList nullMeta
504+ in Pandoc meta mempty
505+
506+ , "LaTeX_class option is translated to documentclass" =:
507+ "#+LATEX_CLASS: article" =?>
508+ let meta = setMeta "documentclass" (MetaString "article") nullMeta
509+ in Pandoc meta mempty
510+
511+ , "LaTeX_class_options is translated to classoption" =:
512+ "#+LATEX_CLASS_OPTIONS: [a4paper]" =?>
513+ let meta = setMeta "classoption" (MetaString "a4paper") nullMeta
514+ in Pandoc meta mempty
515+
516+ , "LaTeX_class_options is translated to classoption" =:
517+ "#+html_head: <meta/>" =?>
518+ let html = rawInline "html" "<meta/>"
519+ inclList = MetaList [MetaInlines (toList html)]
520+ meta = setMeta "header-includes" inclList nullMeta
521+ in Pandoc meta mempty
522+
523+ , "later meta definitions take precedence" =:
524+ unlines [ "#+AUTHOR: this will not be used"
525+ , "#+author: Max"
526+ ] =?>
527+ let author = MetaInlines [Str "Max"]
528+ meta = setMeta "author" (MetaList [author]) $ nullMeta
529+ in Pandoc meta mempty
530+
492531 , "Logbook drawer" =:
493532 unlines [ " :LogBook:"
494533 , " - State \"DONE\" from \"TODO\" [2014-03-03 Mon 11:00]"
@@ -563,69 +602,91 @@ tests =
563602 ] =?>
564603 (para (link "http://example.com/foo" "" "bar"))
565604
566− , "Export option: Disable simple sub/superscript syntax" =:
567− unlines [ "#+OPTIONS: ^:nil"
568− , "a^b"
569− ] =?>
570− para "a^b"
571−
572− , "Export option: directly select drawers to be exported" =:
573− unlines [ "#+OPTIONS: d:(\"IMPORTANT\")"
574− , ":IMPORTANT:"
575− , "23"
576− , ":END:"
577− , ":BORING:"
578− , "very boring"
579− , ":END:"
580− ] =?>
581− divWith (mempty, ["IMPORTANT", "drawer"], mempty) (para "23")
582−
583− , "Export option: exclude drawers from being exported" =:
584− unlines [ "#+OPTIONS: d:(not \"BORING\")"
585− , ":IMPORTANT:"
586− , "5"
587− , ":END:"
588− , ":BORING:"
589− , "very boring"
590− , ":END:"
591− ] =?>
592− divWith (mempty, ["IMPORTANT", "drawer"], mempty) (para "5")
593605
594− , "Export option: don't include archive trees" =:
595− unlines [ "#+OPTIONS: arch:nil"
596− , "* old :ARCHIVE:"
597− ] =?>
598− (mempty ::Blocks)
606+ , testGroup "export options"
607+
608+ [ "disable simple sub/superscript syntax" =:
609+ unlines [ "#+OPTIONS: ^:nil"
610+ , "a^b"
611+ ] =?>
612+ para "a^b"
613+
614+ , "directly select drawers to be exported" =:
615+ unlines [ "#+OPTIONS: d:(\"IMPORTANT\")"
616+ , ":IMPORTANT:"
617+ , "23"
618+ , ":END:"
619+ , ":BORING:"
620+ , "very boring"
621+ , ":END:"
622+ ] =?>
623+ divWith (mempty, ["IMPORTANT", "drawer"], mempty) (para "23")
624+
625+ , "exclude drawers from being exported" =:
626+ unlines [ "#+OPTIONS: d:(not \"BORING\")"
627+ , ":IMPORTANT:"
628+ , "5"
629+ , ":END:"
630+ , ":BORING:"
631+ , "very boring"
632+ , ":END:"
633+ ] =?>
634+ divWith (mempty, ["IMPORTANT", "drawer"], mempty) (para "5")
635+
636+ , "don't include archive trees" =:
637+ unlines [ "#+OPTIONS: arch:nil"
638+ , "* old :ARCHIVE:"
639+ ] =?>
640+ (mempty ::Blocks)
641+
642+ , "include complete archive trees" =:
643+ unlines [ "#+OPTIONS: arch:t"
644+ , "* old :ARCHIVE:"
645+ , " boring"
646+ ] =?>
647+ let tagSpan t = spanWith ("", ["tag"], [("data-tag-name", t)]) mempty
648+ in mconcat [ headerWith ("old", [], mempty) 1 ("old" <> tagSpan "ARCHIVE")
649+ , para "boring"
650+ ]
599651
600− , "Export option: include complete archive trees" =:
601− unlines [ "#+OPTIONS: arch:t"
602− , "* old :ARCHIVE:"
603− , " boring"
604− ] =?>
605− let tagSpan t = spanWith ("", ["tag"], [("data-tag-name", t)]) mempty
606− in mconcat [ headerWith ("old", [], mempty) 1 ("old" <> tagSpan "ARCHIVE")
607− , para "boring"
608− ]
652+ , "include archive tree header only" =:
653+ unlines [ "#+OPTIONS: arch:headline"
654+ , "* old :ARCHIVE:"
655+ , " boring"
656+ ] =?>
657+ let tagSpan t = spanWith ("", ["tag"], [("data-tag-name", t)]) mempty
658+ in headerWith ("old", [], mempty) 1 ("old" <> tagSpan "ARCHIVE")
659+
660+ , "limit headline depth" =:
661+ unlines [ "#+OPTIONS: H:2"
662+ , "* section"
663+ , "** subsection"
664+ , "*** list item 1"
665+ , "*** list item 2"
666+ ] =?>
667+ mconcat [ headerWith ("section", [], []) 1 "section"
668+ , headerWith ("subsection", [], []) 2 "subsection"
669+ , orderedList [ para "list item 1", para "list item 2" ]
670+ ]
609671
610− , "Export option: include archive tree header only" =:
611− unlines [ "#+OPTIONS: arch:headline"
612− , "* old :ARCHIVE:"
613− , " boring"
614− ] =?>
615− let tagSpan t = spanWith ("", ["tag"], [("data-tag-name", t)]) mempty
616− in headerWith ("old", [], mempty) 1 ("old" <> tagSpan "ARCHIVE")
617−
618− , "Export option: limit headline depth" =:
619− unlines [ "#+OPTIONS: H:2"
620− , "* section"
621− , "** subsection"
622− , "*** list item 1"
623− , "*** list item 2"
624− ] =?>
625− mconcat [ headerWith ("section", [], []) 1 "section"
626− , headerWith ("subsection", [], []) 2 "subsection"
627− , orderedList [ para "list item 1", para "list item 2" ]
628− ]
672+ , "disable author export" =:
673+ unlines [ "#+OPTIONS: author:nil"
674+ , "#+AUTHOR: ShyGuy"
675+ ] =?>
676+ Pandoc nullMeta mempty
677+
678+ , "disable creator export" =:
679+ unlines [ "#+OPTIONS: creator:nil"
680+ , "#+creator: The Architect"
681+ ] =?>
682+ Pandoc nullMeta mempty
683+
684+ , "disable email export" =:
685+ unlines [ "#+OPTIONS: email:nil"
686+ , "#+email: no-mail-please@example.com"
687+ ] =?>
688+ Pandoc nullMeta mempty
689+ ]
629690 ]
630691
631692 , testGroup "Basic Blocks" $