aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2024-02-07 08:28:29 -0800
committerJohn MacFarlane <[email protected]>2024-02-07 08:28:29 -0800
commitc46bf5948c3fd6fa429cb576e28b8e8ccadbf883 (patch)
tree60a14e8e95ae50cdd2804cd997ab76f5961392ec
parente81a60fdf2021ddc97e2a50e67dd068a27e603fe (diff)
MediaWiki reader: allow lowercase `image:`.
Closes #9424.
-rw-r--r--src/Text/Pandoc/Readers/MediaWiki.hs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Readers/MediaWiki.hs b/src/Text/Pandoc/Readers/MediaWiki.hs
index 0fe95004d..2ed0dd7f9 100644
--- a/src/Text/Pandoc/Readers/MediaWiki.hs
+++ b/src/Text/Pandoc/Readers/MediaWiki.hs
@@ -618,15 +618,16 @@ endline = () <$ try (newline <*
notFollowedBy' header <*
notFollowedBy anyListStart)
-imageIdentifiers :: PandocMonad m => [MWParser m ()]
-imageIdentifiers = [sym (identifier <> ":") | identifier <- identifiers]
- where identifiers = ["File", "Image", "Archivo", "Datei", "Fichier",
- "Bild"]
+imageIdentifier :: PandocMonad m => MWParser m ()
+imageIdentifier = try $ do
+ ident <- T.pack <$> many1Till letter (char ':')
+ guard $ T.toLower ident `elem`
+ ["file", "image", "archivo", "datei", "fichier", "bild"]
image :: PandocMonad m => MWParser m Inlines
image = try $ do
sym "[["
- choice imageIdentifiers
+ imageIdentifier
fname <- addUnderscores <$> many1Char (noneOf "|]")
_ <- many imageOption
dims <- try (char '|' *> sepBy (manyChar digit) (char 'x') <* string "px")