|
|
|
@ -23,6 +23,7 @@ function compare_chunks(chunks1, chunks2) |
|
|
|
@test c1.continued == c2.continued |
|
|
|
@test c1.continued == c2.continued |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
return |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
@testset "Literate.parse" begin |
|
|
|
@testset "Literate.parse" begin |
|
|
|
@ -149,7 +150,7 @@ end |
|
|
|
CodeChunk(["# Line 73", "#", "# Line 75"], false), |
|
|
|
CodeChunk(["# Line 73", "#", "# Line 75"], false), |
|
|
|
CodeChunk([" # Line 77", " #", " # Line 79"], false), |
|
|
|
CodeChunk([" # Line 77", " #", " # Line 79"], false), |
|
|
|
MDChunk(["" => "Line 80: Quarto Specific"]), |
|
|
|
MDChunk(["" => "Line 80: Quarto Specific"]), |
|
|
|
CodeChunk(["##| Line 81"], false) |
|
|
|
CodeChunk(["##| Line 81"], false), |
|
|
|
] |
|
|
|
] |
|
|
|
parsed_chunks = Literate.parse(DefaultFlavor(), content) |
|
|
|
parsed_chunks = Literate.parse(DefaultFlavor(), content) |
|
|
|
compare_chunks(parsed_chunks, expected_chunks) |
|
|
|
compare_chunks(parsed_chunks, expected_chunks) |
|
|
|
@ -192,7 +193,7 @@ end |
|
|
|
CodeChunk(["# Line 73", "#", "# Line 75"], false), |
|
|
|
CodeChunk(["# Line 73", "#", "# Line 75"], false), |
|
|
|
CodeChunk([" # Line 77", " #", " # Line 79"], false), |
|
|
|
CodeChunk([" # Line 77", " #", " # Line 79"], false), |
|
|
|
MDChunk(["" => "Line 80: Quarto Specific"]), |
|
|
|
MDChunk(["" => "Line 80: Quarto Specific"]), |
|
|
|
CodeChunk(["#| Line 81"], false) # parses correctly as code cell command |
|
|
|
CodeChunk(["#| Line 81"], false), # parses correctly as code cell command |
|
|
|
] |
|
|
|
] |
|
|
|
parsed_chunks = Literate.parse(QuartoFlavor(), content) |
|
|
|
parsed_chunks = Literate.parse(QuartoFlavor(), content) |
|
|
|
compare_chunks(parsed_chunks, expected_chunks_quarto) |
|
|
|
compare_chunks(parsed_chunks, expected_chunks_quarto) |
|
|
|
@ -349,9 +350,15 @@ const GITLAB_ENV = Dict( |
|
|
|
(k => nothing for k in keys(ACTIONS_ENV))..., |
|
|
|
(k => nothing for k in keys(ACTIONS_ENV))..., |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
@testset "Literate.script" begin; Base.CoreLogging.with_logger(Base.CoreLogging.NullLogger()) do |
|
|
|
function with_nullogger_tempdir_cd(f) |
|
|
|
mktempdir(@__DIR__) do sandbox |
|
|
|
Base.CoreLogging.with_logger(Base.CoreLogging.NullLogger()) do |
|
|
|
cd(sandbox) do |
|
|
|
mktempdir(tmp -> cd(f, tmp), @__DIR__) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@testset "Literate.script" begin |
|
|
|
|
|
|
|
with_nullogger_tempdir_cd() do |
|
|
|
# write content to inputfile |
|
|
|
# write content to inputfile |
|
|
|
inputfile = "inputfile.jl" |
|
|
|
inputfile = "inputfile.jl" |
|
|
|
write(inputfile, content) |
|
|
|
write(inputfile, content) |
|
|
|
@ -407,9 +414,9 @@ const GITLAB_ENV = Dict( |
|
|
|
@test script == expected_script |
|
|
|
@test script == expected_script |
|
|
|
|
|
|
|
|
|
|
|
# Travis with with PR preview build |
|
|
|
# Travis with with PR preview build |
|
|
|
withenv(TRAVIS_ENV..., |
|
|
|
withenv( |
|
|
|
"TRAVIS_TAG" => "", |
|
|
|
TRAVIS_ENV..., "TRAVIS_TAG" => "", "TRAVIS_PULL_REQUEST" => "42" |
|
|
|
"TRAVIS_PULL_REQUEST" => "42") do |
|
|
|
) do |
|
|
|
Literate.script(inputfile, outdir) |
|
|
|
Literate.script(inputfile, outdir) |
|
|
|
end |
|
|
|
end |
|
|
|
script = read(joinpath(outdir, "inputfile.jl"), String) |
|
|
|
script = read(joinpath(outdir, "inputfile.jl"), String) |
|
|
|
@ -418,8 +425,9 @@ const GITLAB_ENV = Dict( |
|
|
|
@test occursin("# Link to binder: https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=previews/PR42/file.jl", script) |
|
|
|
@test occursin("# Link to binder: https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=previews/PR42/file.jl", script) |
|
|
|
|
|
|
|
|
|
|
|
# Travis with no tag -> dev directory |
|
|
|
# Travis with no tag -> dev directory |
|
|
|
withenv(TRAVIS_ENV..., |
|
|
|
withenv( |
|
|
|
"TRAVIS_TAG" => "") do |
|
|
|
TRAVIS_ENV..., "TRAVIS_TAG" => "" |
|
|
|
|
|
|
|
) do |
|
|
|
Literate.script(inputfile, outdir) |
|
|
|
Literate.script(inputfile, outdir) |
|
|
|
end |
|
|
|
end |
|
|
|
script = read(joinpath(outdir, "inputfile.jl"), String) |
|
|
|
script = read(joinpath(outdir, "inputfile.jl"), String) |
|
|
|
@ -437,9 +445,10 @@ const GITLAB_ENV = Dict( |
|
|
|
@test occursin("# Link to binder: https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=v1.2.0/file.jl", script) |
|
|
|
@test occursin("# Link to binder: https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=v1.2.0/file.jl", script) |
|
|
|
|
|
|
|
|
|
|
|
# GitHub Actions with PR preview build |
|
|
|
# GitHub Actions with PR preview build |
|
|
|
withenv(ACTIONS_ENV..., |
|
|
|
withenv( |
|
|
|
"GITHUB_EVENT_NAME" => "pull_request", |
|
|
|
ACTIONS_ENV..., |
|
|
|
"GITHUB_REF" => "refs/pull/42/merge") do |
|
|
|
"GITHUB_EVENT_NAME" => "pull_request", "GITHUB_REF" => "refs/pull/42/merge" |
|
|
|
|
|
|
|
) do |
|
|
|
Literate.script(inputfile, outdir) |
|
|
|
Literate.script(inputfile, outdir) |
|
|
|
end |
|
|
|
end |
|
|
|
script = read(joinpath(outdir, "inputfile.jl"), String) |
|
|
|
script = read(joinpath(outdir, "inputfile.jl"), String) |
|
|
|
@ -448,8 +457,9 @@ const GITLAB_ENV = Dict( |
|
|
|
@test occursin("# Link to binder: https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=previews/PR42/file.jl", script) |
|
|
|
@test occursin("# Link to binder: https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=previews/PR42/file.jl", script) |
|
|
|
|
|
|
|
|
|
|
|
# GitHub Actions without a tag -> dev directory |
|
|
|
# GitHub Actions without a tag -> dev directory |
|
|
|
withenv(ACTIONS_ENV..., |
|
|
|
withenv( |
|
|
|
"GITHUB_REF" => "refs/heads/master") do |
|
|
|
ACTIONS_ENV..., "GITHUB_REF" => "refs/heads/master" |
|
|
|
|
|
|
|
) do |
|
|
|
Literate.script(inputfile, outdir) |
|
|
|
Literate.script(inputfile, outdir) |
|
|
|
end |
|
|
|
end |
|
|
|
script = read(joinpath(outdir, "inputfile.jl"), String) |
|
|
|
script = read(joinpath(outdir, "inputfile.jl"), String) |
|
|
|
@ -458,8 +468,10 @@ const GITLAB_ENV = Dict( |
|
|
|
@test occursin("# Link to binder: https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=dev/file.jl", script) |
|
|
|
@test occursin("# Link to binder: https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=dev/file.jl", script) |
|
|
|
|
|
|
|
|
|
|
|
# building under DocumentationGenerator.jl |
|
|
|
# building under DocumentationGenerator.jl |
|
|
|
withenv("DOCUMENTATIONGENERATOR" => "true", |
|
|
|
withenv( |
|
|
|
"DOCUMENTATIONGENERATOR_BASE_URL" => "pkg.julialang.org/docs/Literate/XPnWG/1.2.0") do |
|
|
|
"DOCUMENTATIONGENERATOR" => "true", |
|
|
|
|
|
|
|
"DOCUMENTATIONGENERATOR_BASE_URL" => "pkg.julialang.org/docs/Literate/XPnWG/1.2.0" |
|
|
|
|
|
|
|
) do |
|
|
|
Literate.script(inputfile, outdir) |
|
|
|
Literate.script(inputfile, outdir) |
|
|
|
end |
|
|
|
end |
|
|
|
script = read(joinpath(outdir, "inputfile.jl"), String) |
|
|
|
script = read(joinpath(outdir, "inputfile.jl"), String) |
|
|
|
@ -467,9 +479,11 @@ const GITLAB_ENV = Dict( |
|
|
|
@test_broken occursin("https://github.com/fredrikekre/Literate.jl/blob/master/file.jl", script) |
|
|
|
@test_broken occursin("https://github.com/fredrikekre/Literate.jl/blob/master/file.jl", script) |
|
|
|
|
|
|
|
|
|
|
|
# pre- and post-processing |
|
|
|
# pre- and post-processing |
|
|
|
Literate.script(inputfile, outdir, |
|
|
|
Literate.script( |
|
|
|
|
|
|
|
inputfile, outdir, |
|
|
|
preprocess = x -> replace(x, "PLACEHOLDER3" => "3REDLOHECALP"), |
|
|
|
preprocess = x -> replace(x, "PLACEHOLDER3" => "3REDLOHECALP"), |
|
|
|
postprocess = x -> replace(x, "PLACEHOLDER4" => "4REDLOHECALP")) |
|
|
|
postprocess = x -> replace(x, "PLACEHOLDER4" => "4REDLOHECALP") |
|
|
|
|
|
|
|
) |
|
|
|
script = read(joinpath(outdir, "inputfile.jl"), String) |
|
|
|
script = read(joinpath(outdir, "inputfile.jl"), String) |
|
|
|
@test !occursin("PLACEHOLDER1", script) |
|
|
|
@test !occursin("PLACEHOLDER1", script) |
|
|
|
@test !occursin("PLACEHOLDER2", script) |
|
|
|
@test !occursin("PLACEHOLDER2", script) |
|
|
|
@ -497,11 +511,14 @@ const GITLAB_ENV = Dict( |
|
|
|
""" |
|
|
|
""" |
|
|
|
# It can sometimes happen that a text editor line-wraps a link which shouldn't |
|
|
|
# It can sometimes happen that a text editor line-wraps a link which shouldn't |
|
|
|
# break""", |
|
|
|
# break""", |
|
|
|
script) |
|
|
|
script |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
# mdstrings |
|
|
|
# mdstrings |
|
|
|
mdstrings_file = "inputfile_mdstrings.jl" |
|
|
|
mdstrings_file = "inputfile_mdstrings.jl" |
|
|
|
write(mdstrings_file, """ |
|
|
|
write( |
|
|
|
|
|
|
|
mdstrings_file, |
|
|
|
|
|
|
|
""" |
|
|
|
md\"\"\" |
|
|
|
md\"\"\" |
|
|
|
# Markdown header |
|
|
|
# Markdown header |
|
|
|
|
|
|
|
|
|
|
|
@ -516,9 +533,12 @@ const GITLAB_ENV = Dict( |
|
|
|
comment |
|
|
|
comment |
|
|
|
===# |
|
|
|
===# |
|
|
|
2 + 2 |
|
|
|
2 + 2 |
|
|
|
""") |
|
|
|
""" |
|
|
|
Literate.script(mdstrings_file, outdir, |
|
|
|
) |
|
|
|
keep_comments = true, credit=false) |
|
|
|
Literate.script( |
|
|
|
|
|
|
|
mdstrings_file, outdir, |
|
|
|
|
|
|
|
keep_comments = true, credit = false |
|
|
|
|
|
|
|
) |
|
|
|
script = read(joinpath(outdir, mdstrings_file), String) |
|
|
|
script = read(joinpath(outdir, mdstrings_file), String) |
|
|
|
@test strip(script) == """ |
|
|
|
@test strip(script) == """ |
|
|
|
md\"\"\" |
|
|
|
md\"\"\" |
|
|
|
@ -535,8 +555,10 @@ const GITLAB_ENV = Dict( |
|
|
|
# comment |
|
|
|
# comment |
|
|
|
|
|
|
|
|
|
|
|
2 + 2""" |
|
|
|
2 + 2""" |
|
|
|
Literate.script(mdstrings_file, outdir, |
|
|
|
Literate.script( |
|
|
|
keep_comments = true, mdstrings = true, credit=false) |
|
|
|
mdstrings_file, outdir, |
|
|
|
|
|
|
|
keep_comments = true, mdstrings = true, credit = false |
|
|
|
|
|
|
|
) |
|
|
|
script = read(joinpath(outdir, mdstrings_file), String) |
|
|
|
script = read(joinpath(outdir, mdstrings_file), String) |
|
|
|
@test strip(script) == """ |
|
|
|
@test strip(script) == """ |
|
|
|
# # Markdown header |
|
|
|
# # Markdown header |
|
|
|
@ -560,11 +582,9 @@ const GITLAB_ENV = Dict( |
|
|
|
@test_throws ArgumentError Literate.script(inputfile) |
|
|
|
@test_throws ArgumentError Literate.script(inputfile) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@testset "Literate.markdown" begin; Base.CoreLogging.with_logger(Base.CoreLogging.NullLogger()) do |
|
|
|
@testset "Literate.markdown" begin |
|
|
|
mktempdir(@__DIR__) do sandbox |
|
|
|
with_nullogger_tempdir_cd() do |
|
|
|
cd(sandbox) do |
|
|
|
|
|
|
|
# write content to inputfile |
|
|
|
# write content to inputfile |
|
|
|
inputfile = "inputfile.jl" |
|
|
|
inputfile = "inputfile.jl" |
|
|
|
write(inputfile, content) |
|
|
|
write(inputfile, content) |
|
|
|
@ -706,9 +726,9 @@ end end |
|
|
|
@test markdown == expected_markdown |
|
|
|
@test markdown == expected_markdown |
|
|
|
|
|
|
|
|
|
|
|
# Travis with PR preview build |
|
|
|
# Travis with PR preview build |
|
|
|
withenv(TRAVIS_ENV..., |
|
|
|
withenv( |
|
|
|
"TRAVIS_TAG" => "", |
|
|
|
TRAVIS_ENV..., "TRAVIS_TAG" => "", "TRAVIS_PULL_REQUEST" => "42" |
|
|
|
"TRAVIS_PULL_REQUEST" => "42") do |
|
|
|
) do |
|
|
|
Literate.markdown(inputfile, outdir) |
|
|
|
Literate.markdown(inputfile, outdir) |
|
|
|
end |
|
|
|
end |
|
|
|
markdown = read(joinpath(outdir, "inputfile.md"), String) |
|
|
|
markdown = read(joinpath(outdir, "inputfile.md"), String) |
|
|
|
@ -718,8 +738,9 @@ end end |
|
|
|
@test occursin("EditURL = \"../inputfile.jl\"", markdown) |
|
|
|
@test occursin("EditURL = \"../inputfile.jl\"", markdown) |
|
|
|
|
|
|
|
|
|
|
|
# Travis with no tag -> dev directory |
|
|
|
# Travis with no tag -> dev directory |
|
|
|
withenv(TRAVIS_ENV..., |
|
|
|
withenv( |
|
|
|
"TRAVIS_TAG" => "") do |
|
|
|
TRAVIS_ENV..., "TRAVIS_TAG" => "" |
|
|
|
|
|
|
|
) do |
|
|
|
Literate.markdown(inputfile, outdir) |
|
|
|
Literate.markdown(inputfile, outdir) |
|
|
|
end |
|
|
|
end |
|
|
|
markdown = read(joinpath(outdir, "inputfile.md"), String) |
|
|
|
markdown = read(joinpath(outdir, "inputfile.md"), String) |
|
|
|
@ -739,9 +760,10 @@ end end |
|
|
|
@test occursin("EditURL = \"../inputfile.jl\"", markdown) |
|
|
|
@test occursin("EditURL = \"../inputfile.jl\"", markdown) |
|
|
|
|
|
|
|
|
|
|
|
# GitHub Actions with PR preview build |
|
|
|
# GitHub Actions with PR preview build |
|
|
|
withenv(ACTIONS_ENV..., |
|
|
|
withenv( |
|
|
|
"GITHUB_REF" => "refs/pull/42/merge", |
|
|
|
ACTIONS_ENV..., |
|
|
|
"GITHUB_EVENT_NAME" => "pull_request") do |
|
|
|
"GITHUB_REF" => "refs/pull/42/merge", "GITHUB_EVENT_NAME" => "pull_request" |
|
|
|
|
|
|
|
) do |
|
|
|
Literate.markdown(inputfile, outdir) |
|
|
|
Literate.markdown(inputfile, outdir) |
|
|
|
end |
|
|
|
end |
|
|
|
markdown = read(joinpath(outdir, "inputfile.md"), String) |
|
|
|
markdown = read(joinpath(outdir, "inputfile.md"), String) |
|
|
|
@ -751,8 +773,9 @@ end end |
|
|
|
@test occursin("EditURL = \"../inputfile.jl\"", markdown) |
|
|
|
@test occursin("EditURL = \"../inputfile.jl\"", markdown) |
|
|
|
|
|
|
|
|
|
|
|
# GitHub Actions without a tag -> dev directory |
|
|
|
# GitHub Actions without a tag -> dev directory |
|
|
|
withenv(ACTIONS_ENV..., |
|
|
|
withenv( |
|
|
|
"GITHUB_REF" => "refs/heads/master") do |
|
|
|
ACTIONS_ENV..., "GITHUB_REF" => "refs/heads/master" |
|
|
|
|
|
|
|
) do |
|
|
|
Literate.markdown(inputfile, outdir) |
|
|
|
Literate.markdown(inputfile, outdir) |
|
|
|
end |
|
|
|
end |
|
|
|
markdown = read(joinpath(outdir, "inputfile.md"), String) |
|
|
|
markdown = read(joinpath(outdir, "inputfile.md"), String) |
|
|
|
@ -772,8 +795,10 @@ end end |
|
|
|
@test occursin("EditURL = \"../inputfile.jl\"", markdown) |
|
|
|
@test occursin("EditURL = \"../inputfile.jl\"", markdown) |
|
|
|
|
|
|
|
|
|
|
|
# building under DocumentationGenerator.jl |
|
|
|
# building under DocumentationGenerator.jl |
|
|
|
withenv("DOCUMENTATIONGENERATOR" => "true", |
|
|
|
withenv( |
|
|
|
"DOCUMENTATIONGENERATOR_BASE_URL" => "pkg.julialang.org/docs/Literate/XPnWG/1.2.0") do |
|
|
|
"DOCUMENTATIONGENERATOR" => "true", |
|
|
|
|
|
|
|
"DOCUMENTATIONGENERATOR_BASE_URL" => "pkg.julialang.org/docs/Literate/XPnWG/1.2.0" |
|
|
|
|
|
|
|
) do |
|
|
|
Literate.markdown(inputfile, outdir) |
|
|
|
Literate.markdown(inputfile, outdir) |
|
|
|
end |
|
|
|
end |
|
|
|
markdown = read(joinpath(outdir, "inputfile.md"), String) |
|
|
|
markdown = read(joinpath(outdir, "inputfile.md"), String) |
|
|
|
@ -781,9 +806,11 @@ end end |
|
|
|
@test_broken occursin("https://github.com/fredrikekre/Literate.jl/blob/master/file.jl", markdown) |
|
|
|
@test_broken occursin("https://github.com/fredrikekre/Literate.jl/blob/master/file.jl", markdown) |
|
|
|
|
|
|
|
|
|
|
|
# pre- and post-processing |
|
|
|
# pre- and post-processing |
|
|
|
Literate.markdown(inputfile, outdir, |
|
|
|
Literate.markdown( |
|
|
|
|
|
|
|
inputfile, outdir, |
|
|
|
preprocess = x -> replace(replace(x, "PLACEHOLDER1" => "1REDLOHECALP"), "PLACEHOLDER3" => "3REDLOHECALP"), |
|
|
|
preprocess = x -> replace(replace(x, "PLACEHOLDER1" => "1REDLOHECALP"), "PLACEHOLDER3" => "3REDLOHECALP"), |
|
|
|
postprocess = x -> replace(replace(x, "PLACEHOLDER2" => "2REDLOHECALP"), "PLACEHOLDER4" => "4REDLOHECALP")) |
|
|
|
postprocess = x -> replace(replace(x, "PLACEHOLDER2" => "2REDLOHECALP"), "PLACEHOLDER4" => "4REDLOHECALP") |
|
|
|
|
|
|
|
) |
|
|
|
markdown = read(joinpath(outdir, "inputfile.md"), String) |
|
|
|
markdown = read(joinpath(outdir, "inputfile.md"), String) |
|
|
|
@test !occursin("PLACEHOLDER1", markdown) |
|
|
|
@test !occursin("PLACEHOLDER1", markdown) |
|
|
|
@test !occursin("PLACEHOLDER2", markdown) |
|
|
|
@test !occursin("PLACEHOLDER2", markdown) |
|
|
|
@ -857,7 +884,8 @@ end end |
|
|
|
@test !occursin("blob/master/", markdown) |
|
|
|
@test !occursin("blob/master/", markdown) |
|
|
|
|
|
|
|
|
|
|
|
# execute |
|
|
|
# execute |
|
|
|
write(inputfile, """ |
|
|
|
write( |
|
|
|
|
|
|
|
inputfile, """ |
|
|
|
using DisplayAs |
|
|
|
using DisplayAs |
|
|
|
#- |
|
|
|
#- |
|
|
|
1+1 |
|
|
|
1+1 |
|
|
|
@ -912,7 +940,8 @@ end end |
|
|
|
(@__DIR__) == pwd() ? "cwd correct" : "cwd incorrect" |
|
|
|
(@__DIR__) == pwd() ? "cwd correct" : "cwd incorrect" |
|
|
|
#- |
|
|
|
#- |
|
|
|
basename(@__FILE__) |
|
|
|
basename(@__FILE__) |
|
|
|
""") |
|
|
|
""" |
|
|
|
|
|
|
|
) |
|
|
|
Literate.markdown(inputfile, outdir; execute = true) |
|
|
|
Literate.markdown(inputfile, outdir; execute = true) |
|
|
|
markdown = read(joinpath(outdir, "inputfile.md"), String) |
|
|
|
markdown = read(joinpath(outdir, "inputfile.md"), String) |
|
|
|
@test occursin("```\n2\n```", markdown) # text/plain |
|
|
|
@test occursin("```\n2\n```", markdown) # text/plain |
|
|
|
@ -961,8 +990,10 @@ end end |
|
|
|
chunks, _ = Literate.preprocessor(inputfile, outdir; user_kwargs = (), user_config = (), type = :md) |
|
|
|
chunks, _ = Literate.preprocessor(inputfile, outdir; user_kwargs = (), user_config = (), type = :md) |
|
|
|
@test chunks[2].lines == ["" => "hello world", "" => "hej världen"] |
|
|
|
@test chunks[2].lines == ["" => "hello world", "" => "hej världen"] |
|
|
|
write(inputfile, "md\"\"\"\r\nhello world\r\nhej världen\r\n\"\"\"\r\n") |
|
|
|
write(inputfile, "md\"\"\"\r\nhello world\r\nhej världen\r\n\"\"\"\r\n") |
|
|
|
chunks, _ = Literate.preprocessor(inputfile, outdir; user_kwargs=pairs((; mdstrings=true)), |
|
|
|
chunks, _ = Literate.preprocessor( |
|
|
|
user_config=(), type=:md) |
|
|
|
inputfile, outdir; user_kwargs = pairs((; mdstrings = true)), |
|
|
|
|
|
|
|
user_config = (), type = :md |
|
|
|
|
|
|
|
) |
|
|
|
@test chunks[2].lines == ["" => "hello world", "" => "hej världen"] |
|
|
|
@test chunks[2].lines == ["" => "hello world", "" => "hej världen"] |
|
|
|
|
|
|
|
|
|
|
|
# fredrikekre/Literate.jl#168 |
|
|
|
# fredrikekre/Literate.jl#168 |
|
|
|
@ -981,8 +1012,10 @@ end end |
|
|
|
SVG() |
|
|
|
SVG() |
|
|
|
""", |
|
|
|
""", |
|
|
|
) |
|
|
|
) |
|
|
|
Literate.markdown(inputfile, relpath(outdir); execute=true, |
|
|
|
Literate.markdown( |
|
|
|
flavor=Literate.CommonMarkFlavor()) |
|
|
|
inputfile, relpath(outdir); execute = true, |
|
|
|
|
|
|
|
flavor = Literate.CommonMarkFlavor() |
|
|
|
|
|
|
|
) |
|
|
|
@test read(joinpath(outdir, "inputfile-1.svg"), String) == "issue228" |
|
|
|
@test read(joinpath(outdir, "inputfile-1.svg"), String) == "issue228" |
|
|
|
|
|
|
|
|
|
|
|
# Softscope |
|
|
|
# Softscope |
|
|
|
@ -1005,13 +1038,11 @@ end end |
|
|
|
catch err |
|
|
|
catch err |
|
|
|
@test occursin(r"`?ret`? not defined", sprint(Base.showerror, err)) |
|
|
|
@test occursin(r"`?ret`? not defined", sprint(Base.showerror, err)) |
|
|
|
end |
|
|
|
end |
|
|
|
end # cd(sandbox) |
|
|
|
end |
|
|
|
end # mktemp |
|
|
|
end |
|
|
|
end end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@testset "Literate.notebook" begin; Base.CoreLogging.with_logger(Base.CoreLogging.NullLogger()) do |
|
|
|
@testset "Literate.notebook" begin |
|
|
|
mktempdir(@__DIR__) do sandbox |
|
|
|
with_nullogger_tempdir_cd() do |
|
|
|
cd(sandbox) do |
|
|
|
|
|
|
|
# write content to inputfile |
|
|
|
# write content to inputfile |
|
|
|
inputfile = "inputfile.jl" |
|
|
|
inputfile = "inputfile.jl" |
|
|
|
write(inputfile, content) |
|
|
|
write(inputfile, content) |
|
|
|
@ -1021,11 +1052,11 @@ end end |
|
|
|
withenv(TRAVIS_ENV...) do |
|
|
|
withenv(TRAVIS_ENV...) do |
|
|
|
Literate.notebook(inputfile, outdir, execute = false) |
|
|
|
Literate.notebook(inputfile, outdir, execute = false) |
|
|
|
end |
|
|
|
end |
|
|
|
expected_cells = rstrip.(( |
|
|
|
expected_cells = rstrip.( |
|
|
|
|
|
|
|
[ |
|
|
|
""" |
|
|
|
""" |
|
|
|
"cells": [ |
|
|
|
"cells": [ |
|
|
|
""", |
|
|
|
""", |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
""" |
|
|
|
"source": [ |
|
|
|
"source": [ |
|
|
|
"# Example\\n", |
|
|
|
"# Example\\n", |
|
|
|
@ -1033,48 +1064,41 @@ end end |
|
|
|
"baz, bax" |
|
|
|
"baz, bax" |
|
|
|
] |
|
|
|
] |
|
|
|
""", |
|
|
|
""", |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
""" |
|
|
|
"source": [ |
|
|
|
"source": [ |
|
|
|
"x = 1" |
|
|
|
"x = 1" |
|
|
|
] |
|
|
|
] |
|
|
|
""", |
|
|
|
""", |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
""" |
|
|
|
"source": [ |
|
|
|
"source": [ |
|
|
|
"Not markdown\\n", |
|
|
|
"Not markdown\\n", |
|
|
|
"Not markdown" |
|
|
|
"Not markdown" |
|
|
|
], |
|
|
|
], |
|
|
|
""", |
|
|
|
""", |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
""" |
|
|
|
"source": [ |
|
|
|
"source": [ |
|
|
|
"x * 1\\n", |
|
|
|
"x * 1\\n", |
|
|
|
"x * 1" |
|
|
|
"x * 1" |
|
|
|
], |
|
|
|
], |
|
|
|
""", |
|
|
|
""", |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
""" |
|
|
|
"source": [ |
|
|
|
"source": [ |
|
|
|
"Only notebook\\n", |
|
|
|
"Only notebook\\n", |
|
|
|
"Only notebook" |
|
|
|
"Only notebook" |
|
|
|
] |
|
|
|
] |
|
|
|
""", |
|
|
|
""", |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
""" |
|
|
|
"source": [ |
|
|
|
"source": [ |
|
|
|
"x + 2\\n", |
|
|
|
"x + 2\\n", |
|
|
|
"x + 2" |
|
|
|
"x + 2" |
|
|
|
] |
|
|
|
] |
|
|
|
""", |
|
|
|
""", |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
""" |
|
|
|
"source": [ |
|
|
|
"source": [ |
|
|
|
"Not script\\n", |
|
|
|
"Not script\\n", |
|
|
|
"Not script" |
|
|
|
"Not script" |
|
|
|
], |
|
|
|
], |
|
|
|
""", |
|
|
|
""", |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
""" |
|
|
|
"source": [ |
|
|
|
"source": [ |
|
|
|
"x * 3\\n", |
|
|
|
"x * 3\\n", |
|
|
|
@ -1083,7 +1107,6 @@ end end |
|
|
|
"# another comment" |
|
|
|
"# another comment" |
|
|
|
], |
|
|
|
], |
|
|
|
""", |
|
|
|
""", |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
""" |
|
|
|
"source": [ |
|
|
|
"source": [ |
|
|
|
"for i in 1:10\\n", |
|
|
|
"for i in 1:10\\n", |
|
|
|
@ -1092,7 +1115,6 @@ end end |
|
|
|
"end" |
|
|
|
"end" |
|
|
|
] |
|
|
|
] |
|
|
|
""", |
|
|
|
""", |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
""" |
|
|
|
"source": [ |
|
|
|
"source": [ |
|
|
|
"name: inputfile\\n", |
|
|
|
"name: inputfile\\n", |
|
|
|
@ -1101,7 +1123,6 @@ end end |
|
|
|
"Link to binder: https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=v1.2.0/file.jl" |
|
|
|
"Link to binder: https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=v1.2.0/file.jl" |
|
|
|
] |
|
|
|
] |
|
|
|
""", |
|
|
|
""", |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
""" |
|
|
|
"source": [ |
|
|
|
"source": [ |
|
|
|
"# name: inputfile\\n", |
|
|
|
"# name: inputfile\\n", |
|
|
|
@ -1110,21 +1131,18 @@ end end |
|
|
|
"# Link to binder: https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=v1.2.0/file.jl" |
|
|
|
"# Link to binder: https://mybinder.org/v2/gh/fredrikekre/Literate.jl/gh-pages?filepath=v1.2.0/file.jl" |
|
|
|
] |
|
|
|
] |
|
|
|
""", |
|
|
|
""", |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
""" |
|
|
|
"source": [ |
|
|
|
"source": [ |
|
|
|
"PLACEHOLDER1\\n", |
|
|
|
"PLACEHOLDER1\\n", |
|
|
|
"PLACEHOLDER2" |
|
|
|
"PLACEHOLDER2" |
|
|
|
] |
|
|
|
] |
|
|
|
""", |
|
|
|
""", |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
""" |
|
|
|
"source": [ |
|
|
|
"source": [ |
|
|
|
"# PLACEHOLDER3\\n", |
|
|
|
"# PLACEHOLDER3\\n", |
|
|
|
"# PLACEHOLDER4" |
|
|
|
"# PLACEHOLDER4" |
|
|
|
] |
|
|
|
] |
|
|
|
""", |
|
|
|
""", |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
""" |
|
|
|
"source": [ |
|
|
|
"source": [ |
|
|
|
"Some inline math: \$\\\\frac{df}{dx}\$, some multiline inline math: \$y =\\n", |
|
|
|
"Some inline math: \$\\\\frac{df}{dx}\$, some multiline inline math: \$y =\\n", |
|
|
|
@ -1134,13 +1152,11 @@ end end |
|
|
|
"\$\$" |
|
|
|
"\$\$" |
|
|
|
] |
|
|
|
] |
|
|
|
""", |
|
|
|
""", |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
""" |
|
|
|
"source": [ |
|
|
|
"source": [ |
|
|
|
"Indented markdown" |
|
|
|
"Indented markdown" |
|
|
|
] |
|
|
|
] |
|
|
|
""", |
|
|
|
""", |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
""" |
|
|
|
"source": [ |
|
|
|
"source": [ |
|
|
|
"for i in 1:10\\n", |
|
|
|
"for i in 1:10\\n", |
|
|
|
@ -1149,7 +1165,6 @@ end end |
|
|
|
"end" |
|
|
|
"end" |
|
|
|
] |
|
|
|
] |
|
|
|
""", |
|
|
|
""", |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
""" |
|
|
|
"source": [ |
|
|
|
"source": [ |
|
|
|
"Some inline html\\n", |
|
|
|
"Some inline html\\n", |
|
|
|
@ -1157,27 +1172,26 @@ end end |
|
|
|
" <a href=\\"https://github.com/fredrikekre/Literate.jl\\">Literate.jl</a>" |
|
|
|
" <a href=\\"https://github.com/fredrikekre/Literate.jl\\">Literate.jl</a>" |
|
|
|
] |
|
|
|
] |
|
|
|
""", |
|
|
|
""", |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
""" |
|
|
|
"metadata": { |
|
|
|
"metadata": { |
|
|
|
"meta": "data" |
|
|
|
"meta": "data" |
|
|
|
} |
|
|
|
} |
|
|
|
""", |
|
|
|
""", |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
""" |
|
|
|
"source": [ |
|
|
|
"source": [ |
|
|
|
"First multiline\\n", |
|
|
|
"First multiline\\n", |
|
|
|
"comment" |
|
|
|
"comment" |
|
|
|
] |
|
|
|
] |
|
|
|
""", |
|
|
|
""", |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
""" |
|
|
|
"source": [ |
|
|
|
"source": [ |
|
|
|
"---\\n", |
|
|
|
"---\\n", |
|
|
|
"\\n", |
|
|
|
"\\n", |
|
|
|
"*This notebook was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).*" |
|
|
|
"*This notebook was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).*" |
|
|
|
] |
|
|
|
] |
|
|
|
""")) |
|
|
|
""", |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
notebook = read(joinpath(outdir, "inputfile.ipynb"), String) |
|
|
|
notebook = read(joinpath(outdir, "inputfile.ipynb"), String) |
|
|
|
|
|
|
|
|
|
|
|
@ -1188,16 +1202,19 @@ end end |
|
|
|
lastidx = nextind(notebook, last(idx)) |
|
|
|
lastidx = nextind(notebook, last(idx)) |
|
|
|
end |
|
|
|
end |
|
|
|
# test some of the required metadata |
|
|
|
# test some of the required metadata |
|
|
|
for metadata in (" \"nbformat\": ", " \"nbformat_minor\": ", " \"metadata\": {", " \"language_info\": {", |
|
|
|
for metadata in ( |
|
|
|
|
|
|
|
" \"nbformat\": ", " \"nbformat_minor\": ", " \"metadata\": {", " \"language_info\": {", |
|
|
|
" \"file_extension\": \".jl\"", " \"mimetype\": \"application/julia\"", |
|
|
|
" \"file_extension\": \".jl\"", " \"mimetype\": \"application/julia\"", |
|
|
|
" \"name\": \"julia\"", " \"version\": ", " \"kernelspec\": {", |
|
|
|
" \"name\": \"julia\"", " \"version\": ", " \"kernelspec\": {", |
|
|
|
" \"name\": \"julia-", " \"display_name\": \"Julia ", " \"language\": \"julia\"") |
|
|
|
" \"name\": \"julia-", " \"display_name\": \"Julia ", " \"language\": \"julia\"", |
|
|
|
|
|
|
|
) |
|
|
|
@test occursin(metadata, notebook) |
|
|
|
@test occursin(metadata, notebook) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
# no tag -> latest directory |
|
|
|
# no tag -> latest directory |
|
|
|
withenv(TRAVIS_ENV..., |
|
|
|
withenv( |
|
|
|
"TRAVIS_TAG" => "") do |
|
|
|
TRAVIS_ENV..., "TRAVIS_TAG" => "" |
|
|
|
|
|
|
|
) do |
|
|
|
Literate.notebook(inputfile, outdir, execute = false) |
|
|
|
Literate.notebook(inputfile, outdir, execute = false) |
|
|
|
end |
|
|
|
end |
|
|
|
notebook = read(joinpath(outdir, "inputfile.ipynb"), String) |
|
|
|
notebook = read(joinpath(outdir, "inputfile.ipynb"), String) |
|
|
|
@ -1211,25 +1228,29 @@ end end |
|
|
|
@test occursin("fredrikekre/Literate.jl/blob/gh-pages/v1.2.0/", notebook) |
|
|
|
@test occursin("fredrikekre/Literate.jl/blob/gh-pages/v1.2.0/", notebook) |
|
|
|
|
|
|
|
|
|
|
|
# GitHub Actions with PR preview build |
|
|
|
# GitHub Actions with PR preview build |
|
|
|
withenv(ACTIONS_ENV..., |
|
|
|
withenv( |
|
|
|
"GITHUB_REF" => "refs/pull/42/merge", |
|
|
|
ACTIONS_ENV..., |
|
|
|
"GITHUB_EVENT_NAME" => "pull_request") do |
|
|
|
"GITHUB_REF" => "refs/pull/42/merge", "GITHUB_EVENT_NAME" => "pull_request" |
|
|
|
|
|
|
|
) do |
|
|
|
Literate.notebook(inputfile, outdir, execute = false) |
|
|
|
Literate.notebook(inputfile, outdir, execute = false) |
|
|
|
end |
|
|
|
end |
|
|
|
notebook = read(joinpath(outdir, "inputfile.ipynb"), String) |
|
|
|
notebook = read(joinpath(outdir, "inputfile.ipynb"), String) |
|
|
|
@test occursin("fredrikekre/Literate.jl/blob/gh-pages/previews/PR42/", notebook) |
|
|
|
@test occursin("fredrikekre/Literate.jl/blob/gh-pages/previews/PR42/", notebook) |
|
|
|
|
|
|
|
|
|
|
|
# GitHub Actions without a tag |
|
|
|
# GitHub Actions without a tag |
|
|
|
withenv(ACTIONS_ENV..., |
|
|
|
withenv( |
|
|
|
"GITHUB_REF" => "refs/heads/master") do |
|
|
|
ACTIONS_ENV..., "GITHUB_REF" => "refs/heads/master" |
|
|
|
|
|
|
|
) do |
|
|
|
Literate.notebook(inputfile, outdir, execute = false) |
|
|
|
Literate.notebook(inputfile, outdir, execute = false) |
|
|
|
end |
|
|
|
end |
|
|
|
notebook = read(joinpath(outdir, "inputfile.ipynb"), String) |
|
|
|
notebook = read(joinpath(outdir, "inputfile.ipynb"), String) |
|
|
|
@test occursin("fredrikekre/Literate.jl/blob/gh-pages/dev/", notebook) |
|
|
|
@test occursin("fredrikekre/Literate.jl/blob/gh-pages/dev/", notebook) |
|
|
|
|
|
|
|
|
|
|
|
# building under DocumentationGenerator.jl |
|
|
|
# building under DocumentationGenerator.jl |
|
|
|
withenv("DOCUMENTATIONGENERATOR" => "true", |
|
|
|
withenv( |
|
|
|
"DOCUMENTATIONGENERATOR_BASE_URL" => "pkg.julialang.org/docs/Literate/XPnWG/1.2.0") do |
|
|
|
"DOCUMENTATIONGENERATOR" => "true", |
|
|
|
|
|
|
|
"DOCUMENTATIONGENERATOR_BASE_URL" => "pkg.julialang.org/docs/Literate/XPnWG/1.2.0" |
|
|
|
|
|
|
|
) do |
|
|
|
Literate.notebook(inputfile, outdir, execute = false) |
|
|
|
Literate.notebook(inputfile, outdir, execute = false) |
|
|
|
end |
|
|
|
end |
|
|
|
notebook = read(joinpath(outdir, "inputfile.ipynb"), String) |
|
|
|
notebook = read(joinpath(outdir, "inputfile.ipynb"), String) |
|
|
|
@ -1246,9 +1267,11 @@ end end |
|
|
|
end |
|
|
|
end |
|
|
|
return nb |
|
|
|
return nb |
|
|
|
end |
|
|
|
end |
|
|
|
Literate.notebook(inputfile, outdir, execute = false, |
|
|
|
Literate.notebook( |
|
|
|
|
|
|
|
inputfile, outdir, execute = false, |
|
|
|
preprocess = x -> replace(replace(x, "PLACEHOLDER1" => "1REDLOHECALP"), "PLACEHOLDER3" => "3REDLOHECALP"), |
|
|
|
preprocess = x -> replace(replace(x, "PLACEHOLDER1" => "1REDLOHECALP"), "PLACEHOLDER3" => "3REDLOHECALP"), |
|
|
|
postprocess = post) |
|
|
|
postprocess = post |
|
|
|
|
|
|
|
) |
|
|
|
notebook = read(joinpath(outdir, "inputfile.ipynb"), String) |
|
|
|
notebook = read(joinpath(outdir, "inputfile.ipynb"), String) |
|
|
|
@test !occursin("PLACEHOLDER1", notebook) |
|
|
|
@test !occursin("PLACEHOLDER1", notebook) |
|
|
|
@test !occursin("PLACEHOLDER2", notebook) |
|
|
|
@test !occursin("PLACEHOLDER2", notebook) |
|
|
|
@ -1277,22 +1300,23 @@ end end |
|
|
|
|
|
|
|
|
|
|
|
# execute = true |
|
|
|
# execute = true |
|
|
|
Literate.notebook(inputfile, outdir) |
|
|
|
Literate.notebook(inputfile, outdir) |
|
|
|
expected_outputs = rstrip.(( |
|
|
|
expected_outputs = rstrip.( |
|
|
|
|
|
|
|
[ |
|
|
|
""" |
|
|
|
""" |
|
|
|
"cells": [ |
|
|
|
"cells": [ |
|
|
|
""", |
|
|
|
""", |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
""" |
|
|
|
"data": { |
|
|
|
"data": { |
|
|
|
"text/plain": "3" |
|
|
|
"text/plain": "3" |
|
|
|
}, |
|
|
|
}, |
|
|
|
""", |
|
|
|
""", |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
""" |
|
|
|
"text": [ |
|
|
|
"text": [ |
|
|
|
"12345678910" |
|
|
|
"12345678910" |
|
|
|
] |
|
|
|
] |
|
|
|
""")) |
|
|
|
""", |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
notebook = read(joinpath(outdir, "inputfile.ipynb"), String) |
|
|
|
notebook = read(joinpath(outdir, "inputfile.ipynb"), String) |
|
|
|
|
|
|
|
|
|
|
|
@ -1321,12 +1345,14 @@ end end |
|
|
|
|
|
|
|
|
|
|
|
# test error when executing notebook |
|
|
|
# test error when executing notebook |
|
|
|
write(inputfile, "for i in 1:10\n println(i)") |
|
|
|
write(inputfile, "for i in 1:10\n println(i)") |
|
|
|
r = @test_logs((:error, r"error when executing notebook based on input file: "), match_mode=:any, |
|
|
|
r = @test_logs( |
|
|
|
|
|
|
|
(:error, r"error when executing notebook based on input file: "), match_mode = :any, |
|
|
|
try |
|
|
|
try |
|
|
|
Literate.notebook(inputfile, outdir) |
|
|
|
Literate.notebook(inputfile, outdir) |
|
|
|
catch err |
|
|
|
catch err |
|
|
|
err |
|
|
|
err |
|
|
|
end) |
|
|
|
end |
|
|
|
|
|
|
|
) |
|
|
|
@test isa(r, ErrorException) |
|
|
|
@test isa(r, ErrorException) |
|
|
|
@test occursin("when executing the following code block from inputfile ", r.msg) |
|
|
|
@test occursin("when executing the following code block from inputfile ", r.msg) |
|
|
|
@test occursin(inputfile, r.msg) |
|
|
|
@test occursin(inputfile, r.msg) |
|
|
|
@ -1340,7 +1366,9 @@ end end |
|
|
|
@test isfile("inputfile.ipynb") |
|
|
|
@test isfile("inputfile.ipynb") |
|
|
|
|
|
|
|
|
|
|
|
# world time problem with `IJulia.display_dict` |
|
|
|
# world time problem with `IJulia.display_dict` |
|
|
|
write(inputfile, """ |
|
|
|
write( |
|
|
|
|
|
|
|
inputfile, |
|
|
|
|
|
|
|
""" |
|
|
|
struct VegaLiteRenderable end |
|
|
|
struct VegaLiteRenderable end |
|
|
|
Base.show(io::IO, ::MIME"application/vnd.vegalite.v2+json", ::VegaLiteRenderable) = |
|
|
|
Base.show(io::IO, ::MIME"application/vnd.vegalite.v2+json", ::VegaLiteRenderable) = |
|
|
|
write(io, \"\"\" |
|
|
|
write(io, \"\"\" |
|
|
|
@ -1348,7 +1376,8 @@ end end |
|
|
|
\"\"\") |
|
|
|
\"\"\") |
|
|
|
Base.Multimedia.istextmime(::MIME{Symbol("application/vnd.vegalite.v2+json")}) = true |
|
|
|
Base.Multimedia.istextmime(::MIME{Symbol("application/vnd.vegalite.v2+json")}) = true |
|
|
|
VegaLiteRenderable() |
|
|
|
VegaLiteRenderable() |
|
|
|
""") |
|
|
|
""" |
|
|
|
|
|
|
|
) |
|
|
|
Literate.notebook(inputfile, outdir) |
|
|
|
Literate.notebook(inputfile, outdir) |
|
|
|
notebook = read(joinpath(outdir, "inputfile.ipynb"), String) |
|
|
|
notebook = read(joinpath(outdir, "inputfile.ipynb"), String) |
|
|
|
@test occursin("\"application/vnd.vegalite.v2+json\":", notebook) |
|
|
|
@test occursin("\"application/vnd.vegalite.v2+json\":", notebook) |
|
|
|
@ -1455,9 +1484,8 @@ end end |
|
|
|
catch err |
|
|
|
catch err |
|
|
|
@test occursin(r"`?ret`? not defined", sprint(Base.showerror, err)) |
|
|
|
@test occursin(r"`?ret`? not defined", sprint(Base.showerror, err)) |
|
|
|
end |
|
|
|
end |
|
|
|
end # cd(sandbox) |
|
|
|
end |
|
|
|
end # mktempdir |
|
|
|
end |
|
|
|
end end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@testset "continue_on_error=true" begin |
|
|
|
@testset "continue_on_error=true" begin |
|
|
|
input_with_error = |
|
|
|
input_with_error = |
|
|
|
@ -1529,9 +1557,8 @@ end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
@testset "Configuration" begin; Base.CoreLogging.with_logger(Base.CoreLogging.NullLogger()) do |
|
|
|
@testset "Configuration" begin |
|
|
|
mktempdir(@__DIR__) do sandbox |
|
|
|
with_nullogger_tempdir_cd() do |
|
|
|
cd(sandbox) do |
|
|
|
|
|
|
|
# write content to inputfile |
|
|
|
# write content to inputfile |
|
|
|
inputfile = "inputfile.jl" |
|
|
|
inputfile = "inputfile.jl" |
|
|
|
write(inputfile, content) |
|
|
|
write(inputfile, content) |
|
|
|
@ -1544,10 +1571,10 @@ end |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
# Overwriting of URLs |
|
|
|
# Overwriting of URLs |
|
|
|
withenv("TRAVIS_REPO_SLUG" => "fredrikekre/Literate.jl", |
|
|
|
withenv( |
|
|
|
"TRAVIS_TAG" => "", |
|
|
|
"TRAVIS_REPO_SLUG" => "fredrikekre/Literate.jl", "TRAVIS_TAG" => "", |
|
|
|
"TRAVIS_PULL_REQUEST" => "false", |
|
|
|
"TRAVIS_PULL_REQUEST" => "false", "HAS_JOSH_K_SEAL_OF_APPROVAL" => "true" |
|
|
|
"HAS_JOSH_K_SEAL_OF_APPROVAL" => "true") do |
|
|
|
) do |
|
|
|
Literate.script(inputfile, outdir; config = config) |
|
|
|
Literate.script(inputfile, outdir; config = config) |
|
|
|
end |
|
|
|
end |
|
|
|
script = read(joinpath(outdir, "inputfile.jl"), String) |
|
|
|
script = read(joinpath(outdir, "inputfile.jl"), String) |
|
|
|
@ -1575,4 +1602,3 @@ end |
|
|
|
@test cfg["codefence"] == ("````@example inputfile" => "````") |
|
|
|
@test cfg["codefence"] == ("````@example inputfile" => "````") |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end end |
|
|
|
|
|
|
|
|