Skip to content

Commit 7cd9a6f

Browse files
committed
Use simpleFigureWith in MediaWiki reader.
1 parent 3282ded commit 7cd9a6f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Text/Pandoc/Readers/MediaWiki.hs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,12 @@ para = do
201201
contents <- trimInlines . mconcat <$> many1 inline
202202
if F.all (==Space) contents
203203
then return mempty
204-
else return $ B.para contents
204+
else case B.toList contents of
205+
-- For the MediaWiki format all images are considered figures
206+
[Image attr figureCaption (src, title)] ->
207+
return $ B.simpleFigureWith
208+
attr (B.fromList figureCaption) src title
209+
_ -> return $ B.para contents
205210

206211
table :: PandocMonad m => MWParser m Blocks
207212
table = do
@@ -631,7 +636,7 @@ image = try $ do
631636
let attr = ("", [], kvs)
632637
caption <- (B.str fname <$ sym "]]")
633638
<|> try (char '|' *> (mconcat <$> manyTill inline (sym "]]")))
634-
return $ B.imageWith attr fname ("fig:" <> stringify caption) caption
639+
return $ B.imageWith attr fname (stringify caption) caption
635640

636641
imageOption :: PandocMonad m => MWParser m Text
637642
imageOption = try $ char '|' *> opt

0 commit comments

Comments
 (0)