git.iko.soy/typeable/pandoc
on master help sign in
sample.lua - define CaptionedImage, add newline at end.

Cloess #2393.

commitf2f35224f614199ac5fc26be84bba093a92ba984 authorJohn MacFarlane <jgm@berkeley.edu> dateTue 15 Sep 2015, 09:27 (11 years ago) parent6dcfa7e
1 file changed+7−1
data/sample.lua+7−1
data/sample.lua+7−1
@@ -84,7 +84,7 @@ function Doc(body, metadata, variables)
8484 end
8585 add('</ol>')
8686 end
87− return table.concat(buffer,'\n')
87+ return table.concat(buffer,'\n') .. '\n'
8888end
8989
9090-- The functions that follow render corresponding pandoc elements.
@@ -251,6 +251,12 @@ function html_align(align)
251251 end
252252end
253253
254+function CaptionedImage(src, tit, caption)
255+ return '<div class="figure">\n<img src="' .. escape(src,true) ..
256+ '" title="' .. escape(tit,true) .. '"/>\n' ..
257+ '<p class="caption">' .. caption .. '</p>\n</div>'
258+end
259+
254260-- Caption is a string, aligns is an array of strings,
255261-- widths is an array of floats, headers is an array of
256262-- strings, rows is an array of arrays of strings.