From 6ff3bee3e8290544d4b5dcfc952db5c1f36c9284 Mon Sep 17 00:00:00 2001 From: Dave Kleinschmidt Date: Mon, 21 May 2018 15:20:15 -0400 Subject: [PATCH] handle empty attribs --- src/formatters.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/formatters.jl b/src/formatters.jl index 197d2e3..0e99e82 100644 --- a/src/formatters.jl +++ b/src/formatters.jl @@ -384,17 +384,17 @@ function formatfigures(chunk, docformat::Pandoc) width == nothing || push!(attribs, "width=$width") height == nothing || push!(attribs, "height=$height") label == nothing || push!(attribs, "#fig:$label") - attribs = join(attribs, " ") + attribs = isempty(attribs) ? "" : "{" * join(attribs, " ") * "}" if caption != nothing - result *= "![$caption]($(fignames[1])){$attribs}\n" + result *= "![$caption]($(fignames[1]))$attribs\n" for fig = fignames[2:end] - result *= "![]($fig){$attribs}\n" + result *= "![]($fig)$attribs\n" println("Warning, only the first figure gets a caption\n") end else for fig in fignames - result *= "![]($fig){$attribs}\\ \n\n" + result *= "![]($fig)$attribs\\ \n\n" end end return result