Fix deprecations

pull/112/head
femtocleaner[bot] 2017-12-31 12:02:28 +00:00
parent 6a81c53af3
commit 2693389a3a
7 changed files with 34 additions and 56 deletions

View File

@ -1,9 +1,9 @@
using Compat
@compat abstract type WeaveChunk end
@compat abstract type Inline end
abstract type WeaveChunk end
abstract type Inline end
type WeaveDoc
mutable struct WeaveDoc
source::AbstractString
basename::AbstractString
path::AbstractString
@ -25,7 +25,7 @@ type WeaveDoc
end
end
immutable ChunkOutput
struct ChunkOutput
code::AbstractString
stdout::AbstractString
displayed::AbstractString
@ -33,7 +33,7 @@ immutable ChunkOutput
figures::Array{AbstractString}
end
type CodeChunk <: WeaveChunk
mutable struct CodeChunk <: WeaveChunk
content::AbstractString
number::Int
result_no::Int
@ -49,7 +49,7 @@ type CodeChunk <: WeaveChunk
end
end
type DocChunk <: WeaveChunk
mutable struct DocChunk <: WeaveChunk
content::Array{Inline}
number::Int
start_line::Int
@ -59,14 +59,14 @@ type DocChunk <: WeaveChunk
end
end
type InlineText <: Inline
mutable struct InlineText <: Inline
content::AbstractString
si::Int
ei::Int
number::Int
end
type InlineCode <: Inline
mutable struct InlineCode <: Inline
content::AbstractString
si::Int
ei::Int
@ -79,11 +79,11 @@ type InlineCode <: Inline
end
end
type TermResult
mutable struct TermResult
end
type ScriptResult
mutable struct ScriptResult
end
type CollectResult
mutable struct CollectResult
end

View File

@ -1,7 +1,7 @@
using Compat
#Contains report global properties
type Report <: Display
mutable struct Report <: Display
cwd::AbstractString
basename::AbstractString
formatdict::Dict{Symbol,Any}
@ -33,7 +33,7 @@ function Base.display(report::Report, data)
for m in report.mimetypes
if mimewritable(m, data)
try
@compat Compat.invokelatest(display, report, m, data)
Compat.invokelatest(display, report, m, data)
catch e
warn("Failed to display data in \"$m\" format")
continue

View File

@ -131,32 +131,10 @@ function format_chunk(chunk::DocChunk, formatdict, docformat::JMarkdown2HTML)
text = format_chunk(chunk, formatdict, nothing)
#invokelatest seems to be needed here
#to fix "invalid age range" on 0.6 #21653
m = @compat Compat.invokelatest(Base.Markdown.parse, text)
m = Compat.invokelatest(Base.Markdown.parse, text)
return string(Documenter.Writers.HTMLWriter.mdconvert(m))
end
if VERSION < v"0.6.0-dev.1965"
#Fixes to Base latex writer, included in JuliaLang/julia#19842 and JuliaLang/julia#19832.
function Base.Markdown.latex(io::IO, md::Base.Markdown.Paragraph)
println(io)
for md in md.content
Base.Markdown.latexinline(io, md)
end
println(io)
end
function wrapverb(f, io, cmd)
print(io, "\\", cmd, "|")
f()
print(io, "|")
end
function Base.Markdown.latexinline(io::IO, code::Base.Markdown.Code)
wrapverb(io, "verb") do
print(io, code.code)
end
end
end
function format_chunk(chunk::DocChunk, formatdict, docformat::JMarkdown2tex)

View File

