From 1480606174260657e27a0f02f8f44f1fca14b005 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Mon, 29 Jun 2020 17:00:24 +0200 Subject: Org reader: support LATEX_HEADER_EXTRA and HTML_HEAD_EXTRA settings These export settings are treated like their non-extra counterparts, i.e., the values are added to the `header-includes` metadata list. --- test/Tests/Readers/Org/Meta.hs | 78 ++++++++++++++++++++++++++---------------- 1 file changed, 49 insertions(+), 29 deletions(-) (limited to 'test/Tests/Readers/Org') diff --git a/test/Tests/Readers/Org/Meta.hs b/test/Tests/Readers/Org/Meta.hs index 89cd35b26..dd51cbd48 100644 --- a/test/Tests/Readers/Org/Meta.hs +++ b/test/Tests/Readers/Org/Meta.hs @@ -108,42 +108,62 @@ tests = meta = setMeta "keywords" (MetaInlines keywords) nullMeta in Pandoc meta mempty - , "LaTeX_headers options are translated to header-includes" =: - "#+LaTeX_header: \\usepackage{tikz}" =?> - let latexInlines = rawInline "latex" "\\usepackage{tikz}" - inclList = MetaList [MetaInlines (toList latexInlines)] - meta = setMeta "header-includes" inclList nullMeta - in Pandoc meta mempty + , "Institute" =: + "#+INSTITUTE: ACME Inc." =?> + Pandoc (setMeta "institute" ("ACME Inc." :: Inlines) nullMeta) mempty - , testGroup "LaTeX_CLASS" - [ "LaTeX_class option is translated to documentclass" =: - "#+LATEX_CLASS: article" =?> - let meta = setMeta "documentclass" (MetaString "article") nullMeta + , testGroup "LaTeX" + [ "LaTeX_headers options are translated to header-includes" =: + "#+LaTeX_header: \\usepackage{tikz}" =?> + let latexInlines = rawInline "latex" "\\usepackage{tikz}" + inclList = MetaList [MetaInlines (toList latexInlines)] + meta = setMeta "header-includes" inclList 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 + , "LATEX_HEADER_EXTRA values are translated to header-includes" =: + "#+LATEX_HEADER_EXTRA: \\usepackage{calc}" =?> + let latexInlines = rawInline "latex" "\\usepackage{calc}" + inclList = toMetaValue [latexInlines] + in Pandoc (setMeta "header-includes" inclList nullMeta) mempty + + , 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 in Pandoc meta mempty ] - , "LaTeX_class_options is translated to classoption" =: - "#+LATEX_CLASS_OPTIONS: [a4paper]" =?> - let meta = setMeta "classoption" (MetaString "a4paper") nullMeta - in Pandoc meta mempty - - , "LaTeX_class_options is translated to classoption" =: - "#+html_head: " =?> - let html = rawInline "html" "" - inclList = MetaList [MetaInlines (toList html)] - meta = setMeta "header-includes" inclList nullMeta - in Pandoc meta mempty + , testGroup "HTML" + [ "HTML_HEAD values are added to header-includes" =: + "#+html_head: " =?> + let html = rawInline "html" "" + inclList = MetaList [MetaInlines (toList html)] + meta = setMeta "header-includes" inclList nullMeta + in Pandoc meta mempty - , "Institute" =: - "#+INSTITUTE: ACME Inc." =?> - Pandoc (setMeta "institute" ("ACME Inc." :: Inlines) nullMeta) mempty + , "HTML_HEAD_EXTRA behaves like HTML_HEAD" =: + T.unlines [ "#+HTML_HEAD: " + , "#+HTML_HEAD_EXTRA: " + ] =?> + let generator = rawInline "html" + "" + charset = rawInline "html" "" + inclList = toMetaValue [generator, charset] + in Pandoc (setMeta "header-includes" inclList nullMeta) mempty + ] ] , "Properties drawer" =: -- cgit v1.2.3