diff --git a/bin/weave.jl b/bin/weave.jl index 4388b35..4b6568d 100755 --- a/bin/weave.jl +++ b/bin/weave.jl @@ -54,7 +54,7 @@ elseif args["out_path"] == ":pwd" end for (key, val) in args - push!(args_col, (parse(key), val)) + push!(args_col, (Meta.parse(key), val)) end for s=source diff --git a/doc/make_examples.jl b/doc/make_examples.jl index 9741d75..06c6a56 100644 --- a/doc/make_examples.jl +++ b/doc/make_examples.jl @@ -10,12 +10,12 @@ weave("../examples/gadfly_md_sample.jmd", informat="markdown", out_path = "build/examples", doctype = "md2pdf") cp("../examples/gadfly_md_sample.jmd", - "build/examples/gadfly_md_sample.jmd", remove_destination = true) + "build/examples/gadfly_md_sample.jmd", force = true) cp("build/examples/gadfly_md_sample.md", - "build/examples/gadfly_md_sample.txt", remove_destination = true) + "build/examples/gadfly_md_sample.txt", force = true) weave("../examples/FIR_design.jl", out_path = "build/examples") weave("../examples/FIR_design.jl", doctype = "md2pdf", out_path = "build/examples") cp("../examples/FIR_design.jl", - "build/examples/FIR_design.jl", remove_destination = true) + "build/examples/FIR_design.jl", force = true) diff --git a/examples/FIR_design.jl b/examples/FIR_design.jl index 63db6de..b51762f 100644 --- a/examples/FIR_design.jl +++ b/examples/FIR_design.jl @@ -34,9 +34,9 @@ using Gadfly, DSP -function FIRfreqz(b::Array, w = linspace(0, π, 1024)) +function FIRfreqz(b::Array, w = range(0, stop=π, length=1024)) n = length(w) - h = Array{Complex64}(n) + h = Array{ComplexF32}(n) sw = 0 for i = 1:n for j = 1:length(b) @@ -60,7 +60,7 @@ end fs = 20 f = digitalfilter(Lowpass(5, fs = fs), FIRWindow(hamming(61))) -w = linspace(0, pi, 1024) +w = range(0, stop=pi, length=1024) h = FIRfreqz(f, w) #' ## Plot the frequency and impulse response @@ -78,6 +78,6 @@ plot(y = h_db, x = ws, Geom.line, #' And again with default options -h_phase = unwrap(-atan2(imag(h),real(h))) +h_phase = unwrap(-atan(imag(h),real(h))) plot(y = h_phase, x = ws, Geom.line, Guide.xlabel("Frequency (Hz)"), Guide.ylabel("Phase (radians)")) diff --git a/examples/FIR_design_plots.jl b/examples/FIR_design_plots.jl index 6d7a976..da23c14 100644 --- a/examples/FIR_design_plots.jl +++ b/examples/FIR_design_plots.jl @@ -33,9 +33,9 @@ using Plots, DSP plotly() -function FIRfreqz(b::Array, w = linspace(0, π, 1024)) +function FIRfreqz(b::Array, w = range(0, stop=π, length=1024)) n = length(w) - h = Array{Complex64}(n) + h = Array{ComplexF32}(n) sw = 0 for i = 1:n for j = 1:length(b) @@ -60,7 +60,7 @@ end fs = 20 f = digitalfilter(Lowpass(5, fs = fs), FIRWindow(hamming(61))) -w = linspace(0, pi, 1024) +w = range(0, stop=pi, length=1024) h = FIRfreqz(f, w) #' ## Plot the frequency and impulse response @@ -78,6 +78,6 @@ plot(ws, h_db, #' And again with default options -h_phase = unwrap(-atan2(imag(h),real(h))) +h_phase = unwrap(-atan(imag(h),real(h))) plot(ws, h_phase, xlabel = "Frequency (Hz)", ylabel = "Phase (radians)") diff --git a/src/Markdown2HTML.jl b/src/Markdown2HTML.jl index 9b655d8..79083f2 100644 --- a/src/Markdown2HTML.jl +++ b/src/Markdown2HTML.jl @@ -1,6 +1,6 @@ module Markdown2HTML # Markdown to HTML writer, Modified from Julia Base.Markdown html writer -using Base.Markdown: MD, Header, Code, Paragraph, BlockQuote, Footnote, +using Markdown: MD, Header, Code, Paragraph, BlockQuote, Footnote, Admonition, List, HorizontalRule, Bold, Italic, Image, Link, LineBreak, LaTeX, isordered diff --git a/src/Weave.jl b/src/Weave.jl index 5a8b340..48a5bdd 100644 --- a/src/Weave.jl +++ b/src/Weave.jl @@ -125,7 +125,7 @@ function weave(source ; doctype = :auto, plotlib=:auto, doc.cwd == pwd() && (outname = basename(outname)) info("Report weaved to $outname") catch e - warn("Something went wrong during weaving") + @warn("Something went wrong during weaving") println(e) finally doctype == :auto && (doctype = detect_doctype(doc.source)) @@ -162,9 +162,9 @@ function notebook(source::String, out_path=:pwd, timeout=-1) write(f, converted) end - info("Running nbconvert") - eval(parse("using IJulia")) - out = readstring(`$(IJulia.jupyter)-nbconvert --ExecutePreprocessor.timeout=$timeout --to notebook --execute $outfile --output $outfile`) + @info("Running nbconvert") + eval(Meta.parse("using IJulia")) + out = read(`$(IJulia.jupyter)-nbconvert --ExecutePreprocessor.timeout=$timeout --to notebook --execute $outfile --output $outfile`, String) end """ diff --git a/src/display_methods.jl b/src/display_methods.jl index 854ca62..31ec60d 100644 --- a/src/display_methods.jl +++ b/src/display_methods.jl @@ -1,7 +1,7 @@ using Compat #Contains report global properties -mutable struct Report <: Display +mutable struct Report <: AbstractDisplay cwd::AbstractString basename::AbstractString formatdict::Dict{Symbol,Any} @@ -69,7 +69,7 @@ function Base.display(report::Report, m::MIME"text/plain", data) io = PipeBuffer() show(IOContext(io, :limit => true), m, data) flush(io) - s = readstring(io) + s = read(io, String) close(io) println(s) end @@ -90,18 +90,18 @@ end #Catch "rich_output" function Base.display(report::Report, m::MIME"text/html", data) - s = reprmime(m, data) + s = repr(m, data) report.rich_output *= "\n" * s end #Catch "rich_output" function Base.display(report::Report, m::MIME"text/markdown", data) - s = reprmime(m, data) + s = repr(m, data) report.rich_output *= "\n" * s end function Base.display(report::Report, m::MIME"text/latex", data) - s = reprmime(m, data) + s = repr(m, data) report.rich_output *= "\n" * s end diff --git a/src/format.jl b/src/format.jl index f2edc1f..45ed4a7 100644 --- a/src/format.jl +++ b/src/format.jl @@ -1,6 +1,7 @@ import Mustache, Highlights import .Markdown2HTML using Compat +using Dates function format(doc::WeaveDoc) formatted = AbstractString[] @@ -50,7 +51,7 @@ function stylesheet(m::MIME, theme) buf = PipeBuffer() Highlights.stylesheet(buf, m, theme) flush(buf) - style = readstring(buf) + style = read(buf, String) close(buf) return style end @@ -59,13 +60,14 @@ function render_doc(formatted, doc::WeaveDoc, format::JMarkdown2HTML) css = stylesheet(MIME("text/html"), doc.highlight_theme) title, author, date = get_titleblock(doc) path, wsource = splitdir(abspath(doc.source)) - wversion = string(Pkg.installed("Weave")) + #wversion = string(Pkg.installed("Weave")) + wversion = "" wtime = string(Date(now())) if isempty(doc.css) - theme_css = readstring(joinpath(dirname(@__FILE__), "../templates/skeleton_css.css")) + theme_css = read(joinpath(dirname(@__FILE__), "../templates/skeleton_css.css"), String) else - theme_css = readstring(doc.css) + theme_css = read(doc.css, String) end if isempty(doc.template) @@ -86,7 +88,8 @@ function render_doc(formatted, doc::WeaveDoc, format::JMarkdown2tex) title, author, date = get_titleblock(doc) path, wsource = splitdir(abspath(doc.source)) - wversion = string(Pkg.installed("Weave")) + #wversion = string(Pkg.installed("Weave")) + wversion = "" wtime = string(Date(now())) if isempty(doc.template) @@ -108,7 +111,7 @@ function get_titleblock(doc::WeaveDoc) end function strip_header(chunk::DocChunk) - if ismatch(r"^---$(?
.+)^---$"ms, chunk.content[1].content) + if occursin(r"^---$(?
.+)^---$"ms, chunk.content[1].content) chunk.content[1].content = lstrip(replace(chunk.content[1].content, r"^---$(?
.+)^---$"ms, "")) end return chunk @@ -247,7 +250,7 @@ function format_code(result::AbstractString, docformat::JMarkdown2HTML) Highlights.highlight(buf, MIME("text/html"), strip(result), Highlights.Lexers.JuliaLexer, docformat.formatdict[:theme]) flush(buf) - highlighted = readstring(buf) + highlighted = read(buf, String) close(buf) return highlighted end @@ -257,11 +260,11 @@ function format_code(result::AbstractString, docformat::Pandoc2HTML) Highlights.highlight(buf, MIME("text/html"), strip(result), Highlights.Lexers.JuliaLexer, docformat.formatdict[:theme]) flush(buf) - highlighted = readstring(buf) + highlighted = read(buf, String) close(buf) return highlighted end - + function format_termchunk(chunk, formatdict, docformat) if chunk.options[:echo] && chunk.options[:results] != "hidden" @@ -277,7 +280,7 @@ function format_termchunk(chunk, formatdict, docformat::JMarkdown2HTML) buf = PipeBuffer() Highlights.highlight(buf, MIME("text/html"), strip(chunk.output), Highlights.Lexers.JuliaConsoleLexer) flush(buf) - result = readstring(buf) + result = read(buf, String) close(buf) else result = "" @@ -290,7 +293,7 @@ function format_termchunk(chunk, formatdict, docformat::Pandoc2HTML) buf = PipeBuffer() Highlights.highlight(buf, MIME("text/html"), strip(chunk.output), Highlights.Lexers.JuliaConsoleLexer) flush(buf) - result = readstring(buf) + result = read(buf, String) close(buf) else result = "" diff --git a/src/formatters.jl b/src/formatters.jl index c99596a..898071d 100644 --- a/src/formatters.jl +++ b/src/formatters.jl @@ -424,7 +424,7 @@ function formatfigures(chunk, docformat::Hugo) function format_shortcode(index_and_fig) index, fig = index_and_fig if index > 1 - warn("Only the first figure gets a caption.") + @warn("Only the first figure gets a caption.") title_spec = "" else caption = chunk.options[:fig_cap] diff --git a/src/gadfly.jl b/src/gadfly.jl index dfcdf43..8fa5deb 100644 --- a/src/gadfly.jl +++ b/src/gadfly.jl @@ -41,6 +41,6 @@ function Base.display(report::Report, m::MIME"image/svg+xml", p::Gadfly.Plot) elseif format == ".tex" Gadfly.draw(Gadfly.PGF(full_name, w, h, true ), p) else - warn("Can't save figure. Unsupported format") + @warn("Can't save figure. Unsupported format") end end diff --git a/src/pandoc.jl b/src/pandoc.jl index 89651e4..40ce19d 100644 --- a/src/pandoc.jl +++ b/src/pandoc.jl @@ -48,11 +48,11 @@ function pandoc2html(formatted::AbstractString, doc::WeaveDoc, outname::Abstract -o $outname`) println(pandoc_in, formatted) close(pandoc_in) - proc_output = readstring(pandoc_out) + proc_output = read(pandoc_out, String) cd(old_wd) catch e cd(old_wd) - warn("Error converting document to HTML") + @warn("Error converting document to HTML") throw(e) end end @@ -84,7 +84,7 @@ function pandoc2pdf(formatted::AbstractString, doc::WeaveDoc, outname::AbstractS citeproc = [] end - info("Done executing code. Running xelatex") + @info("Done executing code. Running xelatex") try pandoc_out, pandoc_in, proc = readandwrite(`pandoc -R -s --latex-engine=xelatex --highlight-style=tango $filt $citeproc @@ -93,11 +93,11 @@ function pandoc2pdf(formatted::AbstractString, doc::WeaveDoc, outname::AbstractS println(pandoc_in, formatted) close(pandoc_in) - proc_output = readstring(pandoc_out) + proc_output = read(pandoc_out, String) cd(old_wd) catch e cd(old_wd) - warn("Error converting document to pdf") + @warn("Error converting document to pdf") throw(e) end end @@ -110,7 +110,7 @@ function run_latex(doc::WeaveDoc, outname, latex_cmd = "xelatex") try textmp = mktempdir(".") #out = readstring(`$latex_cmd -shell-escape --output-directory=$textmp $xname`) - out = readstring(`$latex_cmd -shell-escape $xname`) + out = read(`$latex_cmd -shell-escape $xname`, String) #info(out) #pdf = joinpath(textmp, "$(doc.basename).pdf") #cp(pdf, "$(doc.basename).pdf", remove_destination=true) @@ -120,7 +120,7 @@ function run_latex(doc::WeaveDoc, outname, latex_cmd = "xelatex") return true catch e cd(old_wd) - warn("Error converting document to pdf. Try running latex manually") + @warn("Error converting document to pdf. Try running latex manually") return false #throw(e) end diff --git a/src/plots.jl b/src/plots.jl index 8b50fc3..8daff6b 100644 --- a/src/plots.jl +++ b/src/plots.jl @@ -14,7 +14,7 @@ push_preexecute_hook(plots_set_size) #PNG or SVG is not working, output html function Base.display(report::Report, m::MIME"image/svg+xml", data::Plots.Plot{Plots.PlotlyBackend})# #Remove extra spaces from start of line for pandoc - s = reprmime(MIME("text/html"), data) + s = repr(MIME("text/html"), data) splitted = split(s, "\n") start = split(splitted[1], r"(?= 0 - expr = parse(optionString) + expr = Meta.parse(optionString) Base.Meta.isexpr(expr,:(=)) && (options[expr.args[1]] = expr.args[2]) Base.Meta.isexpr(expr,:toplevel) && map(pushopt,fill(options,length(expr.args)),expr.args) end @@ -127,7 +127,7 @@ function parse_doc(document::AbstractString, format::MarkupInput) continue end - if ismatch(codeend, line) && state=="code" + if occursin(codeend, line) && state=="code" chunk = CodeChunk(content, codeno, start_line, optionString, options) @@ -216,7 +216,7 @@ function parse_doc(document::AbstractString, format::ScriptInput) #Get options options = Dict{Symbol,Any}() if length(optionString) > 0 - expr = parse(optionString) + expr = Meta.parse(optionString) Base.Meta.isexpr(expr,:(=)) && (options[expr.args[1]] = expr.args[2]) Base.Meta.isexpr(expr,:toplevel) && map(pushopt,fill(options,length(expr.args)),expr.args) end @@ -289,7 +289,7 @@ function parse_inline(text, noex) end function parse_inline(text::AbstractString, inline_ex::Regex) - ismatch(inline_ex, text) || return Inline[InlineText(text, 1, length(text), 1)] + occursin(inline_ex, text) || return Inline[InlineText(text, 1, length(text), 1)] inline_chunks = eachmatch(inline_ex, text) s = 1 diff --git a/src/run.jl b/src/run.jl index 761253b..8a60b1a 100644 --- a/src/run.jl +++ b/src/run.jl @@ -40,15 +40,15 @@ function Base.run(doc::WeaveDoc; doctype = :auto, plotlib=:auto, cache == :off || @eval import FileIO, JLD2 #This is needed for latex and should work on all output formats - is_windows() && (fig_path = replace(fig_path, "\\", "/")) + Sys.iswindows() && (fig_path = replace(fig_path, "\\", "/")) doc.fig_path = fig_path set_rc_params(doc.format.formatdict, fig_path, fig_ext) #New sandbox for each document with args exposed sandbox = "ReportSandBox$(rcParams[:doc_number])" - eval(parse("module $sandbox\nWEAVE_ARGS=Dict()\nend")) - SandBox = eval(parse(sandbox)) + eval(Meta.parse("module $sandbox\nWEAVE_ARGS=Dict()\nend")) + SandBox = eval(Meta.parse(sandbox)) merge!(SandBox.WEAVE_ARGS, args) rcParams[:doc_number] += 1 @@ -67,7 +67,7 @@ function Base.run(doc::WeaveDoc; doctype = :auto, plotlib=:auto, if cache != :off && cache != :refresh cached = read_cache(doc, cache_path) - cached == nothing && info("No cached results found, running code") + cached == nothing && @info("No cached results found, running code") else cached = nothing end @@ -324,9 +324,9 @@ end #Set all variables to nothing function clear_sandbox(SandBox::Module) - for name = names(SandBox, true) + for name = names(SandBox, all=true) if name != :eval && name != names(SandBox)[1] - try eval(SandBox, parse(AbstractString(AbstractString(name), "=nothing"))) end + try eval(SandBox, Meta.parse(AbstractString(AbstractString(name), "=nothing"))) catch; end end end end @@ -356,13 +356,13 @@ function init_plotting(plotlib) rcParams[:chunk_defaults][:fig] = true if l_plotlib == "pyplot" - eval(parse("""include("$srcdir/pyplot.jl")""")) + eval(Meta.parse("""include("$srcdir/pyplot.jl")""")) rcParams[:plotlib] = "PyPlot" elseif l_plotlib == "plots" - eval(parse("""include("$srcdir/plots.jl")""")) + eval(Meta.parse("""include("$srcdir/plots.jl")""")) rcParams[:plotlib] = "Plots" elseif l_plotlib == "gadfly" - eval(parse("""include("$srcdir/gadfly.jl")""")) + eval(Meta.parse("""include("$srcdir/gadfly.jl")""")) rcParams[:plotlib] = "Gadfly" end end diff --git a/test/cache_test.jl b/test/cache_test.jl index a9b1884..824cbee 100644 --- a/test/cache_test.jl +++ b/test/cache_test.jl @@ -1,33 +1,33 @@ using Weave -using Base.Test +using Test #Test if running document with and without cache works isdir("documents/cache") && rm("documents/cache", recursive = true) weave("documents/chunk_options.noweb", plotlib=nothing, cache=:all) -result = readstring("documents/chunk_options.md") +result = read("documents/chunk_options.md", String) rm("documents/chunk_options.md") weave("documents/chunk_options.noweb", plotlib=nothing, cache=:all) -cached_result = readstring("documents/chunk_options.md") +cached_result = read("documents/chunk_options.md", String) @test result == cached_result # cache = :user isdir("documents/cache") && rm("documents/cache", recursive = true) out = "documents/chunk_cache.md" Weave.weave("documents/chunk_cache.noweb", plotlib=nothing, cache=:user); -result = readstring(out) +result = read(out, String) rm(out) Weave.weave("documents/chunk_cache.noweb", plotlib=nothing, cache=:user); -cached_result = readstring(out) +cached_result = read(out, String) @test result == cached_result # cache = :all isdir("documents/cache") && rm("documents/cache", recursive = true) out = "documents/chunk_cache.md" Weave.weave("documents/chunk_cache.noweb", cache=:all); -result = readstring(out) +result = read(out, String) rm(out) Weave.weave("documents/chunk_cache.noweb", cache=:all); -cached_result = readstring(out) +cached_result = read(out, String) @test result == cached_result @@ -37,9 +37,9 @@ if VERSION.minor == 5 isdir("documents/cache") && rm("documents/cache", recursive = true) #Caching with Gadfly weave("documents/gadfly_formats_test.txt", doctype="tex", plotlib="gadfly", cache=:all) - result = readstring("documents/gadfly_formats_test.tex") + result = read("documents/gadfly_formats_test.tex", String) rm("documents/gadfly_formats_test.tex") weave("documents/gadfly_formats_test.txt", doctype="tex", plotlib="gadfly", cache=:all) - cached_result = readstring("documents/gadfly_formats_test.tex") + cached_result = read("documents/gadfly_formats_test.tex", String) @test result == cached_result end diff --git a/test/chunk_options.jl b/test/chunk_options.jl index cdcf8e6..400cf68 100644 --- a/test/chunk_options.jl +++ b/test/chunk_options.jl @@ -1,19 +1,19 @@ using Weave -using Base.Test +using Test cleanup = true VER = "$(VERSION.major).$(VERSION.minor)" weave("documents/chunk_options.noweb", plotlib=nothing) -result = readstring("documents/chunk_options.md") -ref = readstring("documents/$VER/chunk_options_ref.md") +result = read("documents/chunk_options.md", String) +ref = read("documents/$VER/chunk_options_ref.md", String) @test result == ref cleanup && rm("documents/chunk_options.md") tangle("documents/chunk_options.noweb", out_path = "documents/tangle") -result = readstring("documents/tangle/chunk_options.jl") -ref = readstring("documents/tangle/chunk_options.jl.ref") +result = read("documents/tangle/chunk_options.jl", String) +ref = read("documents/tangle/chunk_options.jl.ref", String) @test ref == result cleanup && rm("documents/tangle/chunk_options.jl") diff --git a/test/chunk_opts_gadfly.jl b/test/chunk_opts_gadfly.jl index 723c850..fced443 100644 --- a/test/chunk_opts_gadfly.jl +++ b/test/chunk_opts_gadfly.jl @@ -1,18 +1,18 @@ using Weave -using Base.Test +using Test cleanup = true #Test hold and term options weave("documents/test_hold.mdw", doctype="pandoc", plotlib="Gadfly") -result = readstring("documents/test_hold.md") -ref = readstring("documents/test_hold_ref.md") +result = read("documents/test_hold.md", String) +ref = read("documents/test_hold_ref.md", String) @test result == ref cleanup && rm("documents/test_hold.md") #Test setting and restoring chunk options Weave.weave("documents/default_opts.noweb", doctype = "tex") -result = readstring("documents/default_opts.tex") -ref = readstring("documents/default_opts_ref.tex") +result = read("documents/default_opts.tex", String) +ref = read("documents/default_opts_ref.tex", String) @test result == ref cleanup && rm("documents/default_opts.tex") diff --git a/test/convert_test.jl b/test/convert_test.jl index 319349b..4a20ce9 100644 --- a/test/convert_test.jl +++ b/test/convert_test.jl @@ -1,11 +1,11 @@ using Weave -using Base.Test +using Test function convert_test(outfile, infile="documents/chunk_options.noweb") outfile = joinpath("documents/convert", outfile) convert_doc(infile, outfile) - result = readstring(outfile) - ref = readstring(outfile * ".ref") + result = read(outfile, String) + ref = read(outfile * ".ref", String) @test result == ref rm(outfile) end diff --git a/test/documents/FIR_design.jl b/test/documents/FIR_design.jl index 2fd8cc0..1daa97b 100644 --- a/test/documents/FIR_design.jl +++ b/test/documents/FIR_design.jl @@ -32,9 +32,9 @@ using Gadfly, DSP -function FIRfreqz(b::Array, w = linspace(0, π, 1024)) +function FIRfreqz(b::Array, w = range(0, stop=π, length=1024)) n = length(w) - h = Array{Complex64}(n) + h = Array{ComplexF32}(n) sw = 0 for i = 1:n for j = 1:length(b) @@ -59,7 +59,7 @@ end fs = 20 f = digitalfilter(Lowpass(5, fs = fs), FIRWindow(hamming(61))) -w = linspace(0, pi, 1024) +w = range(0, stop=pi, length=1024) h = FIRfreqz(f, w) #' ## Plot the frequency and impulse response @@ -75,6 +75,6 @@ plot(y = h_db, x = ws, Geom.line, #' And again with default options -h_phase = unwrap(-atan2(imag(h),real(h))) +h_phase = unwrap(-atan(imag(h),real(h))) plot(y = h_phase, x = ws, Geom.line, Guide.xlabel("Frequency (Hz)"), Guide.ylabel("Phase (radians)")) diff --git a/test/documents/gadfly_formats_test_jssvg_ref.md b/test/documents/gadfly_formats_test_jssvg_ref.md index 37a4be1..87d70cd 100644 --- a/test/documents/gadfly_formats_test_jssvg_ref.md +++ b/test/documents/gadfly_formats_test_jssvg_ref.md @@ -1,6 +1,6 @@ ````julia using Gadfly -x = linspace(0, 2π, 200) +x = range(0, stop=2π, length=200) plot(x=x, y = sin(x), Geom.line) ```` @@ -12,7 +12,7 @@ plot(x=x, y = sin(x), Geom.line) ![](figures/gadfly_formats_test_cos2_fun_1.js.svg) ````julia -julia> x = linspace(0, 2π, 200) +julia> x = range(0, stop=2π, length=200) 200-element LinSpace{Float64}: 0.0,0.0315738,0.0631476,0.0947214,0.126295,…,6.18846,6.22004,6.25161,6.28319 @@ -37,7 +37,7 @@ Plot(...) ![](figures/gadfly_formats_test_4_2.js.svg) ````julia -x = linspace(0, 2π, 200) +x = range(0, stop=2π, length=200) plot(x=x, y = sin(x), Geom.line) ```` diff --git a/test/documents/gadfly_formats_test_mmd_ref.md b/test/documents/gadfly_formats_test_mmd_ref.md index ba0b3c3..169262f 100644 --- a/test/documents/gadfly_formats_test_mmd_ref.md +++ b/test/documents/gadfly_formats_test_mmd_ref.md @@ -1,6 +1,6 @@ ````julia using Gadfly -x = linspace(0, 2π, 200) +x = range(0, stop=2π, length=200) plot(x=x, y = sin(x), Geom.line) ```` @@ -18,7 +18,7 @@ plot(x=x, y = sin(x), Geom.line) [figures/gadfly_formats_test_cos2_fun_1.png]: figures/gadfly_formats_test_cos2_fun_1.png ````julia -julia> x = linspace(0, 2π, 200) +julia> x = range(0, stop=2π, length=200) 200-element LinSpace{Float64}: 0.0,0.0315738,0.0631476,0.0947214,0.126295,…,6.18846,6.22004,6.25161,6.28319 @@ -47,7 +47,7 @@ Plot(...) [figures/gadfly_formats_test_4_2.png]: figures/gadfly_formats_test_4_2.png ````julia -x = linspace(0, 2π, 200) +x = range(0, stop=2π, length=200) plot(x=x, y = sin(x), Geom.line) ```` diff --git a/test/documents/gadfly_markdown_test_ref.md b/test/documents/gadfly_markdown_test_ref.md index f04a914..6fba715 100644 --- a/test/documents/gadfly_markdown_test_ref.md +++ b/test/documents/gadfly_markdown_test_ref.md @@ -4,7 +4,7 @@ ````julia julia> using Gadfly -julia> x = linspace(0, 2π, 200) +julia> x = range(0, stop=2π, length=200) 200-element LinSpace{Float64}: 0.0,0.0315738,0.0631476,0.0947214,0.126295,…,6.18846,6.22004,6.25161,6.28319 @@ -29,7 +29,7 @@ Plot(...) ![](figures/gadfly_markdown_test_1_2.png) ````julia -x = linspace(0, 200) +x = range(0, stop=200, length=50) println(x) ```` @@ -43,7 +43,7 @@ linspace(0.0,200.0,50) ````julia julia> using Gadfly -julia> x = linspace(0, 2π, 200) +julia> x = range(0, stop=2π, length=200) 200-element LinSpace{Float64}: 0.0,0.0315738,0.0631476,0.0947214,0.126295,…,6.18846,6.22004,6.25161,6.28319 @@ -68,7 +68,7 @@ Plot(...) ![](figures/gadfly_markdown_test_3_2.png) ````julia -x = linspace(0, 200) +x = range(0, stop=200, length=50) println(x) ```` diff --git a/test/documents/plotsjl/plotsjl_test.jl b/test/documents/plotsjl/plotsjl_test.jl index 7cf2800..d5db5e2 100644 --- a/test/documents/plotsjl/plotsjl_test.jl +++ b/test/documents/plotsjl/plotsjl_test.jl @@ -1,7 +1,7 @@ using Plots pyplot() -x = linspace(0, 2*pi) +x = range(0, stop=2*pi, length=50) println(x) p = plot(x = x, y = sin(x), size =(900,300)) diff --git a/test/documents/pyplot_formats_ref.md b/test/documents/pyplot_formats_ref.md index fe0226c..bd96550 100644 --- a/test/documents/pyplot_formats_ref.md +++ b/test/documents/pyplot_formats_ref.md @@ -1,6 +1,6 @@ ````julia using PyPlot -x = linspace(0, 2π, 200) +x = range(0, stop=2π, length=200) plot(x, sin(x)) ```` @@ -30,7 +30,7 @@ plot(x, sin(x)) ![](figures/pyplot_formats_cos2_fun_1.png) ````julia -julia> x = linspace(0, 2π, 200) +julia> x = range(0, stop=2π, length=200) 200-element LinSpace{Float64}: 0.0,0.0315738,0.0631476,0.0947214,0.126295,…,6.18846,6.22004,6.25161,6.28319 diff --git a/test/errors_test.jl b/test/errors_test.jl index 6e97b7c..343cfe4 100644 --- a/test/errors_test.jl +++ b/test/errors_test.jl @@ -1,5 +1,5 @@ using Weave -using Base.Test +using Test s1= """ diff --git a/test/figureformatter_test.jl b/test/figureformatter_test.jl index e0a9287..8ffb34b 100644 --- a/test/figureformatter_test.jl +++ b/test/figureformatter_test.jl @@ -1,5 +1,5 @@ using Weave -using Base.Test +using Test # Make a dummy codehunk with figure chunk = Weave.CodeChunk("plot(x)", 1, 1, "", Dict()) diff --git a/test/formatter_test.jl b/test/formatter_test.jl index e2142f5..934020e 100644 --- a/test/formatter_test.jl +++ b/test/formatter_test.jl @@ -1,5 +1,5 @@ using Weave -using Base.Test +using Test # Test rendering of doc chunks content = """ diff --git a/test/gadfly_formats.jl b/test/gadfly_formats.jl index 32e69b6..39846c2 100644 --- a/test/gadfly_formats.jl +++ b/test/gadfly_formats.jl @@ -1,60 +1,60 @@ #Test for Gadfly with different chunk options and figure formatsusing Weave using Weave -using Base.Test +using Test weave("documents/gadfly_formats_test.txt", doctype = "tex", plotlib="gadfly") -result = readstring("documents/gadfly_formats_test.tex") -ref = readstring("documents/gadfly_formats_test_ref.tex") +result = read("documents/gadfly_formats_test.tex", String) +ref = read("documents/gadfly_formats_test_ref.tex", String) @test result == ref weave("documents/gadfly_formats_test.txt", doctype="tex", fig_ext=".tex", plotlib="gadfly") -result = readstring("documents/gadfly_formats_test.tex") -ref = readstring("documents/gadfly_formats_test_tikz_ref.tex") +result = read("documents/gadfly_formats_test.tex", String) +ref = read("documents/gadfly_formats_test_tikz_ref.tex", String) @test result == ref weave("documents/gadfly_formats_test.txt", doctype="tex", fig_ext=".ps", plotlib="gadfly") -result = readstring("documents/gadfly_formats_test.tex") -ref = readstring("documents/gadfly_formats_test_ps_ref.tex") +result = read("documents/gadfly_formats_test.tex", String) +ref = read("documents/gadfly_formats_test_ps_ref.tex", String) @test result == ref weave("documents/gadfly_formats_test.txt", doctype="pandoc", plotlib="gadfly") -result = readstring("documents/gadfly_formats_test.md") -ref = readstring("documents/gadfly_formats_test_pandoc_ref.md") +result = read("documents/gadfly_formats_test.md", String) +ref = read("documents/gadfly_formats_test_pandoc_ref.md", String) @test result == ref weave("documents/gadfly_formats_test.txt", doctype="pandoc", plotlib="gadfly", fig_ext=".svg") -result = readstring("documents/gadfly_formats_test.md") -ref = readstring("documents/gadfly_formats_test_svg_ref.md") +result = read("documents/gadfly_formats_test.md", String) +ref = read("documents/gadfly_formats_test_svg_ref.md", String) @test result == ref weave("documents/gadfly_formats_test.txt", doctype="github", plotlib="gadfly", fig_ext=".js.svg") -result = readstring("documents/gadfly_formats_test.md") -ref = readstring("documents/gadfly_formats_test_jssvg_ref.md") +result = read("documents/gadfly_formats_test.md", String) +ref = read("documents/gadfly_formats_test_jssvg_ref.md", String) @test result == ref weave("documents/gadfly_formats_test.txt", doctype="rst", plotlib="gadfly") -result = readstring("documents/gadfly_formats_test.rst") -ref = readstring("documents/gadfly_formats_test_ref.rst") +result = read("documents/gadfly_formats_test.rst", String) +ref = read("documents/gadfly_formats_test_ref.rst", String) @test result == ref weave("documents/gadfly_formats_test.txt", doctype="multimarkdown", plotlib="gadfly") -result = readstring("documents/gadfly_formats_test.md") -ref = readstring("documents/gadfly_formats_test_mmd_ref.md") +result = read("documents/gadfly_formats_test.md", String) +ref = read("documents/gadfly_formats_test_mmd_ref.md", String) @test result == ref weave("documents/gadfly_formats_test.txt", doctype="asciidoc", plotlib="gadfly", out_path="documents/output") -result = readstring("documents/output/gadfly_formats_test.txt") -ref = readstring("documents/output/gadfly_formats_test_ref.txt") +result = read("documents/output/gadfly_formats_test.txt", String) +ref = read("documents/output/gadfly_formats_test_ref.txt", String) @test result == ref weave("documents/gadfly_markdown_test.jmd", doctype="github",plotlib="gadfly", informat="markdown") -result = readstring("documents/gadfly_markdown_test.md") -ref = readstring("documents/gadfly_markdown_test_ref.md") +result = read("documents/gadfly_markdown_test.md", String) +ref = read("documents/gadfly_markdown_test_ref.md", String) @test result == ref weave("documents/FIR_design.jl", doctype="pandoc", plotlib="gadfly", informat="script") -result = readstring("documents/FIR_design.md") -ref = readstring("documents/FIR_design_ref.md") +result = read("documents/FIR_design.md", String) +ref = read("documents/FIR_design_ref.md", String) @test result == ref diff --git a/test/markdown_test.jl b/test/markdown_test.jl index f07bbd1..b8af5df 100644 --- a/test/markdown_test.jl +++ b/test/markdown_test.jl @@ -1,4 +1,4 @@ -using Base.Test +using Test import Weave: Markdown2HTML # Test markdown2html writer diff --git a/test/plotsjl_test.jl b/test/plotsjl_test.jl index 7d9d2fe..07b84ea 100644 --- a/test/plotsjl_test.jl +++ b/test/plotsjl_test.jl @@ -1,10 +1,10 @@ using Weave -using Base.Test +using Test function pljtest(source, resfile, doctype) weave("documents/$source", out_path = "documents/plotsjl/$resfile", doctype=doctype) - result = readstring("documents/plotsjl/$resfile") - ref = readstring("documents/plotsjl/$resfile.ref") + result = read("documents/plotsjl/$resfile", String) + ref = read("documents/plotsjl/$resfile.ref", String) @test result == ref rm("documents/plotsjl/$resfile") end diff --git a/test/publish_test.jl b/test/publish_test.jl index c0e6be5..d3404ec 100644 --- a/test/publish_test.jl +++ b/test/publish_test.jl @@ -1,13 +1,13 @@ using Weave -using Base.Test +using Test import Plots function publish_test(outfile, format) outfile = joinpath("documents/publish", outfile) infile = "documents/publish_test.jmd" weave(infile, doctype = format, out_path = outfile, template = "templates/mini.tpl") - result = readstring(outfile) - ref = readstring(outfile * ".ref") + result = read(outfile, String) + ref = read(outfile * ".ref", String) @test result == ref rm(outfile) end diff --git a/test/pyplot_formats.jl b/test/pyplot_formats.jl index 7da7ad8..a81c10c 100644 --- a/test/pyplot_formats.jl +++ b/test/pyplot_formats.jl @@ -1,26 +1,26 @@ using Weave -using Base.Test +using Test cleanup = true weave("documents/pyplot_formats.txt", plotlib="pyplot", doctype="tex") -result = readstring("documents/pyplot_formats.tex") -ref = readstring("documents/pyplot_formats_ref.tex") +result = read("documents/pyplot_formats.tex", String) +ref = read("documents/pyplot_formats_ref.tex", String) result = replace(result, r"\s*PyObject.*\n", "\n") #Remove PyObjects, because they change ref = replace(ref, r"\s*PyObject.*\n", "\n") @test result == ref weave("documents/pyplot_formats.txt", plotlib="pyplot", doctype="github") -result = readstring("documents/pyplot_formats.md") -ref = readstring("documents/pyplot_formats_ref.md") +result = read("documents/pyplot_formats.md", String) +ref = read("documents/pyplot_formats_ref.md", String) result = replace(result, r"\s*PyObject.*\n", "") ref = replace(ref, r"\s*PyObject.*\n", "") @test result == ref weave("documents/pyplot_formats.txt", plotlib="pyplot", doctype="rst", fig_ext=".svg") -result = readstring("documents/pyplot_formats.rst") -ref = readstring("documents/pyplot_formats_ref.rst") +result = read("documents/pyplot_formats.rst", String) +ref = read("documents/pyplot_formats_ref.rst", String) result = replace(result, r"\s*PyObject.*\n", "") ref = replace(ref, r"\s*PyObject.*\n", "") @test result == ref diff --git a/test/rich_output.jl b/test/rich_output.jl index fee965d..44ea9cf 100644 --- a/test/rich_output.jl +++ b/test/rich_output.jl @@ -1,11 +1,11 @@ using Weave -using Base.Test +using Test function mmtest(source, resfile, doctype) 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/$resfile.ref") + result = read("documents/multimedia/$resfile", String) + ref = read("documents/multimedia/$resfile.ref", String) @test result == ref rm("documents/multimedia/$resfile") end diff --git a/test/runtests.jl b/test/runtests.jl index 9267f3d..0b45d17 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,30 +1,30 @@ using Weave -using Base.Test +using Test -info("Test: Chunk options") +@info("Test: Chunk options") include("chunk_options.jl") -info("Testing error handling") +@info("Testing error handling") include("errors_test.jl") -info("Test: Converting") +@info("Test: Converting") include("convert_test.jl") -info("Testing formatters") +@info("Testing formatters") include("formatter_test.jl") include("markdown_test.jl") -info("Testing figure formatters") +@info("Testing figure formatters") include("figureformatter_test.jl") -info("Testing rich output") +@info("Testing rich output") include("rich_output.jl") -info("Test: Caching") +@info("Test: Caching") include("cache_test.jl") -info("Test: Chunk options with Gadfly") +@info("Test: Chunk options with Gadfly") include("chunk_opts_gadfly.jl") #info("Test: Weaving with Gadfly") @@ -33,6 +33,6 @@ include("chunk_opts_gadfly.jl") #info("Test: Weaving with PyPlot") #include("pyplot_formats.jl") -info("Test: Weaving with Plots.jl") +@info("Test: Weaving with Plots.jl") include("plotsjl_test.jl") include("publish_test.jl")