From e0cd57e6a9231fe51414596fae6db1c4c57fd827 Mon Sep 17 00:00:00 2001 From: Matti Pastell Date: Wed, 3 Jan 2018 10:57:27 +0200 Subject: [PATCH 1/3] Remove DataFrames as test depency --- test/documents/rich_output.jmd | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/test/documents/rich_output.jmd b/test/documents/rich_output.jmd index 20f4835..1eb7088 100644 --- a/test/documents/rich_output.jmd +++ b/test/documents/rich_output.jmd @@ -1,23 +1,30 @@ ```julia -using DataFrames -df = DataFrame(letters = 'a':'z', numbers = 1:26) - -df -z = 51 -display(df) +import Base +function Base.show(io::IO, m::MIME"text/html", x::Array) + print(io, "") + for i in 1:size(x,1) + print(io, "") + [print(io, "") for r in x[i,:]] + print(io, "") + end + print(io, "
$r
") +end +x = [collect(1:3) collect(1:3)] +ca = collect('a':'d') +ca ``` ```julia; hold=true -head(df) +display(ca) +display(x) ``` ```julia; term=true -df +ca ``` - ```julia m = Base.Markdown.parse("**Some Markdown**") m From 65af83115259c524f40df28ce85fa056e872d0a4 Mon Sep 17 00:00:00 2001 From: Matti Pastell Date: Wed, 3 Jan 2018 11:59:43 +0200 Subject: [PATCH 2/3] New mimetype tests for output --- test/REQUIRE | 2 - .../multimedia/rich_output.github.ref | 63 +++++++++++++++ .../documents/multimedia/rich_output.html.ref | 68 ++++++++++++++++ test/documents/multimedia/rich_output.md.ref | 77 +++++++++++++++++++ test/documents/multimedia/rich_output.tex.ref | 72 +++++++++++++++++ test/documents/rich_output.jmd | 28 ++++++- test/rich_output.jl | 8 +- 7 files changed, 309 insertions(+), 9 deletions(-) create mode 100644 test/documents/multimedia/rich_output.github.ref create mode 100644 test/documents/multimedia/rich_output.html.ref create mode 100644 test/documents/multimedia/rich_output.md.ref create mode 100644 test/documents/multimedia/rich_output.tex.ref diff --git a/test/REQUIRE b/test/REQUIRE index 5fbb00b..028d44c 100644 --- a/test/REQUIRE +++ b/test/REQUIRE @@ -3,6 +3,4 @@ Cairo Fontconfig Gadfly GR -DSP Plots -DataFrames 0.10.1 0.11- diff --git a/test/documents/multimedia/rich_output.github.ref b/test/documents/multimedia/rich_output.github.ref new file mode 100644 index 0000000..20d9c81 --- /dev/null +++ b/test/documents/multimedia/rich_output.github.ref @@ -0,0 +1,63 @@ +````julia +import Base +function Base.show(io::IO, m::MIME"text/html", x::Array) + print(io, "") + for i in 1:size(x,1) + print(io, "") + [print(io, "") for r in x[i,:]] + print(io, "") + end + print(io, "
$r
") +end + +#This isn't valid latex, doesn't matter for the test +function Base.show(io::IO, m::MIME"text/latex", x::Array) + println(io, "\\begin{tabular}") + for i in 1:size(x,1) + [print(io, "$r & ") for r in x[i,:]] + print(io,"\\\\") + println(io, " \\hline") + end + print(io, "\\end{tabular") +end + +#This isn't valid markdown, doesn't matter for the test +function Base.show(io::IO, m::MIME"text/markdown", x::Array) + println(io, "-----") + for i in 1:size(x,1) + print(io, "| ") + [print(io, "$r | ") for r in x[i,:]] + println(io, "") + end + print(io, "-----") +end + + +x = [collect(1:3) collect(1:3)] +ca = collect('a':'d') +ca +```` + + + +
a
b
c
d
+ +````julia +display(ca) +display(x) +```` + + + +
a
b
c
d
+
11
22
33
+ +````julia +m = Base.Markdown.parse("**Some Markdown**") +m +```` + + + +

Some Markdown

+
diff --git a/test/documents/multimedia/rich_output.html.ref b/test/documents/multimedia/rich_output.html.ref new file mode 100644 index 0000000..19ce5b5 --- /dev/null +++ b/test/documents/multimedia/rich_output.html.ref @@ -0,0 +1,68 @@ + + +
+import Base
+function Base.show(io::IO, m::MIME"text/html", x::Array)
+    print(io, "<table>")
+    for i in 1:size(x,1)
+        print(io, "<tr>")
+        [print(io, "<td>$r</td>") for r in x[i,:]]
+        print(io, "</tr>")
+    end
+    print(io, "</table>")
+end
+
+#This isn't valid latex, doesn't matter for the test
+function Base.show(io::IO, m::MIME"text/latex", x::Array)
+    println(io, "\\begin{tabular}")
+    for i in 1:size(x,1)
+        [print(io, "$r & ") for r in x[i,:]]
+        print(io,"\\\\")
+        println(io, " \\hline")
+    end
+    print(io, "\\end{tabular")
+end
+
+#This isn't valid markdown, doesn't matter for the test
+function Base.show(io::IO, m::MIME"text/markdown", x::Array)
+    println(io, "-----")
+    for i in 1:size(x,1)
+        print(io, "| ")
+        [print(io, "$r | ") for r in x[i,:]]
+        println(io, "")
+    end
+    print(io, "-----")
+end
+
+
+x = [collect(1:3) collect(1:3)]
+ca = collect('a':'d')
+ca
+
+ + + +
a
b
c
d
+ + +
+display(ca)
+display(x)
+
+ + + +
a
b
c
d
+
11
22
33
+ + +
+m = Base.Markdown.parse("**Some Markdown**")
+m
+
+ + + +

Some Markdown

+
+ diff --git a/test/documents/multimedia/rich_output.md.ref b/test/documents/multimedia/rich_output.md.ref new file mode 100644 index 0000000..b3f2e88 --- /dev/null +++ b/test/documents/multimedia/rich_output.md.ref @@ -0,0 +1,77 @@ +~~~~{.julia} +import Base +function Base.show(io::IO, m::MIME"text/html", x::Array) + print(io, "") + for i in 1:size(x,1) + print(io, "") + [print(io, "") for r in x[i,:]] + print(io, "") + end + print(io, "
$r
") +end + +#This isn't valid latex, doesn't matter for the test +function Base.show(io::IO, m::MIME"text/latex", x::Array) + println(io, "\\begin{tabular}") + for i in 1:size(x,1) + [print(io, "$r & ") for r in x[i,:]] + print(io,"\\\\") + println(io, " \\hline") + end + print(io, "\\end{tabular") +end + +#This isn't valid markdown, doesn't matter for the test +function Base.show(io::IO, m::MIME"text/markdown", x::Array) + println(io, "-----") + for i in 1:size(x,1) + print(io, "| ") + [print(io, "$r | ") for r in x[i,:]] + println(io, "") + end + print(io, "-----") +end + + +x = [collect(1:3) collect(1:3)] +ca = collect('a':'d') +ca +~~~~~~~~~~~~~ + + + +----- +| a | +| b | +| c | +| d | +----- + +~~~~{.julia} +display(ca) +display(x) +~~~~~~~~~~~~~ + + + +----- +| a | +| b | +| c | +| d | +----- +----- +| 1 | 1 | +| 2 | 2 | +| 3 | 3 | +----- + +~~~~{.julia} +m = Base.Markdown.parse("**Some Markdown**") +m +~~~~~~~~~~~~~ + + + +**Some Markdown** + diff --git a/test/documents/multimedia/rich_output.tex.ref b/test/documents/multimedia/rich_output.tex.ref new file mode 100644 index 0000000..45c3c16 --- /dev/null +++ b/test/documents/multimedia/rich_output.tex.ref @@ -0,0 +1,72 @@ +\begin{juliacode} +import Base +function Base.show(io::IO, m::MIME"text/html", x::Array) + print(io, "") + for i in 1:size(x,1) + print(io, "") + [print(io, "") for r in x[i,:]] + print(io, "") + end + print(io, "
$r
") +end + +#This isn't valid latex, doesn't matter for the test +function Base.show(io::IO, m::MIME"text/latex", x::Array) + println(io, "\\begin{tabular}") + for i in 1:size(x,1) + [print(io, "$r & ") for r in x[i,:]] + print(io,"\\\\") + println(io, " \\hline") + end + print(io, "\\end{tabular") +end + +#This isn't valid markdown, doesn't matter for the test +function Base.show(io::IO, m::MIME"text/markdown", x::Array) + println(io, "-----") + for i in 1:size(x,1) + print(io, "| ") + [print(io, "$r | ") for r in x[i,:]] + println(io, "") + end + print(io, "-----") +end + + +x = [collect(1:3) collect(1:3)] +ca = collect('a':'d') +ca +\end{juliacode} + +\begin{tabular} +a & \\ \hline +b & \\ \hline +c & \\ \hline +d & \\ \hline +\end{tabular + +\begin{juliacode} +display(ca) +display(x) +\end{juliacode} + +\begin{tabular} +a & \\ \hline +b & \\ \hline +c & \\ \hline +d & \\ \hline +\end{tabular +\begin{tabular} +1 & 1 & \\ \hline +2 & 2 & \\ \hline +3 & 3 & \\ \hline +\end{tabular + +\begin{juliacode} +m = Base.Markdown.parse("**Some Markdown**") +m +\end{juliacode} + +\textbf{Some Markdown} + + diff --git a/test/documents/rich_output.jmd b/test/documents/rich_output.jmd index 1eb7088..a4087ba 100644 --- a/test/documents/rich_output.jmd +++ b/test/documents/rich_output.jmd @@ -11,6 +11,30 @@ function Base.show(io::IO, m::MIME"text/html", x::Array) end print(io, "") end + +#This isn't valid latex, doesn't matter for the test +function Base.show(io::IO, m::MIME"text/latex", x::Array) + println(io, "\\begin{tabular}") + for i in 1:size(x,1) + [print(io, "$r & ") for r in x[i,:]] + print(io,"\\\\") + println(io, " \\hline") + end + print(io, "\\end{tabular") +end + +#This isn't valid markdown, doesn't matter for the test +function Base.show(io::IO, m::MIME"text/markdown", x::Array) + println(io, "-----") + for i in 1:size(x,1) + print(io, "| ") + [print(io, "$r | ") for r in x[i,:]] + println(io, "") + end + print(io, "-----") +end + + x = [collect(1:3) collect(1:3)] ca = collect('a':'d') ca @@ -21,10 +45,6 @@ display(ca) display(x) ``` -```julia; term=true -ca -``` - ```julia m = Base.Markdown.parse("**Some Markdown**") m diff --git a/test/rich_output.jl b/test/rich_output.jl index 20198fb..fee965d 100644 --- a/test/rich_output.jl +++ b/test/rich_output.jl @@ -2,13 +2,15 @@ using Weave using Base.Test function mmtest(source, resfile, doctype) - VER = "$(VERSION.major).$(VERSION.minor)" - weave("documents/$source", out_path = "documents/multimedia/$resfile", doctype=doctype, plotlib=nothing) + weave("documents/$source", out_path = "documents/multimedia/$resfile", + doctype=doctype, plotlib=nothing, template = "templates/mini.tpl") result = readstring("documents/multimedia/$resfile") - ref = readstring("documents/multimedia/$VER/$resfile.ref") + ref = readstring("documents/multimedia/$resfile.ref") @test result == ref rm("documents/multimedia/$resfile") end mmtest("rich_output.jmd", "rich_output.md", "pandoc") mmtest("rich_output.jmd", "rich_output.tex", "tex") +mmtest("rich_output.jmd", "rich_output.html", "md2html") +mmtest("rich_output.jmd", "rich_output.github", "github") From 2596670aa31b51d97f6afad20cba68c18c65b58c Mon Sep 17 00:00:00 2001 From: Matti Pastell Date: Wed, 3 Jan 2018 12:34:00 +0200 Subject: [PATCH 3/3] More tests for figure format --- .../multimedia/0.5/rich_output.md.ref | 122 ------------------ .../multimedia/0.5/rich_output.tex.ref | 107 --------------- .../multimedia/0.6/rich_output.md.ref | 122 ------------------ .../multimedia/0.6/rich_output.tex.ref | 107 --------------- test/figureformatter_test.jl | 12 +- 5 files changed, 10 insertions(+), 460 deletions(-) delete mode 100644 test/documents/multimedia/0.5/rich_output.md.ref delete mode 100644 test/documents/multimedia/0.5/rich_output.tex.ref delete mode 100644 test/documents/multimedia/0.6/rich_output.md.ref delete mode 100644 test/documents/multimedia/0.6/rich_output.tex.ref diff --git a/test/documents/multimedia/0.5/rich_output.md.ref b/test/documents/multimedia/0.5/rich_output.md.ref deleted file mode 100644 index 39c58e5..0000000 --- a/test/documents/multimedia/0.5/rich_output.md.ref +++ /dev/null @@ -1,122 +0,0 @@ -~~~~{.julia} -using DataFrames -df = DataFrame(letters = 'a':'z', numbers = 1:26) - -df -~~~~~~~~~~~~~ - - -~~~~ -26×2 DataFrames.DataFrame -│ Row │ letters │ numbers │ -├─────┼─────────┼─────────┤ -│ 1 │ 'a' │ 1 │ -│ 2 │ 'b' │ 2 │ -│ 3 │ 'c' │ 3 │ -│ 4 │ 'd' │ 4 │ -│ 5 │ 'e' │ 5 │ -│ 6 │ 'f' │ 6 │ -│ 7 │ 'g' │ 7 │ -│ 8 │ 'h' │ 8 │ -⋮ -│ 18 │ 'r' │ 18 │ -│ 19 │ 's' │ 19 │ -│ 20 │ 't' │ 20 │ -│ 21 │ 'u' │ 21 │ -│ 22 │ 'v' │ 22 │ -│ 23 │ 'w' │ 23 │ -│ 24 │ 'x' │ 24 │ -│ 25 │ 'y' │ 25 │ -│ 26 │ 'z' │ 26 │ -~~~~ - - - -~~~~{.julia} -z = 51 -display(df) -~~~~~~~~~~~~~ - - -~~~~ -26×2 DataFrames.DataFrame -│ Row │ letters │ numbers │ -├─────┼─────────┼─────────┤ -│ 1 │ 'a' │ 1 │ -│ 2 │ 'b' │ 2 │ -│ 3 │ 'c' │ 3 │ -│ 4 │ 'd' │ 4 │ -│ 5 │ 'e' │ 5 │ -│ 6 │ 'f' │ 6 │ -│ 7 │ 'g' │ 7 │ -│ 8 │ 'h' │ 8 │ -⋮ -│ 18 │ 'r' │ 18 │ -│ 19 │ 's' │ 19 │ -│ 20 │ 't' │ 20 │ -│ 21 │ 'u' │ 21 │ -│ 22 │ 'v' │ 22 │ -│ 23 │ 'w' │ 23 │ -│ 24 │ 'x' │ 24 │ -│ 25 │ 'y' │ 25 │ -│ 26 │ 'z' │ 26 │ -~~~~ - - - -~~~~{.julia} -head(df) -~~~~~~~~~~~~~ - - -~~~~ -6×2 DataFrames.DataFrame -│ Row │ letters │ numbers │ -├─────┼─────────┼─────────┤ -│ 1 │ 'a' │ 1 │ -│ 2 │ 'b' │ 2 │ -│ 3 │ 'c' │ 3 │ -│ 4 │ 'd' │ 4 │ -│ 5 │ 'e' │ 5 │ -│ 6 │ 'f' │ 6 │ -~~~~ - - - -~~~~{.julia} -julia> df -26×2 DataFrames.DataFrame -│ Row │ letters │ numbers │ -├─────┼─────────┼─────────┤ -│ 1 │ 'a' │ 1 │ -│ 2 │ 'b' │ 2 │ -│ 3 │ 'c' │ 3 │ -│ 4 │ 'd' │ 4 │ -│ 5 │ 'e' │ 5 │ -│ 6 │ 'f' │ 6 │ -│ 7 │ 'g' │ 7 │ -│ 8 │ 'h' │ 8 │ -⋮ -│ 18 │ 'r' │ 18 │ -│ 19 │ 's' │ 19 │ -│ 20 │ 't' │ 20 │ -│ 21 │ 'u' │ 21 │ -│ 22 │ 'v' │ 22 │ -│ 23 │ 'w' │ 23 │ -│ 24 │ 'x' │ 24 │ -│ 25 │ 'y' │ 25 │ -│ 26 │ 'z' │ 26 │ - -~~~~~~~~~~~~~ - - - -~~~~{.julia} -m = Base.Markdown.parse("**Some Markdown**") -m -~~~~~~~~~~~~~ - - - -**Some Markdown** - diff --git a/test/documents/multimedia/0.5/rich_output.tex.ref b/test/documents/multimedia/0.5/rich_output.tex.ref deleted file mode 100644 index bf52487..0000000 --- a/test/documents/multimedia/0.5/rich_output.tex.ref +++ /dev/null @@ -1,107 +0,0 @@ -\begin{juliacode} -using DataFrames -df = DataFrame(letters = 'a':'z', numbers = 1:26) - -df -\end{juliacode} -\begin{juliaout} -26×2 DataFrames.DataFrame -│ Row │ letters │ numbers │ -├─────┼─────────┼─────────┤ -│ 1 │ 'a' │ 1 │ -│ 2 │ 'b' │ 2 │ -│ 3 │ 'c' │ 3 │ -│ 4 │ 'd' │ 4 │ -│ 5 │ 'e' │ 5 │ -│ 6 │ 'f' │ 6 │ -│ 7 │ 'g' │ 7 │ -│ 8 │ 'h' │ 8 │ -⋮ -│ 18 │ 'r' │ 18 │ -│ 19 │ 's' │ 19 │ -│ 20 │ 't' │ 20 │ -│ 21 │ 'u' │ 21 │ -│ 22 │ 'v' │ 22 │ -│ 23 │ 'w' │ 23 │ -│ 24 │ 'x' │ 24 │ -│ 25 │ 'y' │ 25 │ -│ 26 │ 'z' │ 26 │ -\end{juliaout} - -\begin{juliacode} -z = 51 -display(df) -\end{juliacode} -\begin{juliaout} -26×2 DataFrames.DataFrame -│ Row │ letters │ numbers │ -├─────┼─────────┼─────────┤ -│ 1 │ 'a' │ 1 │ -│ 2 │ 'b' │ 2 │ -│ 3 │ 'c' │ 3 │ -│ 4 │ 'd' │ 4 │ -│ 5 │ 'e' │ 5 │ -│ 6 │ 'f' │ 6 │ -│ 7 │ 'g' │ 7 │ -│ 8 │ 'h' │ 8 │ -⋮ -│ 18 │ 'r' │ 18 │ -│ 19 │ 's' │ 19 │ -│ 20 │ 't' │ 20 │ -│ 21 │ 'u' │ 21 │ -│ 22 │ 'v' │ 22 │ -│ 23 │ 'w' │ 23 │ -│ 24 │ 'x' │ 24 │ -│ 25 │ 'y' │ 25 │ -│ 26 │ 'z' │ 26 │ -\end{juliaout} - -\begin{juliacode} -head(df) -\end{juliacode} -\begin{juliaout} -6×2 DataFrames.DataFrame -│ Row │ letters │ numbers │ -├─────┼─────────┼─────────┤ -│ 1 │ 'a' │ 1 │ -│ 2 │ 'b' │ 2 │ -│ 3 │ 'c' │ 3 │ -│ 4 │ 'd' │ 4 │ -│ 5 │ 'e' │ 5 │ -│ 6 │ 'f' │ 6 │ -\end{juliaout} - -\begin{juliaterm} -julia> df -26×2 DataFrames.DataFrame -│ Row │ letters │ numbers │ -├─────┼─────────┼─────────┤ -│ 1 │ 'a' │ 1 │ -│ 2 │ 'b' │ 2 │ -│ 3 │ 'c' │ 3 │ -│ 4 │ 'd' │ 4 │ -│ 5 │ 'e' │ 5 │ -│ 6 │ 'f' │ 6 │ -│ 7 │ 'g' │ 7 │ -│ 8 │ 'h' │ 8 │ -⋮ -│ 18 │ 'r' │ 18 │ -│ 19 │ 's' │ 19 │ -│ 20 │ 't' │ 20 │ -│ 21 │ 'u' │ 21 │ -│ 22 │ 'v' │ 22 │ -│ 23 │ 'w' │ 23 │ -│ 24 │ 'x' │ 24 │ -│ 25 │ 'y' │ 25 │ -│ 26 │ 'z' │ 26 │ - -\end{juliaterm} - -\begin{juliacode} -m = Base.Markdown.parse("**Some Markdown**") -m -\end{juliacode} - - -\textbf{Some Markdown} - diff --git a/test/documents/multimedia/0.6/rich_output.md.ref b/test/documents/multimedia/0.6/rich_output.md.ref deleted file mode 100644 index 39c58e5..0000000 --- a/test/documents/multimedia/0.6/rich_output.md.ref +++ /dev/null @@ -1,122 +0,0 @@ -~~~~{.julia} -using DataFrames -df = DataFrame(letters = 'a':'z', numbers = 1:26) - -df -~~~~~~~~~~~~~ - - -~~~~ -26×2 DataFrames.DataFrame -│ Row │ letters │ numbers │ -├─────┼─────────┼─────────┤ -│ 1 │ 'a' │ 1 │ -│ 2 │ 'b' │ 2 │ -│ 3 │ 'c' │ 3 │ -│ 4 │ 'd' │ 4 │ -│ 5 │ 'e' │ 5 │ -│ 6 │ 'f' │ 6 │ -│ 7 │ 'g' │ 7 │ -│ 8 │ 'h' │ 8 │ -⋮ -│ 18 │ 'r' │ 18 │ -│ 19 │ 's' │ 19 │ -│ 20 │ 't' │ 20 │ -│ 21 │ 'u' │ 21 │ -│ 22 │ 'v' │ 22 │ -│ 23 │ 'w' │ 23 │ -│ 24 │ 'x' │ 24 │ -│ 25 │ 'y' │ 25 │ -│ 26 │ 'z' │ 26 │ -~~~~ - - - -~~~~{.julia} -z = 51 -display(df) -~~~~~~~~~~~~~ - - -~~~~ -26×2 DataFrames.DataFrame -│ Row │ letters │ numbers │ -├─────┼─────────┼─────────┤ -│ 1 │ 'a' │ 1 │ -│ 2 │ 'b' │ 2 │ -│ 3 │ 'c' │ 3 │ -│ 4 │ 'd' │ 4 │ -│ 5 │ 'e' │ 5 │ -│ 6 │ 'f' │ 6 │ -│ 7 │ 'g' │ 7 │ -│ 8 │ 'h' │ 8 │ -⋮ -│ 18 │ 'r' │ 18 │ -│ 19 │ 's' │ 19 │ -│ 20 │ 't' │ 20 │ -│ 21 │ 'u' │ 21 │ -│ 22 │ 'v' │ 22 │ -│ 23 │ 'w' │ 23 │ -│ 24 │ 'x' │ 24 │ -│ 25 │ 'y' │ 25 │ -│ 26 │ 'z' │ 26 │ -~~~~ - - - -~~~~{.julia} -head(df) -~~~~~~~~~~~~~ - - -~~~~ -6×2 DataFrames.DataFrame -│ Row │ letters │ numbers │ -├─────┼─────────┼─────────┤ -│ 1 │ 'a' │ 1 │ -│ 2 │ 'b' │ 2 │ -│ 3 │ 'c' │ 3 │ -│ 4 │ 'd' │ 4 │ -│ 5 │ 'e' │ 5 │ -│ 6 │ 'f' │ 6 │ -~~~~ - - - -~~~~{.julia} -julia> df -26×2 DataFrames.DataFrame -│ Row │ letters │ numbers │ -├─────┼─────────┼─────────┤ -│ 1 │ 'a' │ 1 │ -│ 2 │ 'b' │ 2 │ -│ 3 │ 'c' │ 3 │ -│ 4 │ 'd' │ 4 │ -│ 5 │ 'e' │ 5 │ -│ 6 │ 'f' │ 6 │ -│ 7 │ 'g' │ 7 │ -│ 8 │ 'h' │ 8 │ -⋮ -│ 18 │ 'r' │ 18 │ -│ 19 │ 's' │ 19 │ -│ 20 │ 't' │ 20 │ -│ 21 │ 'u' │ 21 │ -│ 22 │ 'v' │ 22 │ -│ 23 │ 'w' │ 23 │ -│ 24 │ 'x' │ 24 │ -│ 25 │ 'y' │ 25 │ -│ 26 │ 'z' │ 26 │ - -~~~~~~~~~~~~~ - - - -~~~~{.julia} -m = Base.Markdown.parse("**Some Markdown**") -m -~~~~~~~~~~~~~ - - - -**Some Markdown** - diff --git a/test/documents/multimedia/0.6/rich_output.tex.ref b/test/documents/multimedia/0.6/rich_output.tex.ref deleted file mode 100644 index a4d9993..0000000 --- a/test/documents/multimedia/0.6/rich_output.tex.ref +++ /dev/null @@ -1,107 +0,0 @@ -\begin{juliacode} -using DataFrames -df = DataFrame(letters = 'a':'z', numbers = 1:26) - -df -\end{juliacode} -\begin{juliaout} -26×2 DataFrames.DataFrame -│ Row │ letters │ numbers │ -├─────┼─────────┼─────────┤ -│ 1 │ 'a' │ 1 │ -│ 2 │ 'b' │ 2 │ -│ 3 │ 'c' │ 3 │ -│ 4 │ 'd' │ 4 │ -│ 5 │ 'e' │ 5 │ -│ 6 │ 'f' │ 6 │ -│ 7 │ 'g' │ 7 │ -│ 8 │ 'h' │ 8 │ -⋮ -│ 18 │ 'r' │ 18 │ -│ 19 │ 's' │ 19 │ -│ 20 │ 't' │ 20 │ -│ 21 │ 'u' │ 21 │ -│ 22 │ 'v' │ 22 │ -│ 23 │ 'w' │ 23 │ -│ 24 │ 'x' │ 24 │ -│ 25 │ 'y' │ 25 │ -│ 26 │ 'z' │ 26 │ -\end{juliaout} - -\begin{juliacode} -z = 51 -display(df) -\end{juliacode} -\begin{juliaout} -26×2 DataFrames.DataFrame -│ Row │ letters │ numbers │ -├─────┼─────────┼─────────┤ -│ 1 │ 'a' │ 1 │ -│ 2 │ 'b' │ 2 │ -│ 3 │ 'c' │ 3 │ -│ 4 │ 'd' │ 4 │ -│ 5 │ 'e' │ 5 │ -│ 6 │ 'f' │ 6 │ -│ 7 │ 'g' │ 7 │ -│ 8 │ 'h' │ 8 │ -⋮ -│ 18 │ 'r' │ 18 │ -│ 19 │ 's' │ 19 │ -│ 20 │ 't' │ 20 │ -│ 21 │ 'u' │ 21 │ -│ 22 │ 'v' │ 22 │ -│ 23 │ 'w' │ 23 │ -│ 24 │ 'x' │ 24 │ -│ 25 │ 'y' │ 25 │ -│ 26 │ 'z' │ 26 │ -\end{juliaout} - -\begin{juliacode} -head(df) -\end{juliacode} -\begin{juliaout} -6×2 DataFrames.DataFrame -│ Row │ letters │ numbers │ -├─────┼─────────┼─────────┤ -│ 1 │ 'a' │ 1 │ -│ 2 │ 'b' │ 2 │ -│ 3 │ 'c' │ 3 │ -│ 4 │ 'd' │ 4 │ -│ 5 │ 'e' │ 5 │ -│ 6 │ 'f' │ 6 │ -\end{juliaout} - -\begin{juliaterm} -julia> df -26×2 DataFrames.DataFrame -│ Row │ letters │ numbers │ -├─────┼─────────┼─────────┤ -│ 1 │ 'a' │ 1 │ -│ 2 │ 'b' │ 2 │ -│ 3 │ 'c' │ 3 │ -│ 4 │ 'd' │ 4 │ -│ 5 │ 'e' │ 5 │ -│ 6 │ 'f' │ 6 │ -│ 7 │ 'g' │ 7 │ -│ 8 │ 'h' │ 8 │ -⋮ -│ 18 │ 'r' │ 18 │ -│ 19 │ 's' │ 19 │ -│ 20 │ 't' │ 20 │ -│ 21 │ 'u' │ 21 │ -│ 22 │ 'v' │ 22 │ -│ 23 │ 'w' │ 23 │ -│ 24 │ 'x' │ 24 │ -│ 25 │ 'y' │ 25 │ -│ 26 │ 'z' │ 26 │ - -\end{juliaterm} - -\begin{juliacode} -m = Base.Markdown.parse("**Some Markdown**") -m -\end{juliacode} - -\textbf{Some Markdown} - - diff --git a/test/figureformatter_test.jl b/test/figureformatter_test.jl index 56dc948..e0a9287 100644 --- a/test/figureformatter_test.jl +++ b/test/figureformatter_test.jl @@ -1,4 +1,5 @@ using Weave +using Base.Test # Make a dummy codehunk with figure chunk = Weave.CodeChunk("plot(x)", 1, 1, "", Dict()) @@ -18,6 +19,13 @@ chunk.figures = ["figs/figures_plot1.png"] @test Weave.formatfigures(chunk, Weave.rst) == ".. image:: figs/figures_plot1.png\n :width: nothing\n\n" @test Weave.formatfigures(chunk, Weave.md2html) == "\n" - - +chunk.options[:fig_cap] = "Nice plot" +chunk.options[:out_width] = "100%" +@test Weave.formatfigures(chunk, Weave.tex) == "\\begin{figure}[!h]\n\\center\n\\includegraphics[width=100%]{figs/figures_plot1.png}\n\\caption{Nice plot}\n\\end{figure}\n" +@test Weave.formatfigures(chunk, Weave.pandoc) == "![Nice plot](figs/figures_plot1.png){width=100%}\n" +@test Weave.formatfigures(chunk, Weave.md2tex) == "\\begin{figure}[!h]\n\\center\n\\includegraphics[width=100%]{figs/figures_plot1.png}\n\\caption{Nice plot}\n\\end{figure}\n" +@test Weave.formatfigures(chunk, Weave.md2html) == "
\n\n
Nice plot
\n
\n" +@test Weave.formatfigures(chunk, Weave.rst) == ".. figure:: figs/figures_plot1.png\n :width: 100%\n\n Nice plot\n\n" +@test Weave.formatfigures(chunk, Weave.multimarkdown) == "![Nice plot][figs/figures_plot1.png]\n\n[figs/figures_plot1.png]: figs/figures_plot1.png width=100%\n" +@test Weave.formatfigures(chunk, Weave.adoc) == "image::figs/figures_plot1.png[width=100%,title=\"Nice plot\"]"