"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "test/Tests/Readers/Org/Block/CodeBlock.hs" between
pandoc-2.11.1.1.tar.gz and pandoc-2.11.2.tar.gz

About: Pandoc converts files from one markup format into another.

CodeBlock.hs  (pandoc-2.11.1.1):CodeBlock.hs  (pandoc-2.11.2)
skipping to change at line 26 skipping to change at line 26
import Prelude import Prelude
import Test.Tasty (TestTree) import Test.Tasty (TestTree)
import Tests.Helpers ((=?>)) import Tests.Helpers ((=?>))
import Tests.Readers.Org.Shared ((=:), spcSep) import Tests.Readers.Org.Shared ((=:), spcSep)
import Text.Pandoc.Builder import Text.Pandoc.Builder
import qualified Data.Text as T import qualified Data.Text as T
tests :: [TestTree] tests :: [TestTree]
tests = tests =
[ "Source block" =: [ "Source block" =:
T.unlines [ " #+BEGIN_SRC haskell" T.unlines [ " #+begin_src haskell"
, " main = putStrLn greeting" , " main = putStrLn greeting"
, " where greeting = \"moin\"" , " where greeting = \"moin\""
, " #+END_SRC" ] =?> , " #+end_src" ] =?>
let attr' = ("", ["haskell"], []) let attr' = ("", ["haskell"], [])
code' = "main = putStrLn greeting\n" <> code' = "main = putStrLn greeting\n" <>
" where greeting = \"moin\"\n" " where greeting = \"moin\"\n"
in codeBlockWith attr' code' in codeBlockWith attr' code'
, "Source block with indented code" =: , "Source block with indented code" =:
T.unlines [ " #+BEGIN_SRC haskell" T.unlines [ " #+begin_src haskell"
, " main = putStrLn greeting" , " main = putStrLn greeting"
, " where greeting = \"moin\"" , " where greeting = \"moin\""
, " #+END_SRC" ] =?> , " #+end_src" ] =?>
let attr' = ("", ["haskell"], []) let attr' = ("", ["haskell"], [])
code' = "main = putStrLn greeting\n" <> code' = "main = putStrLn greeting\n" <>
" where greeting = \"moin\"\n" " where greeting = \"moin\"\n"
in codeBlockWith attr' code' in codeBlockWith attr' code'
, "Source block with tab-indented code" =: , "Source block with tab-indented code" =:
T.unlines [ "\t#+BEGIN_SRC haskell" T.unlines [ "\t#+begin_src haskell"
, "\tmain = putStrLn greeting" , "\tmain = putStrLn greeting"
, "\t where greeting = \"moin\"" , "\t where greeting = \"moin\""
, "\t#+END_SRC" ] =?> , "\t#+end_src" ] =?>
let attr' = ("", ["haskell"], []) let attr' = ("", ["haskell"], [])
code' = "main = putStrLn greeting\n" <> code' = "main = putStrLn greeting\n" <>
" where greeting = \"moin\"\n" " where greeting = \"moin\"\n"
in codeBlockWith attr' code' in codeBlockWith attr' code'
, "Empty source block" =: , "Empty source block" =:
T.unlines [ " #+BEGIN_SRC haskell" T.unlines [ " #+begin_src haskell"
, " #+END_SRC" ] =?> , " #+end_src" ] =?>
let attr' = ("", ["haskell"], []) let attr' = ("", ["haskell"], [])
code' = "" code' = ""
in codeBlockWith attr' code' in codeBlockWith attr' code'
, "Source block between paragraphs" =: , "Source block between paragraphs" =:
T.unlines [ "Low German greeting" T.unlines [ "Low German greeting"
, " #+BEGIN_SRC haskell" , " #+begin_src haskell"
, " main = putStrLn greeting" , " main = putStrLn greeting"
, " where greeting = \"Moin!\"" , " where greeting = \"Moin!\""
, " #+END_SRC" ] =?> , " #+end_src" ] =?>
let attr' = ("", ["haskell"], []) let attr' = ("", ["haskell"], [])
code' = "main = putStrLn greeting\n" <> code' = "main = putStrLn greeting\n" <>
" where greeting = \"Moin!\"\n" " where greeting = \"Moin!\"\n"
in mconcat [ para $ spcSep [ "Low", "German", "greeting" ] in mconcat [ para $ spcSep [ "Low", "German", "greeting" ]
, codeBlockWith attr' code' , codeBlockWith attr' code'
] ]
, "Source block with babel arguments" =: , "Source block with babel arguments" =:
T.unlines [ "#+BEGIN_SRC emacs-lisp :exports both" T.unlines [ "#+begin_src emacs-lisp :exports both"
, "(progn (message \"Hello, World!\")" , "(progn (message \"Hello, World!\")"
, " (+ 23 42))" , " (+ 23 42))"
, "#+END_SRC" ] =?> , "#+end_src" ] =?>
let classes = [ "commonlisp" ] -- as kate doesn't know emacs-lisp syntax let classes = [ "commonlisp" ] -- as kate doesn't know emacs-lisp syntax
params = [ ("org-language", "emacs-lisp") params = [ ("org-language", "emacs-lisp")
, ("exports", "both") , ("exports", "both")
] ]
code' = T.unlines [ "(progn (message \"Hello, World!\")" code' = T.unlines [ "(progn (message \"Hello, World!\")"
, " (+ 23 42))" ] , " (+ 23 42))" ]
in codeBlockWith ("", classes, params) code' in codeBlockWith ("", classes, params) code'
, "Source block with results and :exports both" =: , "Source block with results and :exports both" =:
T.unlines [ "#+BEGIN_SRC emacs-lisp :exports both" T.unlines [ "#+begin_src emacs-lisp :exports both"
, "(progn (message \"Hello, World!\")" , "(progn (message \"Hello, World!\")"
, " (+ 23 42))" , " (+ 23 42))"
, "#+END_SRC" , "#+end_src"
, "" , ""
, "#+RESULTS:" , "#+RESULTS:"
, ": 65"] =?> , ": 65"] =?>
let classes = [ "commonlisp" ] let classes = [ "commonlisp" ]
params = [ ("org-language", "emacs-lisp") params = [ ("org-language", "emacs-lisp")
, ("exports", "both") , ("exports", "both")
] ]
code' = T.unlines [ "(progn (message \"Hello, World!\")" code' = T.unlines [ "(progn (message \"Hello, World!\")"
, " (+ 23 42))" ] , " (+ 23 42))" ]
results' = "65\n" results' = "65\n"
in codeBlockWith ("", classes, params) code' in codeBlockWith ("", classes, params) code'
<> <>
codeBlockWith ("", ["example"], []) results' codeBlockWith ("", ["example"], []) results'
, "Source block with results and :exports code" =: , "Source block with results and :exports code" =:
T.unlines [ "#+BEGIN_SRC emacs-lisp :exports code" T.unlines [ "#+begin_src emacs-lisp :exports code"
, "(progn (message \"Hello, World!\")" , "(progn (message \"Hello, World!\")"
, " (+ 23 42))" , " (+ 23 42))"
, "#+END_SRC" , "#+end_src"
, "" , ""
, "#+RESULTS:" , "#+RESULTS:"
, ": 65" ] =?> , ": 65" ] =?>
let classes = [ "commonlisp" ] let classes = [ "commonlisp" ]
params = [ ("org-language", "emacs-lisp") params = [ ("org-language", "emacs-lisp")
, ("exports", "code") , ("exports", "code")
] ]
code' = T.unlines [ "(progn (message \"Hello, World!\")" code' = T.unlines [ "(progn (message \"Hello, World!\")"
, " (+ 23 42))" ] , " (+ 23 42))" ]
in codeBlockWith ("", classes, params) code' in codeBlockWith ("", classes, params) code'
, "Source block with results and :exports results" =: , "Source block with results and :exports results" =:
T.unlines [ "#+BEGIN_SRC emacs-lisp :exports results" T.unlines [ "#+begin_src emacs-lisp :exports results"
, "(progn (message \"Hello, World!\")" , "(progn (message \"Hello, World!\")"
, " (+ 23 42))" , " (+ 23 42))"
, "#+END_SRC" , "#+end_src"
, "" , ""
, "#+RESULTS:" , "#+RESULTS:"
, ": 65" ] =?> , ": 65" ] =?>
let results' = "65\n" let results' = "65\n"
in codeBlockWith ("", ["example"], []) results' in codeBlockWith ("", ["example"], []) results'
, "Source block with results and :exports none" =: , "Source block with results and :exports none" =:
T.unlines [ "#+BEGIN_SRC emacs-lisp :exports none" T.unlines [ "#+begin_src emacs-lisp :exports none"
, "(progn (message \"Hello, World!\")" , "(progn (message \"Hello, World!\")"
, " (+ 23 42))" , " (+ 23 42))"
, "#+END_SRC" , "#+end_src"
, "" , ""
, "#+RESULTS:" , "#+RESULTS:"
, ": 65" ] =?> , ": 65" ] =?>
(mempty :: Blocks) (mempty :: Blocks)
, "Source block with toggling header arguments" =: , "Source block with toggling header arguments" =:
T.unlines [ "#+BEGIN_SRC sh :noeval" T.unlines [ "#+begin_src sh :noeval"
, "echo $HOME" , "echo $HOME"
, "#+END_SRC" , "#+end_src"
] =?> ] =?>
let classes = [ "bash" ] let classes = [ "bash" ]
params = [ ("org-language", "sh"), ("noeval", "yes") ] params = [ ("org-language", "sh"), ("noeval", "yes") ]
in codeBlockWith ("", classes, params) "echo $HOME\n" in codeBlockWith ("", classes, params) "echo $HOME\n"
, "Source block with line number switch" =: , "Source block with line number switch" =:
T.unlines [ "#+BEGIN_SRC sh -n 10" T.unlines [ "#+begin_src sh -n 10"
, ":() { :|:& };:" , ":() { :|:& };:"
, "#+END_SRC" , "#+end_src"
] =?> ] =?>
let classes = [ "bash", "numberLines" ] let classes = [ "bash", "numberLines" ]
params = [ ("org-language", "sh"), ("startFrom", "10") ] params = [ ("org-language", "sh"), ("startFrom", "10") ]
in codeBlockWith ("", classes, params) ":() { :|:& };:\n" in codeBlockWith ("", classes, params) ":() { :|:& };:\n"
, "Source block with multi-word parameter values" =: , "Source block with multi-word parameter values" =:
T.unlines [ "#+BEGIN_SRC dot :cmdline -Kdot -Tpng " T.unlines [ "#+begin_src dot :cmdline -Kdot -Tpng "
, "digraph { id [label=\"ID\"] }" , "digraph { id [label=\"ID\"] }"
, "#+END_SRC" , "#+end_src"
] =?> ] =?>
let classes = [ "dot" ] let classes = [ "dot" ]
params = [ ("cmdline", "-Kdot -Tpng") ] params = [ ("cmdline", "-Kdot -Tpng") ]
in codeBlockWith ("", classes, params) "digraph { id [label=\"ID\"] }\n" in codeBlockWith ("", classes, params) "digraph { id [label=\"ID\"] }\n"
, "Example block" =: , "Example block" =:
T.unlines [ "#+begin_example" T.unlines [ "#+begin_example"
, "A chosen representation of" , "A chosen representation of"
, "a rule." , "a rule."
, "#+eND_exAMPle" , "#+eND_exAMPle"
] =?> ] =?>
codeBlockWith ("", ["example"], []) codeBlockWith ("", ["example"], [])
"A chosen representation of\na rule.\n" "A chosen representation of\na rule.\n"
, "Code block with caption" =: , "Code block with caption" =:
T.unlines [ "#+CAPTION: Functor laws in Haskell" T.unlines [ "#+caption: Functor laws in Haskell"
, "#+NAME: functor-laws" , "#+name: functor-laws"
, "#+BEGIN_SRC haskell" , "#+begin_src haskell"
, "fmap id = id" , "fmap id = id"
, "fmap (p . q) = (fmap p) . (fmap q)" , "fmap (p . q) = (fmap p) . (fmap q)"
, "#+END_SRC" , "#+end_src"
] =?> ] =?>
divWith divWith
nullAttr nullAttr
(mappend (mappend
(plain $ spanWith ("", ["label"], []) (plain $ spanWith ("", ["label"], [])
(spcSep [ "Functor", "laws", "in", "Haskell" ])) (spcSep [ "Functor", "laws", "in", "Haskell" ]))
(codeBlockWith ("functor-laws", ["haskell"], []) (codeBlockWith ("functor-laws", ["haskell"], [])
(T.unlines [ "fmap id = id" (T.unlines [ "fmap id = id"
, "fmap (p . q) = (fmap p) . (fmap q)" , "fmap (p . q) = (fmap p) . (fmap q)"
]))) ])))
, "Non-letter chars in source block parameters" =: , "Non-letter chars in source block parameters" =:
T.unlines [ "#+BEGIN_SRC C :tangle xxxx.c :city Zürich" T.unlines [ "#+begin_src C :tangle xxxx.c :city Zürich"
, "code body" , "code body"
, "#+END_SRC" , "#+end_src"
] =?> ] =?>
let params = [ ("org-language", "C") let params = [ ("org-language", "C")
, ("tangle", "xxxx.c") , ("tangle", "xxxx.c")
, ("city", "Zürich") , ("city", "Zürich")
] ]
in codeBlockWith ( "", ["c"], params) "code body\n" in codeBlockWith ( "", ["c"], params) "code body\n"
] ]
 End of changes. 29 change blocks. 
32 lines changed or deleted 32 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)