git.iko.soy/typeable/pandoc
on master help sign in
HTML writer: implemented image-with-caption feature.

git-svn-id: https://pandoc.googlecode.com/svn/trunk@1891 788f1e2b-df1e-0410-8736-df70ead52e1b

commitcb31c89eab45319348b5d8d79dbec5acef8a945b authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateTue 16 Mar 2010, 04:06 (17 years ago) parent766f2aa
2 files changed+9−2
src/Text/Pandoc/Writers/HTML.hs+5 tests/writer.html+4−2
src/Text/Pandoc/Writers/HTML.hs+5
@@ -260,6 +260,11 @@ obfuscateString = concatMap obfuscateChar . decodeCharacterReferences
260260blockToHtml :: WriterOptions -> Block -> State WriterState Html
261261blockToHtml _ Null = return $ noHtml
262262blockToHtml opts (Plain lst) = inlineListToHtml opts lst
263+blockToHtml opts (Para [Image txt (s,tit)]) = do
264+ img <- inlineToHtml opts (Image txt (s,tit))
265+ capt <- inlineListToHtml opts txt
266+ return $ thediv ! [theclass "figure"] <<
267+ [img, thediv ! [theclass "caption"] << capt]
263268blockToHtml opts (Para lst) = inlineListToHtml opts lst >>= (return . paragraph)
264269blockToHtml _ (RawHtml str) = return $ primHtml str
265270blockToHtml _ (HorizontalRule) = return $ hr
tests/writer.html+4−2
@@ -1156,9 +1156,11 @@ document.write('<a h'+'ref'+'="ma'+'ilto'+':'+e+'">'+'<code>'+e+'</code>'+'<\/'+
11561156 >Images</h1
11571157 ><p
11581158 >From “Voyage dans la Lune” by Georges Melies (1902):</p
1159− ><p
1159+ ><div class="figure"
11601160 ><img src="lalune.jpg" title="Voyage dans la Lune" alt="lalune"
1161− /></p
1161+ /><div class="caption"
1162+ >lalune</div
1163+ ></div
11621164 ><p
11631165 >Here is a movie <img src="movie.jpg" alt="movie"
11641166 /> icon.</p