@ -1,4 +1,4 @@
type Tex
mutable struct Tex
description::AbstractString
formatdict::Dict{Symbol,Any}
end
@ -36,7 +36,7 @@ const texminted = Tex("Latex using minted for highlighting",
:mimetypes => ["application/pdf", "image/png", "text/latex", "text/plain"]
))
type Pandoc
mutable struct Pandoc
description::AbstractString
formatdict::Dict{Symbol,Any}
end
@ -69,7 +69,7 @@ const pdoc2html = Pandoc("Markdown to HTML (requires Pandoc)",
"text/html", "text/markdown", "text/plain"],
:doctype=> "pandoc2html"))
type Markdown
mutable struct Markdown
description::AbstractString
formatdict::Dict{Symbol,Any}
end
@ -90,7 +90,7 @@ Formatter for Hugo: https://gohugo.io/
When `uglyURLs` is `false`, prepend figure path by `..`.
"""
immutable Hugo
struct Hugo
description::AbstractString
formatdict::Dict{Symbol,Any}
uglyURLs::Bool
@ -108,7 +108,7 @@ const hugo = Hugo("Hugo markdown (using shortcodes)",
false)
#Julia markdown
type JMarkdown2HTML
mutable struct JMarkdown2HTML
description::AbstractString
formatdict::Dict{Symbol,Any}
end
@ -125,7 +125,7 @@ const md2html = JMarkdown2HTML("Julia markdown to html", Dict{Symbol,Any}(
:doctype=> "md2html"))
#Julia markdown
type JMarkdown2tex
mutable struct JMarkdown2tex
description::AbstractString
formatdict::Dict{Symbol,Any}
end
@ -142,7 +142,7 @@ const md2tex = JMarkdown2tex("Julia markdown to latex", Dict{Symbol,Any}(
:doctype=> "md2tex"))
type MultiMarkdown
mutable struct MultiMarkdown
description::AbstractString
formatdict::Dict{Symbol,Any}
end
@ -201,7 +201,7 @@ const multimarkdown = MultiMarkdown("MultiMarkdown",
))
type Rest
mutable struct Rest
description::AbstractString
formatdict::Dict{Symbol,Any}
end
@ -219,7 +219,7 @@ const rst = Rest("reStructuredText and Sphinx",
:doctype => "rst"
))
type AsciiDoc
mutable struct AsciiDoc
description::AbstractString
formatdict::Dict{Symbol,Any}
end

View File

@ -2,13 +2,13 @@ import JSON, YAML
pushopt(options::Dict,expr::Expr) = Base.Meta.isexpr(expr,:(=)) && (options[expr.args[1]] = expr.args[2])
type MarkupInput
mutable struct MarkupInput
codestart::Regex
codeend::Regex
inline::Regex
end
type ScriptInput
mutable struct ScriptInput
doc_line::Regex
doc_start::Regex
opt_line::Regex
@ -16,7 +16,7 @@ type ScriptInput
inline::Regex
end
type NotebookInput
mutable struct NotebookInput
inline
end

View File

@ -212,7 +212,7 @@ function run_code(chunk::CodeChunk, report::Report, SandBox::Module)
#Save figures only in the end of chunk for PyPlot
if rcParams[:plotlib] == "PyPlot"
@compat Compat.invokelatest(savefigs_pyplot, report)
Compat.invokelatest(savefigs_pyplot, report)
end
return results
@ -279,7 +279,7 @@ function eval_chunk(chunk::CodeChunk, report::Report, SandBox::Module)
#Run preexecute_hooks
for hook in preexecute_hooks
chunk = @compat Compat.invokelatest(hook, chunk)
chunk = Compat.invokelatest(hook, chunk)
end
report.fignum = 1
@ -294,7 +294,7 @@ function eval_chunk(chunk::CodeChunk, report::Report, SandBox::Module)
#Run post_execute chunks
for hook in postexecute_hooks
chunk = @compat Compat.invokelatest(hook, chunk)
chunk = Compat.invokelatest(hook, chunk)
end
if chunk.options[:term]
@ -485,7 +485,7 @@ function detect_plotlib(chunk::CodeChunk)
if isdefined(:Plots)
init_plotting("Plots")
#Need to set size before plots are created
@compat Compat.invokelatest(plots_set_size, chunk)
Compat.invokelatest(plots_set_size, chunk)
return
end

View File

@ -1,15 +1,15 @@
import JSON
type NotebookOutput
mutable struct NotebookOutput
end
type MarkdownOutput
mutable struct MarkdownOutput
end
type NowebOutput
mutable struct NowebOutput
end
type ScriptOutput
mutable struct ScriptOutput
end
const output_formats = Dict{String, Any}(