Weave.jl/src/winston.jl

28 lines
914 B
Julia
Raw Normal View History

2014-12-04 15:14:07 +01:00
using Winston
function Base.display(report::Report, m::MIME"image/png", data)
2014-12-04 15:14:07 +01:00
chunk = report.cur_chunk
full_name, rel_name = get_figname(report, chunk)
docformat = formats[report.formatdict[:doctype]]
#Add to results for term chunks and store otherwise
if chunk[:term]
chunk[:figure] = [rel_name]
report.cur_result *= "\n" * report.formatdict[:codeend]
report.cur_result *= formatfigures(chunk, docformat)
2014-12-04 16:54:56 +01:00
report.cur_result *= "\n\n" * report.formatdict[:codestart] * "\n"
2014-12-04 15:14:07 +01:00
chunk[:figure] = String[]
else
push!(report.figures, rel_name)
end
#TODO get width and height from chunk options, after implementing Knitr compatible options
savefig(data, full_name, width=chunk[:fig_width]*chunk[:dpi], height=chunk[:fig_height]*chunk[:dpi])
2014-12-04 15:14:07 +01:00
report.fignum += 1
#out = open(full_name, "w")
#writemime(out, m, data)
#close(out)
2014-12-04 15:14:07 +01:00
end