Use @compat for new Dict syntax

pull/7/head
Douglas Bates 2014-12-01 12:31:44 -06:00
parent b6aa8289de
commit ba98eb4a62
4 changed files with 41 additions and 33 deletions

View File

@ -1 +1,2 @@
PyPlot
Compat

View File

@ -1,4 +1,5 @@
module JuliaReport
using Compat
using PyCall
using PyPlot
@pyimport pweave #Output formatting uses Pweave
@ -17,7 +18,7 @@ type Report
end
const report = Report("", false, "", "", {}, "", "")
const report = Report("", false, "", "", Any[], "", "")
function listformats()
pweave.listformats()
@ -150,6 +151,8 @@ end
export weave
typealias StrD Dict{ASCIIString,Any}
include("config.jl")
include("readers.jl")
end

View File

@ -1,26 +1,26 @@
const rcParams = {"figdir"=> "figures",
"usematplotlib"=> true,
"storeresults"=> false,
"cachedir"=> "cache",
"chunk"=>
{"defaultoptions"=>
{
"echo"=> true,
"results"=> "verbatim",
"fig"=> true,
"include"=> true,
"evaluate"=> true,
"caption"=> false,
"term"=> false,
"name"=> nothing,
"wrap"=> true,
"f_pos"=> "htpb",
"f_size"=> (8, 6),
"f_env"=> nothing,
"f_spines"=> true,
"complete"=> true,
"engine"=> "julia",
"option_string"=> ""
}
}
}
const rcParams =
@compat Dict{ASCIIString,Any}("figdir"=> "figures",
"usematplotlib"=> true,
"storeresults"=> false,
"cachedir"=> "cache",
"chunk"=>
Dict{ASCIIString,Any}("defaultoptions"=>
Dict{ASCIIString,Any}("echo"=> true,
"results"=> "verbatim",
"fig"=> true,
"include"=> true,
"evaluate"=> true,
"caption"=> false,
"term"=> false,
"name"=> nothing,
"wrap"=> true,
"f_pos"=> "htpb",
"f_size"=> (8, 6),
"f_env"=> nothing,
"f_spines"=> true,
"complete"=> true,
"engine"=> "julia",
"option_string"=> ""
)
)
)

View File

@ -22,19 +22,20 @@ function read_noweb(document)
optionstring=m.captures[1]
#println(m.captures[1])
if strip(optionstring)==""
options = Dict()
options = StrD()
else
try
options = eval(parse("{" * optionstring * "}"))
catch
options = Dict()
options = StrD()
warn(string("Invalid format for chunk options line: ", lineno))
end
end
haskey(options, "label") && (options["name"] = options["label"])
haskey(options, "name") || (options["name"] = nothing)
chunk = {"type" => "doc", "content"=> content, "number" => docno, "start_line"=>start_line}
chunk = @compat Dict{ASCIIString,Any}("type" => "doc", "content"=> content,
"number" => docno, "start_line"=>start_line)
docno += 1
start_line = lineno
push!(parsed, chunk)
@ -42,8 +43,10 @@ function read_noweb(document)
continue
end
if ismatch(codeend, line) && state=="code"
chunk = {"type" => "code", "content" => content, "number" => codeno,
"options"=>options,"optionstring"=>optionstring, "start_line"=>start_line}
chunk = @compat Dict{ASCIIString,Any}("type" => "code", "content" => content,
"number" => codeno, "options" => options,
"optionstring" => optionstring,
"start_line" => start_line)
codeno+=1
start_line = lineno
content = ""
@ -57,7 +60,8 @@ function read_noweb(document)
#Remember the last chunk
if content != ""
chunk = {"type" => "doc", "content"=> content, "number" => docno, "start_line"=>lineno}
chunk = @compat Dict{ASCIIString,Any}("type" => "doc", "content" => content,
"number" => docno, "start_line" => lineno)
push!(parsed, chunk)
end