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 20f4835..a4087ba 100644 --- a/test/documents/rich_output.jmd +++ b/test/documents/rich_output.jmd @@ -1,23 +1,50 @@ ```julia -using DataFrames -df = DataFrame(letters = 'a':'z', numbers = 1:26) +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 -df -z = 51 -display(df) +#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 ``` ```julia; hold=true -head(df) +display(ca) +display(x) ``` -```julia; term=true -df -``` - - ```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")