@@ -71,6 +71,8 @@ linkName = "Link"
7171
7272-- block element names (appear in InDesign's paragraph styles pane)
7373paragraphName :: String
74+figureName :: String
75+imgCaptionName :: String
7476codeBlockName :: String
7577blockQuoteName :: String
7678orderedListName :: String
@@ -94,6 +96,8 @@ subListParName :: String
9496footnoteName :: String
9597citeName :: String
9698paragraphName = "Paragraph"
99+figureName = "Figure"
100+imgCaptionName = "Caption"
97101codeBlockName = "CodeBlock"
98102blockQuoteName = "Blockquote"
99103orderedListName = "NumList"
@@ -285,6 +289,11 @@ blocksToICML opts style lst = vcat `fmap` mapM (blockToICML opts style) lst
285289-- | Convert a Pandoc block element to ICML.
286290blockToICML :: WriterOptions -> Style -> Block -> WS Doc
287291blockToICML opts style (Plain lst) = parStyle opts style lst
292+-- title beginning with fig: indicates that the image is a figure
293+blockToICML opts style (Para img@[Image _ txt (_,'f':'i':'g':':':_)]) = do
294+ figure <- parStyle opts (figureName:style) img
295+ caption <- parStyle opts (imgCaptionName:style) txt
296+ return $ figure $$ caption
288297blockToICML opts style (Para lst) = parStyle opts (paragraphName:style) lst
289298blockToICML opts style (CodeBlock _ str) = parStyle opts (codeBlockName:style) $ [Str str]
290299blockToICML _ _ (RawBlock f str)
@@ -434,7 +443,7 @@ inlineToICML opts style (Link _ lst (url, title)) = do
434443 cont = inTags True "HyperlinkTextSource"
435444 [("Self","htss-"++show ident), ("Name",title), ("Hidden","false")] content
436445 in (cont, newst)
437−inlineToICML opts style (Image attr alt target) = imageICML opts style attr alt target
446+inlineToICML opts style (Image attr _ target) = imageICML opts style attr target
438447inlineToICML opts style (Note lst) = footnoteToICML opts style lst
439448inlineToICML opts style (Span _ lst) = inlinesToICML opts style lst
440449
@@ -513,8 +522,8 @@ styleToStrAttr style =
513522 in (stlStr, attrs)
514523
515524-- | Assemble an ICML Image.
516−imageICML :: WriterOptions -> Style -> Attr -> [Inline] -> Target -> WS Doc
517−imageICML opts style attr _ (src, _) = do
525+imageICML :: WriterOptions -> Style -> Attr -> Target -> WS Doc
526+imageICML opts style attr (src, _) = do
518527 res <- liftIO $ fetchItem (writerSourceURL opts) src
519528 imgS <- case res of
520529 Left (_) -> do