Merge branch 'dfk/pandoc-crossref' of https://github.com/kleinschmidt/Weave.jl into kleinschmidt-dfk/pandoc-crossref

pull/137/head
Matti Pastell 2018-07-27 01:02:43 +03:00
commit 5c803db6ae
1 changed files with 8 additions and 5 deletions

View File

@ -371,7 +371,10 @@ end
function formatfigures(chunk, docformat::Pandoc) function formatfigures(chunk, docformat::Pandoc)
fignames = chunk.figures fignames = chunk.figures
length(fignames) > 0 || (return "")
caption = chunk.options[:fig_cap] caption = chunk.options[:fig_cap]
label = get(chunk.options, :label, nothing)
result = "" result = ""
figstring = "" figstring = ""
attribs = "" attribs = ""
@ -379,11 +382,11 @@ function formatfigures(chunk, docformat::Pandoc)
height = chunk.options[:out_height] height = chunk.options[:out_height]
#Build figure attibutes #Build figure attibutes
width == nothing || (attribs = "width=$width") attribs = String[]
(attribs "" && height nothing ) && (attribs *= " ") width == nothing || push!(attribs, "width=$width")
height == nothing || (attribs *= "height=$height") height == nothing || push!(attribs, "height=$height")
attribs == "" || (attribs = "{$attribs}") label == nothing || push!(attribs, "#fig:$label")
length(fignames) > 0 || (return "") attribs = isempty(attribs) ? "" : "{" * join(attribs, " ") * "}"
if caption != nothing if caption != nothing
result *= "![$caption]($(fignames[1]))$attribs\n" result *= "![$caption]($(fignames[1]))$attribs\n"