mirror of https://github.com/mpastell/Weave.jl
Added command line script for weaving: bin/weave.jl. Closes #19
parent
cb60eee6f8
commit
9b620e4a67
|
@ -0,0 +1,59 @@
|
|||
#!/usr/bin/env julia
|
||||
|
||||
|
||||
using Weave
|
||||
using ArgParse
|
||||
|
||||
ap = ArgParseSettings("Weave Julia documents using Weave.jl",
|
||||
version = string(Pkg.installed("Weave")),
|
||||
add_version = true)
|
||||
|
||||
@add_arg_table ap begin
|
||||
"source"
|
||||
nargs = '+'
|
||||
help = "source document"
|
||||
required = true
|
||||
"--doctype"
|
||||
arg_type = String
|
||||
default = "pandoc"
|
||||
help = "output format"
|
||||
"--plotlib"
|
||||
arg_type = String
|
||||
default = "Gadfly"
|
||||
help = "output format"
|
||||
"--informat"
|
||||
arg_type = String
|
||||
default = "noweb"
|
||||
help = "output format"
|
||||
"--out_path"
|
||||
arg_type = String
|
||||
default = ":doc"
|
||||
help = "output directory"
|
||||
"--fig_path"
|
||||
arg_type = String
|
||||
default = "figures"
|
||||
help = "figure output directory"
|
||||
"--fig_ext"
|
||||
default = nothing
|
||||
help = "figure file format"
|
||||
end
|
||||
|
||||
args = ArgParse.parse_args(ap)
|
||||
source = args["source"]
|
||||
delete!(args, "source")
|
||||
args_col = {}
|
||||
|
||||
#Check for special values of out_path
|
||||
if args["out_path"] == ":doc"
|
||||
args["out_path"] = :doc
|
||||
elseif args["out_path"] == ":pwd"
|
||||
args["out_path"] = :pwd
|
||||
end
|
||||
|
||||
for (key, val) in args
|
||||
push!(args_col, (parse(key), val))
|
||||
end
|
||||
|
||||
for s=source
|
||||
weave(s; args_col...)
|
||||
end
|
|
@ -50,8 +50,6 @@ end
|
|||
|
||||
function weave(source ; doctype = "pandoc", plotlib="Gadfly", informat="noweb", out_path=:doc, fig_path = "figures", fig_ext = nothing)
|
||||
|
||||
|
||||
|
||||
cwd, fname = splitdir(abspath(source))
|
||||
basename = splitext(fname)[1]
|
||||
formatdict = formats[doctype].formatdict
|
||||
|
|
Loading…
Reference in New Issue