aboutsummaryrefslogtreecommitdiff
path: root/tests/Tests
diff options
context:
space:
mode:
authorCraig S. Bosma <craig.bosma@gmail.com>2014-07-14 19:14:46 -0500
committerCraig S. Bosma <csb@distrustsimplicity.net>2014-07-17 10:23:22 -0500
commit1bb4f0c497a352a12a546fd9f1dff570bdee4018 (patch)
tree41e60a4c56e7805c8e15c88c9b3264f34ffea8a0 /tests/Tests
parente0535622805d43a20c6ef93789b59bf234b27437 (diff)
downloadpandoc-1bb4f0c497a352a12a546fd9f1dff570bdee4018.tar.gz
Org reader: Respect :exports header arguments on code blocks
Adds support to the org reader for conditionally exporting either the code block, results block immediately following, both, or neither, depending on the value of the `:exports` header argument. If no such argument is supplied, the default org behavior (for most languages) of exporting code is used.
Diffstat (limited to 'tests/Tests')
-rw-r--r--tests/Tests/Readers/Org.hs60
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/Tests/Readers/Org.hs b/tests/Tests/Readers/Org.hs
index f8240ca3d..d56b57a94 100644
--- a/tests/Tests/Readers/Org.hs
+++ b/tests/Tests/Readers/Org.hs
@@ -886,6 +886,66 @@ tests =
, " (+ 23 42))" ]
in codeBlockWith ("", classes, params) code'
+ , "Source block with results and :exports both" =:
+ unlines [ "#+BEGIN_SRC emacs-lisp :exports both"
+ , "(progn (message \"Hello, World!\")"
+ , " (+ 23 42))"
+ , "#+END_SRC"
+ , ""
+ , "#+RESULTS:"
+ , ": 65"] =?>
+ let classes = [ "commonlisp" -- as kate doesn't know emacs-lisp syntax
+ , "rundoc-block"
+ ]
+ params = [ ("rundoc-language", "emacs-lisp")
+ , ("rundoc-exports", "both")
+ ]
+ code' = unlines [ "(progn (message \"Hello, World!\")"
+ , " (+ 23 42))" ]
+ results' = "65\n"
+ in codeBlockWith ("", classes, params) code'
+ <>
+ codeBlockWith ("", ["example"], []) results'
+
+ , "Source block with results and :exports code" =:
+ unlines [ "#+BEGIN_SRC emacs-lisp :exports code"
+ , "(progn (message \"Hello, World!\")"
+ , " (+ 23 42))"
+ , "#+END_SRC"
+ , ""
+ , "#+RESULTS:"
+ , ": 65" ] =?>
+ let classes = [ "commonlisp" -- as kate doesn't know emacs-lisp syntax
+ , "rundoc-block"
+ ]
+ params = [ ("rundoc-language", "emacs-lisp")
+ , ("rundoc-exports", "code")
+ ]
+ code' = unlines [ "(progn (message \"Hello, World!\")"
+ , " (+ 23 42))" ]
+ in codeBlockWith ("", classes, params) code'
+
+ , "Source block with results and :exports results" =:
+ unlines [ "#+BEGIN_SRC emacs-lisp :exports results"
+ , "(progn (message \"Hello, World!\")"
+ , " (+ 23 42))"
+ , "#+END_SRC"
+ , ""
+ , "#+RESULTS:"
+ , ": 65" ] =?>
+ let results' = "65\n"
+ in codeBlockWith ("", ["example"], []) results'
+
+ , "Source block with results and :exports none" =:
+ unlines [ "#+BEGIN_SRC emacs-lisp :exports none"
+ , "(progn (message \"Hello, World!\")"
+ , " (+ 23 42))"
+ , "#+END_SRC"
+ , ""
+ , "#+RESULTS:"
+ , ": 65" ] =?>
+ rawBlock "html" ""
+
, "Example block" =:
unlines [ "#+begin_example"
, "A chosen representation of"