diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/Tests/Lua.hs | 1 | ||||
-rw-r--r-- | test/command/3937.md | 2 | ||||
-rw-r--r-- | test/command/4159.md | 3 | ||||
-rw-r--r-- | test/command/hspace.md | 2 | ||||
-rw-r--r-- | test/command/macros.md | 34 | ||||
-rw-r--r-- | test/lua/test-pandoc-utils.lua | 19 | ||||
-rw-r--r-- | test/markdown-reader-more.native | 5 |
7 files changed, 54 insertions, 12 deletions
diff --git a/test/Tests/Lua.hs b/test/Tests/Lua.hs index 0e76249fe..57e7c5f0c 100644 --- a/test/Tests/Lua.hs +++ b/test/Tests/Lua.hs @@ -101,6 +101,7 @@ tests = map (localOption (QuickCheckTests 20)) , plain (str "failing pipe: OK") , plain (str "read: OK") , plain (str "failing read: OK") + , plain (str "stringify: OK") ]) ] diff --git a/test/command/3937.md b/test/command/3937.md index 1d5e4238a..2f32cd172 100644 --- a/test/command/3937.md +++ b/test/command/3937.md @@ -3,7 +3,7 @@ # My Great Section {#mysection} # Other section ^D -.. mysection: +.. _mysection: My Great Section ================ diff --git a/test/command/4159.md b/test/command/4159.md index 4881edcc5..81deba53a 100644 --- a/test/command/4159.md +++ b/test/command/4159.md @@ -3,6 +3,5 @@ \newcommand{\gen}{a\ Gen\ b} abc ^D -[RawBlock (Format "latex") "\\newcommand{\\gen}{a\\ Gen\\ b}" -,Para [Str "abc"]] +[Para [Str "abc"]] ``` diff --git a/test/command/hspace.md b/test/command/hspace.md index 5d5c7171b..ec1669ca5 100644 --- a/test/command/hspace.md +++ b/test/command/hspace.md @@ -32,7 +32,7 @@ F & T &\\ F & F &\\ \end{tabular} ^D -[RawBlock (Format "latex") "\\begin{tabular}[t]{cc|c}\n\\(P\\) & \\(Q\\) & \\(P\\wedge Q\\)\\\\\n\\hline\nT & T &\\\\\nT & F &\\\\\nF & T &\\\\\nF & F &\\\\\n\\end{tabular}\\hspace{1em}\\begin{tabular}[t]{cc|c}\n\\(P\\) & \\(Q\\) & \\(P\\vee Q\\)\\\\\n\\hline\nT & T &\\\\\nT & F &\\\\\nF & T &\\\\\nF & F &\\\\\n\\end{tabular}"] +[RawBlock (Format "latex") "\\begin{tabular}[t]{cc|c}\n\\(P\\) & \\(Q\\) & \\(P\\wedge Q\\)\\\\\n\\hline\nT & T &\\\\\nT & F &\\\\\nF & T &\\\\\nF & F &\\\\\n\\end{tabular}\n\\hspace{1em}\n\\begin{tabular}[t]{cc|c}\n\\(P\\) & \\(Q\\) & \\(P\\vee Q\\)\\\\\n\\hline\nT & T &\\\\\nT & F &\\\\\nF & T &\\\\\nF & F &\\\\\n\\end{tabular}"] ``` ``` diff --git a/test/command/macros.md b/test/command/macros.md index 46179e3c7..4bd2eb00a 100644 --- a/test/command/macros.md +++ b/test/command/macros.md @@ -3,7 +3,6 @@ \newcommand{\my}{\phi} $\my+\my$ ^D -\newcommand{\my}{\phi} $\phi+\phi$ ``` @@ -66,3 +65,36 @@ x &= y\\\end{aligned}\] \emph{hi--ok} ``` + +``` +% pandoc -f markdown+latex_macros -t markdown +\newcommand{\my}{\phi} +\begin{equation} +\my+\my +\end{equation} +^D +\begin{equation} +\phi+\phi +\end{equation} +``` + +``` +% pandoc -f markdown-latex_macros -t markdown +\newcommand{\my}{\phi} +\begin{equation} +\my+\my +\end{equation} +^D +\newcommand{\my}{\phi} +\begin{equation} +\my+\my +\end{equation} +``` + +``` +% pandoc -f markdown+latex_macros -t markdown +\newcommand{\my}{\emph{a}} +\my +^D +\emph{a} +``` diff --git a/test/lua/test-pandoc-utils.lua b/test/lua/test-pandoc-utils.lua index 7354496f9..ce3456d5d 100644 --- a/test/lua/test-pandoc-utils.lua +++ b/test/lua/test-pandoc-utils.lua @@ -1,4 +1,4 @@ -utils = require 'pandoc' +utils = require 'pandoc.utils' -- SHA1 ------------------------------------------------------------------------ @@ -22,7 +22,7 @@ function test_pipe () warn 'Did not find /bin/sed, skipping test' return true end - local pipe_result = utils.pipe('/bin/sed', {'-e', 's/a/b/'}, 'abc') + local pipe_result = pandoc.pipe('/bin/sed', {'-e', 's/a/b/'}, 'abc') return pipe_result == 'bbc' end @@ -31,7 +31,7 @@ function test_failing_pipe () warn 'Did not find /bin/false, skipping test' return true end - local res, err = pcall(utils.pipe, '/bin/false', {}, 'abc') + local res, err = pcall(pandoc.pipe, '/bin/false', {}, 'abc') return not res and err.command == '/bin/false' and err.error_code == 1 and @@ -51,6 +51,18 @@ function test_failing_read () return not res and err:match 'Unknown reader: nosuchreader' end +-- Stringify +------------------------------------------------------------------------ +function test_stringify () + local inline = pandoc.Emph{ + pandoc.Str 'Cogito', + pandoc.Space(), + pandoc.Str 'ergo', + pandoc.Space(), + pandoc.Str 'sum.', + } + return utils.stringify(inline) == 'Cogito ergo sum.' +end -- Return result ------------------------------------------------------------------------ @@ -65,5 +77,6 @@ function Para (el) pandoc.Plain{pandoc.Str("failing pipe: " .. run(test_failing_pipe))}, pandoc.Plain{pandoc.Str("read: " .. run(test_read))}, pandoc.Plain{pandoc.Str("failing read: " .. run(test_failing_read))}, + pandoc.Plain{pandoc.Str("stringify: " .. run(test_stringify))}, } end diff --git a/test/markdown-reader-more.native b/test/markdown-reader-more.native index 2e55dbb18..742b6187c 100644 --- a/test/markdown-reader-more.native +++ b/test/markdown-reader-more.native @@ -3,9 +3,7 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "Author",S ,Header 2 ("blank-line-before-url-in-link-reference",[],[]) [Str "Blank",Space,Str "line",Space,Str "before",Space,Str "URL",Space,Str "in",Space,Str "link",Space,Str "reference"] ,Para [Link ("",[],[]) [Str "foo"] ("/url",""),Space,Str "and",Space,Link ("",[],[]) [Str "bar"] ("/url","title")] ,Header 2 ("raw-context-environments",[],[]) [Str "Raw",Space,Str "ConTeXt",Space,Str "environments"] -,RawBlock (Format "latex") "\\placeformula " -,RawBlock (Format "context") "\\startformula\n L_{1} = L_{2}\n \\stopformula" -,RawBlock (Format "context") "\\start[a2]\n\\start[a2]\n\\stop[a2]\n\\stop[a2]" +,RawBlock (Format "context") "\\placeformula \\startformula\n L_{1} = L_{2}\n \\stopformula\n\n\\start[a2]\n\\start[a2]\n\\stop[a2]\n\\stop[a2]" ,Header 2 ("raw-latex-environments",[],[]) [Str "Raw",Space,Str "LaTeX",Space,Str "environments"] ,RawBlock (Format "latex") "\\begin{center}\n\\begin{tikzpicture}[baseline={([yshift=+-.5ex]current bounding box.center)}, level distance=24pt]\n\\Tree [.{S} [.NP John\\index{i} ] [.VP [.V likes ] [.NP himself\\index{i,*j} ]]]\n\\end{tikzpicture}\n\\end{center}" ,Header 2 ("urls-with-spaces-and-punctuation",[],[]) [Str "URLs",Space,Str "with",Space,Str "spaces",Space,Str "and",Space,Str "punctuation"] @@ -56,7 +54,6 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "Author",S ,OrderedList (3,Example,TwoParens) [[Plain [Str "Third",Space,Str "example."]]] ,Header 2 ("macros",[],[]) [Str "Macros"] -,RawBlock (Format "latex") "\\newcommand{\\tuple}[1]{\\langle #1 \\rangle}" ,Para [Math InlineMath "\\langle x,y \\rangle"] ,Header 2 ("case-insensitive-references",[],[]) [Str "Case-insensitive",Space,Str "references"] ,Para [Link ("",[],[]) [Str "Fum"] ("/fum","")] |