From 27a8603278529cf3e1fcf0cdbaf94bc005c5472a Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Sun, 25 Oct 2015 08:51:53 +0100 Subject: Org reader: allow toggling header args Org-mode allows to skip the argument of a code block header argument if it's toggling a value. Argument-less headers are now recognized, avoiding weird parsing errors. The fixes are not exactly pretty, but neither is the code that was fixed. So I guess it's about par for the course. However, a rewrite of the header parsing code wouldn't hurt in the long run. Thanks to @jo-tham for filing the bug report. This fixes #2269. --- tests/Tests/Readers/Org.hs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tests') diff --git a/tests/Tests/Readers/Org.hs b/tests/Tests/Readers/Org.hs index b1aaaacad..91c1bb672 100644 --- a/tests/Tests/Readers/Org.hs +++ b/tests/Tests/Readers/Org.hs @@ -264,6 +264,16 @@ tests = ) "echo 'Hello, World'") + , "Inline code block with toggle" =: + "src_sh[:toggle]{echo $HOME}" =?> + (para $ codeWith ( "" + , [ "bash", "rundoc-block" ] + , [ ("rundoc-language", "sh") + , ("rundoc-toggle", "yes") + ] + ) + "echo $HOME") + , "Citation" =: "[@nonexistent]" =?> let citation = Citation @@ -1094,6 +1104,15 @@ tests = , ": 65" ] =?> rawBlock "html" "" + , "Source block with toggling header arguments" =: + unlines [ "#+BEGIN_SRC sh :noeval" + , "echo $HOME" + , "#+END_SRC" + ] =?> + let classes = [ "bash", "rundoc-block" ] + params = [ ("rundoc-language", "sh"), ("rundoc-noeval", "yes") ] + in codeBlockWith ("", classes, params) "echo $HOME\n" + , "Example block" =: unlines [ "#+begin_example" , "A chosen representation of" -- cgit v1.2.3