mirror of https://github.com/mpastell/Weave.jl
Merge branch 'fixterm'. Fixes term=true formatting
commit
f39069e40a
|
@ -45,7 +45,7 @@ type CodeChunk <: WeaveChunk
|
|||
figures::Array{AbstractString}
|
||||
result::Array{ChunkOutput}
|
||||
function CodeChunk(content, number, start_line, optionstring, options)
|
||||
new(rstrip(content), number, 0, start_line, optionstring, options, "","", AbstractString[], ChunkOutput[])
|
||||
new(rstrip(content) * "\n", number, 0, start_line, optionstring, options, "","", AbstractString[], ChunkOutput[])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ end
|
|||
#Text is written to stdout, called from "term" mode chunks
|
||||
function Base.display(report::Report, m::MIME"text/plain", data)
|
||||
s = reprmime(m, data)
|
||||
print("\n" * s)
|
||||
println(s)
|
||||
end
|
||||
|
||||
#Catch "rich_output"
|
||||
|
|
|
@ -182,7 +182,7 @@ function format_chunk(chunk::CodeChunk, formatdict, docformat)
|
|||
|
||||
if !chunk.options[:eval]
|
||||
if chunk.options[:echo]
|
||||
result = "$(formatdict[:codestart])$(chunk.content)\n$(formatdict[:codeend])"
|
||||
result = "$(formatdict[:codestart])\n$(chunk.content)$(formatdict[:codeend])"
|
||||
return result
|
||||
else
|
||||
r = ""
|
||||
|
@ -196,7 +196,7 @@ function format_chunk(chunk::CodeChunk, formatdict, docformat)
|
|||
|
||||
if chunk.options[:echo]
|
||||
#Convert to output format and highlight (html, tex...) if needed
|
||||
result = "$(formatdict[:codestart])$(chunk.content)\n$(formatdict[:codeend])\n"
|
||||
result = "$(formatdict[:codestart])$(chunk.content)$(formatdict[:codeend])\n"
|
||||
else
|
||||
result = ""
|
||||
end
|
||||
|
|
|
@ -129,8 +129,6 @@ function parse_doc(document::AbstractString, format::MarkupInput)
|
|||
end
|
||||
if ismatch(codeend, line) && state=="code"
|
||||
|
||||
|
||||
|
||||
chunk = CodeChunk(content, codeno, start_line, optionString, options)
|
||||
|
||||
codeno+=1
|
||||
|
@ -142,7 +140,7 @@ function parse_doc(document::AbstractString, format::MarkupInput)
|
|||
end
|
||||
|
||||
if lineno == 1
|
||||
content *= line
|
||||
content *= line
|
||||
else
|
||||
content *= "\n" * line
|
||||
end
|
||||
|
@ -310,6 +308,6 @@ function parse_inline(text::AbstractString, inline_ex::Regex)
|
|||
codeno += 1
|
||||
end
|
||||
push!(res, InlineText(text[e:end], e, length(text), textno))
|
||||
|
||||
|
||||
return res
|
||||
end
|
||||
end
|
||||
|
|
|
@ -115,7 +115,7 @@ function convert_doc(doc::WeaveDoc, format::MarkdownOutput)
|
|||
output *= "\n" * "```julia"
|
||||
isempty(chunk.optionstring) || (output *= ";" * chunk.optionstring)
|
||||
output *= "\n" * lstrip(chunk.content)
|
||||
output *= "\n```\n"
|
||||
output *= "```\n"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -133,7 +133,7 @@ function convert_doc(doc::WeaveDoc, format::NowebOutput)
|
|||
isempty(chunk.optionstring) || (output *= strip(chunk.optionstring))
|
||||
output *= ">>="
|
||||
output *= "\n" * lstrip(chunk.content)
|
||||
output *= "\n@\n"
|
||||
output *= "@\n"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -151,7 +151,7 @@ function convert_doc(doc::WeaveDoc, format::ScriptOutput)
|
|||
output *= "\n#+ "
|
||||
isempty(chunk.optionstring) || (output *= strip(chunk.optionstring))
|
||||
output *= "\n\n" * lstrip(chunk.content)
|
||||
output *= "\n\n"
|
||||
output *= "\n"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -164,4 +164,4 @@ end
|
|||
|
||||
function Base.repr(c::InlineCode)
|
||||
return "`j $(c.content)`"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -89,6 +89,7 @@ The next code chunk is executed in term mode, see the [script](FIR_design.jl) fo
|
|||
~~~~{.julia}
|
||||
julia> plot(y = h_db, x = ws, Geom.line,
|
||||
Guide.xlabel("Frequency (Hz)"), Guide.ylabel("Magnitude (db)"))
|
||||
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
|
|
|
@ -3,6 +3,12 @@
|
|||
y= [2, 5, 12]
|
||||
@
|
||||
|
||||
<<term=true>>=
|
||||
x = 1:10
|
||||
d = Dict("Weave" => "testing")
|
||||
y = [2, 4 ,8]
|
||||
@
|
||||
|
||||
<<>>=
|
||||
x = [12, 10]
|
||||
println(y)
|
||||
|
|
|
@ -4,6 +4,25 @@ julia> y= [2, 5, 12]
|
|||
2
|
||||
5
|
||||
12
|
||||
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
|
||||
~~~~{.julia}
|
||||
julia> x = 1:10
|
||||
1:10
|
||||
|
||||
julia> d = Dict("Weave" => "testing")
|
||||
Dict{String,String} with 1 entry:
|
||||
"Weave" => "testing"
|
||||
|
||||
julia> y = [2, 4 ,8]
|
||||
3-element Array{Int64,1}:
|
||||
2
|
||||
4
|
||||
8
|
||||
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
|
@ -15,7 +34,7 @@ println(y)
|
|||
|
||||
|
||||
~~~~
|
||||
[2,5,12]
|
||||
[2,4,8]
|
||||
~~~~
|
||||
|
||||
|
||||
|
@ -44,6 +63,7 @@ Results without code
|
|||
|
||||
|
||||
~~~~{.julia}
|
||||
|
||||
y = randn(5)
|
||||
println("Don't eval, but show code")
|
||||
~~~~~~~~~~~~~
|
||||
|
|
|
@ -9,6 +9,15 @@
|
|||
"metadata": {},
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"outputs": [],
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"x = 1:10\nd = Dict(\"Weave\" => \"testing\")\ny = [2, 4 ,8]"
|
||||
],
|
||||
"metadata": {},
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"outputs": [],
|
||||
"cell_type": "code",
|
||||
|
|
|
@ -4,6 +4,13 @@
|
|||
y= [2, 5, 12]
|
||||
|
||||
|
||||
#+ term=true
|
||||
|
||||
x = 1:10
|
||||
d = Dict("Weave" => "testing")
|
||||
y = [2, 4 ,8]
|
||||
|
||||
|
||||
#+
|
||||
|
||||
x = [12, 10]
|
||||
|
|
|
@ -3,6 +3,12 @@
|
|||
y= [2, 5, 12]
|
||||
```
|
||||
|
||||
```julia;term=true
|
||||
x = 1:10
|
||||
d = Dict("Weave" => "testing")
|
||||
y = [2, 4 ,8]
|
||||
```
|
||||
|
||||
```julia
|
||||
x = [12, 10]
|
||||
println(y)
|
||||
|
|
|
@ -3,6 +3,12 @@
|
|||
y= [2, 5, 12]
|
||||
@
|
||||
|
||||
<<term=true>>=
|
||||
x = 1:10
|
||||
d = Dict("Weave" => "testing")
|
||||
y = [2, 4 ,8]
|
||||
@
|
||||
|
||||
<<>>=
|
||||
x = [12, 10]
|
||||
println(y)
|
||||
|
|
|
@ -13,9 +13,9 @@ plot(x=x, y = sin(x), Geom.line)
|
|||
|
||||
````julia
|
||||
julia> x = linspace(0, 2π, 200)
|
||||
|
||||
200-element LinSpace{Float64}:
|
||||
0.0,0.0315738,0.0631476,0.0947214,0.126295,…,6.18846,6.22004,6.25161,6.28319
|
||||
|
||||
julia> plot(x=x, y = sin(x), Geom.line)
|
||||
|
||||
````
|
||||
|
@ -25,9 +25,10 @@ julia> plot(x=x, y = sin(x), Geom.line)
|
|||
|
||||
````julia
|
||||
julia> y = 20
|
||||
|
||||
20
|
||||
|
||||
julia> plot(x=x, y = cos(x), Geom.line)
|
||||
|
||||
````
|
||||
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@ plot(x=x, y = sin(x), Geom.line)
|
|||
|
||||
````julia
|
||||
julia> x = linspace(0, 2π, 200)
|
||||
|
||||
200-element LinSpace{Float64}:
|
||||
0.0,0.0315738,0.0631476,0.0947214,0.126295,…,6.18846,6.22004,6.25161,6.28319
|
||||
|
||||
julia> plot(x=x, y = sin(x), Geom.line)
|
||||
|
||||
````
|
||||
|
@ -33,9 +33,10 @@ julia> plot(x=x, y = sin(x), Geom.line)
|
|||
|
||||
````julia
|
||||
julia> y = 20
|
||||
|
||||
20
|
||||
|
||||
julia> plot(x=x, y = cos(x), Geom.line)
|
||||
|
||||
````
|
||||
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@ plot(x=x, y = sin(x), Geom.line)
|
|||
|
||||
~~~~{.julia}
|
||||
julia> x = linspace(0, 2π, 200)
|
||||
|
||||
200-element LinSpace{Float64}:
|
||||
0.0,0.0315738,0.0631476,0.0947214,0.126295,…,6.18846,6.22004,6.25161,6.28319
|
||||
|
||||
julia> plot(x=x, y = sin(x), Geom.line)
|
||||
|
||||
~~~~~~~~~~~~~
|
||||
|
@ -27,9 +27,10 @@ julia> plot(x=x, y = sin(x), Geom.line)
|
|||
|
||||
~~~~{.julia}
|
||||
julia> y = 20
|
||||
|
||||
20
|
||||
|
||||
julia> plot(x=x, y = cos(x), Geom.line)
|
||||
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@ plot(x=x, y = sin(x), Geom.line)
|
|||
|
||||
\begin{juliaterm}
|
||||
julia> x = linspace(0, 2π, 200)
|
||||
|
||||
200-element LinSpace{Float64}:
|
||||
0.0,0.0315738,0.0631476,0.0947214,0.126295,…,6.18846,6.22004,6.25161,6.28319
|
||||
|
||||
julia> plot(x=x, y = sin(x), Geom.line)
|
||||
|
||||
\end{juliaterm}
|
||||
|
@ -30,9 +30,10 @@ julia> plot(x=x, y = sin(x), Geom.line)
|
|||
|
||||
\begin{juliaterm}
|
||||
julia> y = 20
|
||||
|
||||
20
|
||||
|
||||
julia> plot(x=x, y = cos(x), Geom.line)
|
||||
|
||||
\end{juliaterm}
|
||||
\includegraphics[width=\linewidth]{figures/gadfly_formats_test_4_2.ps}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
using Gadfly
|
||||
x = linspace(0, 2π, 200)
|
||||
plot(x=x, y = sin(x), Geom.line)
|
||||
|
||||
|
||||
|
||||
|
||||
.. figure:: figures/gadfly_formats_test_sin_fun_1.png
|
||||
|
@ -25,9 +25,9 @@
|
|||
.. code-block:: julia
|
||||
|
||||
julia> x = linspace(0, 2π, 200)
|
||||
|
||||
200-element LinSpace{Float64}:
|
||||
0.0,0.0315738,0.0631476,0.0947214,0.126295,…,6.18846,6.22004,6.25161,6.28319
|
||||
|
||||
julia> plot(x=x, y = sin(x), Geom.line)
|
||||
|
||||
|
||||
|
@ -40,12 +40,13 @@ julia> plot(x=x, y = sin(x), Geom.line)
|
|||
.. code-block:: julia
|
||||
|
||||
julia> y = 20
|
||||
|
||||
20
|
||||
|
||||
julia> plot(x=x, y = cos(x), Geom.line)
|
||||
|
||||
|
||||
|
||||
|
||||
.. image:: figures/gadfly_formats_test_4_2.png
|
||||
:width: 15 cm
|
||||
|
||||
|
@ -54,7 +55,7 @@ julia> plot(x=x, y = cos(x), Geom.line)
|
|||
|
||||
x = linspace(0, 2π, 200)
|
||||
plot(x=x, y = sin(x), Geom.line)
|
||||
|
||||
|
||||
|
||||
|
||||
.. image:: figures/gadfly_formats_test_5_1.png
|
||||
|
@ -65,7 +66,7 @@ julia> plot(x=x, y = cos(x), Geom.line)
|
|||
|
||||
y = 20
|
||||
plot(x=x, y = cos(x), Geom.line)
|
||||
|
||||
|
||||
|
||||
|
||||
.. image:: figures/gadfly_formats_test_5_2.png
|
||||
|
|
|
@ -20,9 +20,9 @@ plot(x=x, y = sin(x), Geom.line)
|
|||
|
||||
\begin{juliaterm}
|
||||
julia> x = linspace(0, 2π, 200)
|
||||
|
||||
200-element LinSpace{Float64}:
|
||||
0.0,0.0315738,0.0631476,0.0947214,0.126295,…,6.18846,6.22004,6.25161,6.28319
|
||||
|
||||
julia> plot(x=x, y = sin(x), Geom.line)
|
||||
|
||||
\end{juliaterm}
|
||||
|
@ -30,9 +30,10 @@ julia> plot(x=x, y = sin(x), Geom.line)
|
|||
|
||||
\begin{juliaterm}
|
||||
julia> y = 20
|
||||
|
||||
20
|
||||
|
||||
julia> plot(x=x, y = cos(x), Geom.line)
|
||||
|
||||
\end{juliaterm}
|
||||
\includegraphics[width=\linewidth]{figures/gadfly_formats_test_4_2.pdf}
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@ plot(x=x, y = sin(x), Geom.line)
|
|||
|
||||
~~~~{.julia}
|
||||
julia> x = linspace(0, 2π, 200)
|
||||
|
||||
200-element LinSpace{Float64}:
|
||||
0.0,0.0315738,0.0631476,0.0947214,0.126295,…,6.18846,6.22004,6.25161,6.28319
|
||||
|
||||
julia> plot(x=x, y = sin(x), Geom.line)
|
||||
|
||||
~~~~~~~~~~~~~
|
||||
|
@ -27,9 +27,10 @@ julia> plot(x=x, y = sin(x), Geom.line)
|
|||
|
||||
~~~~{.julia}
|
||||
julia> y = 20
|
||||
|
||||
20
|
||||
|
||||
julia> plot(x=x, y = cos(x), Geom.line)
|
||||
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@ plot(x=x, y = sin(x), Geom.line)
|
|||
|
||||
\begin{juliaterm}
|
||||
julia> x = linspace(0, 2π, 200)
|
||||
|
||||
200-element LinSpace{Float64}:
|
||||
0.0,0.0315738,0.0631476,0.0947214,0.126295,…,6.18846,6.22004,6.25161,6.28319
|
||||
|
||||
julia> plot(x=x, y = sin(x), Geom.line)
|
||||
|
||||
\end{juliaterm}
|
||||
|
@ -30,9 +30,10 @@ julia> plot(x=x, y = sin(x), Geom.line)
|
|||
|
||||
\begin{juliaterm}
|
||||
julia> y = 20
|
||||
|
||||
20
|
||||
|
||||
julia> plot(x=x, y = cos(x), Geom.line)
|
||||
|
||||
\end{juliaterm}
|
||||
\resizebox{\linewidth}{!}{\input{figures/gadfly_formats_test_4_2.tex}}
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
julia> using Gadfly
|
||||
|
||||
julia> x = linspace(0, 2π, 200)
|
||||
|
||||
200-element LinSpace{Float64}:
|
||||
0.0,0.0315738,0.0631476,0.0947214,0.126295,…,6.18846,6.22004,6.25161,6.28319
|
||||
|
||||
julia> plot(x=x, y = sin(x), Geom.line)
|
||||
|
||||
````
|
||||
|
@ -17,9 +17,10 @@ julia> plot(x=x, y = sin(x), Geom.line)
|
|||
|
||||
````julia
|
||||
julia> y = 20
|
||||
|
||||
20
|
||||
|
||||
julia> plot(x=x, y = cos(x), Geom.line)
|
||||
|
||||
````
|
||||
|
||||
|
||||
|
@ -41,9 +42,9 @@ linspace(0.0,200.0,50)
|
|||
julia> using Gadfly
|
||||
|
||||
julia> x = linspace(0, 2π, 200)
|
||||
|
||||
200-element LinSpace{Float64}:
|
||||
0.0,0.0315738,0.0631476,0.0947214,0.126295,…,6.18846,6.22004,6.25161,6.28319
|
||||
|
||||
julia> plot(x=x, y = sin(x), Geom.line)
|
||||
|
||||
````
|
||||
|
@ -53,9 +54,10 @@ julia> plot(x=x, y = sin(x), Geom.line)
|
|||
|
||||
````julia
|
||||
julia> y = 20
|
||||
|
||||
20
|
||||
|
||||
julia> plot(x=x, y = cos(x), Geom.line)
|
||||
|
||||
````
|
||||
|
||||
|
||||
|
|
|
@ -106,6 +106,7 @@ julia> df
|
|||
│ 24 │ 'x' │ 24 │
|
||||
│ 25 │ 'y' │ 25 │
|
||||
│ 26 │ 'z' │ 26 │
|
||||
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
|
|
|
@ -94,6 +94,7 @@ julia> df
|
|||
│ 24 │ 'x' │ 24 │
|
||||
│ 25 │ 'y' │ 25 │
|
||||
│ 26 │ 'z' │ 26 │
|
||||
|
||||
\end{juliaterm}
|
||||
|
||||
\begin{juliacode}
|
||||
|
|
|
@ -13,9 +13,9 @@ image::figures/gadfly_formats_test_cos2_fun_1.png[width=600]
|
|||
[source,julia]
|
||||
--------------------------------------
|
||||
julia> x = linspace(0, 2π, 200)
|
||||
|
||||
200-element LinSpace{Float64}:
|
||||
0.0,0.0315738,0.0631476,0.0947214,0.126295,…,6.18846,6.22004,6.25161,6.28319
|
||||
|
||||
julia> plot(x=x, y = sin(x), Geom.line)
|
||||
|
||||
--------------------------------------
|
||||
|
@ -26,9 +26,10 @@ image::figures/gadfly_formats_test_4_1.png[width=600]
|
|||
[source,julia]
|
||||
--------------------------------------
|
||||
julia> y = 20
|
||||
|
||||
20
|
||||
|
||||
julia> plot(x=x, y = cos(x), Geom.line)
|
||||
|
||||
--------------------------------------
|
||||
|
||||
|
||||
|
|
|
@ -17,17 +17,14 @@ p = plot(x, sin(x), size =(900,300))
|
|||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
![](figures/plotsjl_test_1_1.png)\
|
||||
|
||||
|
||||
~~~~{.julia}
|
||||
julia> plot(x, sin(x))
|
||||
|
||||
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
![](figures/plotsjl_test_2_1.png)\
|
||||
|
||||
![](figures/plotsjl_test_2_1.png)\
|
||||
|
||||
|
||||
|
@ -37,8 +34,6 @@ scatter!(rand(100),markersize=6,c=:orange)
|
|||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
![](figures/plotsjl_test_3_1.png)\
|
||||
|
||||
![](figures/plotsjl_test_3_1.png)\
|
||||
|
||||
|
||||
|
@ -55,13 +50,11 @@ julia> plot(rand(100) / 3,reg=true,fill=(0,:green))
|
|||
~~~~{.julia}
|
||||
julia> scatter!(rand(100),markersize=6,c=:orange)
|
||||
|
||||
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
![](figures/plotsjl_test_4_2.png)\
|
||||
|
||||
![](figures/plotsjl_test_4_1.png)\
|
||||
|
||||
|
||||
![A random walk.](figures/plotsjl_test_random_1.png)
|
||||
![](figures/plotsjl_test_random_1.png)
|
||||
|
|
|
@ -15,6 +15,7 @@ p = plot(x, sin(x), size =(900,300))
|
|||
\begin{juliaterm}
|
||||
julia> plot(x, sin(x))
|
||||
|
||||
|
||||
\end{juliaterm}
|
||||
\includegraphics[width=\linewidth]{figures/plotsjl_test_2_1.pdf}
|
||||
|
||||
|
@ -34,6 +35,7 @@ julia> plot(rand(100) / 3,reg=true,fill=(0,:green))
|
|||
\begin{juliaterm}
|
||||
julia> scatter!(rand(100),markersize=6,c=:orange)
|
||||
|
||||
|
||||
\end{juliaterm}
|
||||
\includegraphics[width=\linewidth]{figures/plotsjl_test_4_2.pdf}
|
||||
|
||||
|
|
|
@ -21,11 +21,10 @@ p = plot(x, sin(x), size =(900,300))
|
|||
~~~~{.julia}
|
||||
julia> plot(x, sin(x))
|
||||
|
||||
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
![](figures/plotsjl_test_gr_2_1.png)\
|
||||
|
||||
|
||||
~~~~{.julia}
|
||||
plot(rand(100) / 3,reg=true,fill=(0,:green))
|
||||
|
@ -33,26 +32,15 @@ scatter!(rand(100),markersize=6,c=:orange)
|
|||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
![](figures/plotsjl_test_gr_3_1.png)\
|
||||
|
||||
|
||||
~~~~{.julia}
|
||||
julia> plot(rand(100) / 3,reg=true,fill=(0,:green))
|
||||
|
||||
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
![](figures/plotsjl_test_gr_4_1.png)\
|
||||
|
||||
|
||||
~~~~{.julia}
|
||||
julia> scatter!(rand(100),markersize=6,c=:orange)
|
||||
|
||||
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
![](figures/plotsjl_test_gr_4_2.png)\
|
||||
|
||||
|
||||
![A random walk.](figures/plotsjl_test_gr_random_1.png)
|
||||
|
|
|
@ -7,7 +7,7 @@ plot(x, sin(x))
|
|||
|
||||
````
|
||||
1-element Array{Any,1}:
|
||||
PyObject <matplotlib.lines.Line2D object at 0x7fe35ad5f208>
|
||||
PyObject <matplotlib.lines.Line2D object at 0x7fbd590d7860>
|
||||
````
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@ plot(x, sin(x))
|
|||
|
||||
````
|
||||
1-element Array{Any,1}:
|
||||
PyObject <matplotlib.lines.Line2D object at 0x7fe35ae08e48>
|
||||
PyObject <matplotlib.lines.Line2D object at 0x7fbd60094160>
|
||||
````
|
||||
|
||||
|
||||
|
@ -23,7 +23,7 @@ plot(x, sin(x))
|
|||
|
||||
````
|
||||
1-element Array{Any,1}:
|
||||
PyObject <matplotlib.lines.Line2D object at 0x7fe35e9a7518>
|
||||
PyObject <matplotlib.lines.Line2D object at 0x7fbd5905c7b8>
|
||||
````
|
||||
|
||||
|
||||
|
@ -31,19 +31,20 @@ plot(x, sin(x))
|
|||
|
||||
````julia
|
||||
julia> x = linspace(0, 2π, 200)
|
||||
|
||||
200-element LinSpace{Float64}:
|
||||
0.0,0.0315738,0.0631476,0.0947214,0.126295,…,6.18846,6.22004,6.25161,6.28319
|
||||
|
||||
julia> plot(x, sin(x))
|
||||
|
||||
1-element Array{Any,1}:
|
||||
PyObject <matplotlib.lines.Line2D object at 0x7fe35adcce80>
|
||||
julia> y = 20
|
||||
PyObject <matplotlib.lines.Line2D object at 0x7fbd60047fd0>
|
||||
|
||||
julia> y = 20
|
||||
20
|
||||
|
||||
julia> plot(x, cos(x))
|
||||
1-element Array{Any,1}:
|
||||
PyObject <matplotlib.lines.Line2D object at 0x7fe35adcd898>
|
||||
PyObject <matplotlib.lines.Line2D object at 0x7fbd6004eeb8>
|
||||
|
||||
````
|
||||
|
||||
|
||||
|
@ -56,7 +57,7 @@ contourf(x)
|
|||
|
||||
|
||||
````
|
||||
PyObject <matplotlib.contour.QuadContourSet object at 0x7fe35ac04898>
|
||||
PyObject <matplotlib.contour.QuadContourSet object at 0x7fbd5a506128>
|
||||
````
|
||||
|
||||
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
using PyPlot
|
||||
x = linspace(0, 2π, 200)
|
||||
plot(x, sin(x))
|
||||
|
||||
|
||||
|
||||
|
||||
::
|
||||
|
||||
1-element Array{Any,1}:
|
||||
PyObject <matplotlib.lines.Line2D object at 0x7f1e029e5c18>
|
||||
PyObject <matplotlib.lines.Line2D object at 0x7fbd50edb0b8>
|
||||
|
||||
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
|||
::
|
||||
|
||||
1-element Array{Any,1}:
|
||||
PyObject <matplotlib.lines.Line2D object at 0x7f1e294769b0>
|
||||
PyObject <matplotlib.lines.Line2D object at 0x7fbd514a7780>
|
||||
|
||||
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
|||
::
|
||||
|
||||
1-element Array{Any,1}:
|
||||
PyObject <matplotlib.lines.Line2D object at 0x7f1e293d9c88>
|
||||
PyObject <matplotlib.lines.Line2D object at 0x7fbd580c6080>
|
||||
|
||||
|
||||
|
||||
|
@ -46,19 +46,20 @@
|
|||
.. code-block:: julia
|
||||
|
||||
julia> x = linspace(0, 2π, 200)
|
||||
|
||||
200-element LinSpace{Float64}:
|
||||
0.0,0.0315738,0.0631476,0.0947214,0.126295,…,6.18846,6.22004,6.25161,6.28319
|
||||
|
||||
julia> plot(x, sin(x))
|
||||
|
||||
1-element Array{Any,1}:
|
||||
PyObject <matplotlib.lines.Line2D object at 0x7f1e293bcf60>
|
||||
julia> y = 20
|
||||
PyObject <matplotlib.lines.Line2D object at 0x7fbd585a7320>
|
||||
|
||||
julia> y = 20
|
||||
20
|
||||
|
||||
julia> plot(x, cos(x))
|
||||
1-element Array{Any,1}:
|
||||
PyObject <matplotlib.lines.Line2D object at 0x7f1e02b32710>
|
||||
PyObject <matplotlib.lines.Line2D object at 0x7fbd58612128>
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -70,12 +71,12 @@ julia> plot(x, cos(x))
|
|||
|
||||
x = randn(100, 100)
|
||||
contourf(x)
|
||||
|
||||
|
||||
|
||||
|
||||
::
|
||||
|
||||
PyObject <matplotlib.contour.QuadContourSet object at 0x7f1e293217f0>
|
||||
PyObject <matplotlib.contour.QuadContourSet object at 0x7fbd5a2d8e48>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ plot(x, sin(x))
|
|||
\end{juliacode}
|
||||
\begin{juliaout}
|
||||
1-element Array{Any,1}:
|
||||
PyObject <matplotlib.lines.Line2D object at 0x7f8aa1b99588>
|
||||
PyObject <matplotlib.lines.Line2D object at 0x7fbd66371c50>
|
||||
\end{juliaout}
|
||||
\begin{figure}[ht]
|
||||
\center
|
||||
|
@ -16,7 +16,7 @@ plot(x, sin(x))
|
|||
|
||||
\begin{juliaout}
|
||||
1-element Array{Any,1}:
|
||||
PyObject <matplotlib.lines.Line2D object at 0x7f8aa1d6cf60>
|
||||
PyObject <matplotlib.lines.Line2D object at 0x7fbd66325a20>
|
||||
\end{juliaout}
|
||||
\begin{figure}[htpb]
|
||||
\center
|
||||
|
@ -26,25 +26,26 @@ plot(x, sin(x))
|
|||
|
||||
\begin{juliaout}
|
||||
1-element Array{Any,1}:
|
||||
PyObject <matplotlib.lines.Line2D object at 0x7f8aa1cd9f28>
|
||||
PyObject <matplotlib.lines.Line2D object at 0x7fbd6629cf28>
|
||||
\end{juliaout}
|
||||
\includegraphics[width=\linewidth]{figures/pyplot_formats_cos2_fun_1.pdf}
|
||||
|
||||
\begin{juliaterm}
|
||||
julia> x = linspace(0, 2π, 200)
|
||||
|
||||
200-element LinSpace{Float64}:
|
||||
0.0,0.0315738,0.0631476,0.0947214,0.126295,…,6.18846,6.22004,6.25161,6.28319
|
||||
|
||||
julia> plot(x, sin(x))
|
||||
|
||||
1-element Array{Any,1}:
|
||||
PyObject <matplotlib.lines.Line2D object at 0x7f8aa1cc0ba8>
|
||||
julia> y = 20
|
||||
PyObject <matplotlib.lines.Line2D object at 0x7fbd600ca588>
|
||||
|
||||
julia> y = 20
|
||||
20
|
||||
|
||||
julia> plot(x, cos(x))
|
||||
1-element Array{Any,1}:
|
||||
PyObject <matplotlib.lines.Line2D object at 0x7f8aa1cc0e10>
|
||||
PyObject <matplotlib.lines.Line2D object at 0x7fbd600f4c18>
|
||||
|
||||
\end{juliaterm}
|
||||
\includegraphics[width=\linewidth]{figures/pyplot_formats_4_1.pdf}
|
||||
|
||||
|
@ -53,6 +54,6 @@ x = randn(100, 100)
|
|||
contourf(x)
|
||||
\end{juliacode}
|
||||
\begin{juliaout}
|
||||
PyObject <matplotlib.contour.QuadContourSet object at 0x7f8aa1c2f198>
|
||||
PyObject <matplotlib.contour.QuadContourSet object at 0x7fbd600ba9b0>
|
||||
\end{juliaout}
|
||||
\includegraphics[width=15cm]{figures/pyplot_formats_5_1.pdf}
|
||||
|
|
|
@ -1,23 +1,37 @@
|
|||
|
||||
y= [2, 5, 12]
|
||||
|
||||
|
||||
x = 1:10
|
||||
d = Dict("Weave" => "testing")
|
||||
y = [2, 4 ,8]
|
||||
|
||||
|
||||
x = [12, 10]
|
||||
println(y)
|
||||
println(x)
|
||||
|
||||
|
||||
println("Results without code")
|
||||
println(x)
|
||||
|
||||
|
||||
y = 1:5
|
||||
println(y)
|
||||
|
||||
|
||||
a = "Don't print me"
|
||||
println(a)
|
||||
|
||||
|
||||
println("No markup for results.")
|
||||
|
||||
println(collect(0:10:1000))
|
||||
|
||||
println(collect(0:10:1000))
|
||||
|
||||
|
||||
println(collect(0:10:1000))
|
||||
|
||||
|
||||
println(collect(0:10:1000))
|
||||
|
||||
|
|
|
@ -49,8 +49,8 @@ display(x)
|
|||
julia> using Gadfly
|
||||
|
||||
julia> x = 1:10
|
||||
|
||||
1:10
|
||||
|
||||
julia> plot(x = x, y = x)
|
||||
|
||||
~~~~~~~~~~~~~
|
||||
|
@ -73,6 +73,7 @@ julia> plot(x = x, y = x)
|
|||
~~~~{.julia}
|
||||
julia> display(x)
|
||||
1:10
|
||||
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
|
@ -85,8 +86,8 @@ julia> display(x)
|
|||
julietta> using Gadfly
|
||||
|
||||
julietta> x = 1:10
|
||||
|
||||
1:10
|
||||
|
||||
julietta> plot(x = x, y = x)
|
||||
|
||||
~~~~~~~~~~~~~
|
||||
|
@ -109,6 +110,7 @@ julietta> plot(x = x, y = x)
|
|||
~~~~{.julia}
|
||||
julietta> display(x)
|
||||
1:10
|
||||
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
|
@ -175,8 +177,8 @@ display(x)
|
|||
julia> using Gadfly
|
||||
|
||||
julia> x = 1:10
|
||||
|
||||
1:10
|
||||
|
||||
julia> plot(x = x, y = x)
|
||||
|
||||
~~~~~~~~~~~~~
|
||||
|
@ -199,6 +201,7 @@ julia> plot(x = x, y = x)
|
|||
~~~~{.julia}
|
||||
julia> display(x)
|
||||
1:10
|
||||
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
|
@ -219,8 +222,7 @@ display(x)
|
|||
|
||||
|
||||
~~~~
|
||||
1:10
|
||||
1:10
|
||||
1:101:10
|
||||
~~~~
|
||||
|
||||
|
||||
|
|
|
@ -24,13 +24,13 @@ f = Weave.format_chunk(dchunk, docformat.formatdict, docformat)
|
|||
parsed = Weave.read_doc("documents/chunk_options.noweb")
|
||||
doc = Weave.run(parsed, doctype = "md2html")
|
||||
|
||||
c_check = "<pre class='hljl'>\n<span class='hljl-nf'>println</span><span class='hljl-p'>(</span><span class='hljl-n'>x</span><span class='hljl-p'>)</span>\n</pre>\n"
|
||||
c_check = "<pre class='hljl'>\n<span class='hljl-n'>x</span><span class='hljl-t'> </span><span class='hljl-oB'>=</span><span class='hljl-t'> </span><span class='hljl-p'>[</span><span class='hljl-ni'>12</span><span class='hljl-p'>,</span><span class='hljl-t'> </span><span class='hljl-ni'>10</span><span class='hljl-p'>]</span><span class='hljl-t'>\n</span><span class='hljl-nf'>println</span><span class='hljl-p'>(</span><span class='hljl-n'>y</span><span class='hljl-p'>)</span>\n</pre>\n"
|
||||
doc.format.formatdict[:theme] = doc.highlight_theme
|
||||
c = Weave.format_code(doc.chunks[3].content, doc.format)
|
||||
@test c_check == c
|
||||
|
||||
o_check = "\nprintln(x)"
|
||||
o = Weave.format_output(doc.chunks[3].content, doc.format)
|
||||
o_check = "\nprintln(x)\n"
|
||||
o = Weave.format_output(doc.chunks[4].content, doc.format)
|
||||
@test o_check == o
|
||||
|
||||
doc.template = "templates/mini.tpl"
|
||||
|
@ -43,18 +43,17 @@ doc = Weave.run(parsed, doctype = "md2tex")
|
|||
|
||||
c_check = "\\begin{lstlisting}\n(*@\\HLJLnf{println}@*)(*@\\HLJLp{(}@*)(*@\\HLJLn{x}@*)(*@\\HLJLp{)}@*)\n\\end{lstlisting}\n"
|
||||
doc.format.formatdict[:theme] = doc.highlight_theme
|
||||
c = Weave.format_code(doc.chunks[3].content, doc.format)
|
||||
c = Weave.format_code(doc.chunks[4].content, doc.format)
|
||||
@test c_check == c
|
||||
|
||||
o_check = "\nx = [12, 10]\nprintln(y)"
|
||||
o = Weave.format_output(doc.chunks[2].content, doc.format)
|
||||
o_check = "\nx = [12, 10]\nprintln(y)\n"
|
||||
o = Weave.format_output(doc.chunks[3].content, doc.format)
|
||||
@test o_check == o
|
||||
|
||||
doc.template = "templates/mini.tpl"
|
||||
rendered = Weave.render_doc("Hello", doc, doc.format)
|
||||
@test rendered == "\nHello\n"
|
||||
|
||||
|
||||
# Test header parsing and stripping
|
||||
header = """
|
||||
---
|
||||
|
|
Loading…
Reference in New Issue