Skip to content

Commit 35899b4

Browse files
committed
Default handling of Figures as Div.
1 parent f8fe2b6 commit 35899b4

File tree

5 files changed

+7
-4
lines changed

5 files changed

+7
-4
lines changed

src/Text/Pandoc/Readers/HTML.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,11 +566,10 @@ pFigure = try $ do
566566
pNativeFigure :: PandocMonad m => TagParser m Blocks
567567
pNativeFigure = try $ do
568568
TagOpen tag attrList <- lookAhead $ pSatisfy (matchTagOpen "figure" [])
569-
--let (ident, classes, kvs) = toAttr attr
570569
contents <- pInTags tag (many $ Left <$> pInTags "figcaption" block <|> (Right <$> block))
571570

572571
let (captions, rest) = partitionEithers contents
573-
-- I should capture the caption
572+
-- It concatenates all captions together
574573
return $ B.figureWith (toAttr attrList) (Caption Nothing (B.toList (mconcat captions))) $ mconcat rest
575574

576575
pCodeBlock :: PandocMonad m => TagParser m Blocks

src/Text/Pandoc/Writers/Muse.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ blockToMuse (Table _ blkCapt specs thead tbody tfoot) =
276276
isSimple = onlySimpleTableCells (headers : rows) && all (== 0) widths
277277
blockToMuse (Div _ bs) = flatBlockListToMuse bs
278278
blockToMuse Null = return empty
279-
blockToMuse (Figure {}) = return empty
279+
blockToMuse (Figure attr _ bs) = blockToMuse (Div attr bs)
280280

281281
-- | Return Muse representation of notes collected so far.
282282
currentNotesToMuse :: PandocMonad m

src/Text/Pandoc/Writers/TEI.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ blockToTEI _ HorizontalRule = return $
191191
selfClosingTag "milestone" [("unit","undefined")
192192
,("type","separator")
193193
,("rendition","line")]
194-
blockToTEI _ (Figure {}) = return empty
194+
blockToTEI opts (Figure attr _ bs) = blockToTEI opts (Div attr bs)
195195

196196
-- | TEI Tables
197197
-- TEI Simple's tables are composed of cells and rows; other

src/Text/Pandoc/Writers/Texinfo.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,8 @@ blockToTexinfo (Figure _ (Caption _ caption) body) = do
283283
else inCmd "caption" captionText
284284
) $$ text "@end float"
285285
where
286+
-- floatType according to
287+
-- https://www.gnu.org/software/texinfo/manual/texinfo/html_node/_0040float.html
286288
floatType [SimpleFigure {}] = " Figure"
287289
floatType [Table {}] = " Table"
288290
floatType _ = ""

src/Text/Pandoc/Writers/XWiki.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ blockToXWiki (DefinitionList items) = do
122122
contents <- local (\s -> s { listLevel = listLevel s <> ";" }) $ mapM definitionListItemToMediaWiki items
123123
return $ vcat contents <> if Text.null lev then "\n" else ""
124124

125+
-- Create a group according to
126+
-- https://www.xwiki.org/xwiki/bin/view/Documentation/UserGuide/Features/XWikiSyntax/?syntax=2.1&section=Groups
125127
blockToXWiki (Figure attr _ body) = do
126128
content <- blockToXWiki $ Div attr body
127129
return $ intercalate content ["(((\n", ")))"]

0 commit comments

Comments
 (0)