aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-03-24 10:39:49 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-03-24 10:39:49 -0700
commitb9cc29e15ab219102f09e19d61889c256eb0b487 (patch)
treed70972e7fd86c9d71d9f5e9b450e7b41a0812228
parent3fa38db80b422af627ba260024756faf2a1d9147 (diff)
parent303e42a94f16e00ecb65fb9de2d282d050a626c1 (diff)
downloadpandoc-b9cc29e15ab219102f09e19d61889c256eb0b487.tar.gz
Merge pull request #1068 from jaimeMF/mw-images-langs
MediaWiki reader: Accept image links in more languages
-rw-r--r--src/Text/Pandoc/Readers/MediaWiki.hs6
-rw-r--r--tests/mediawiki-reader.native1
-rw-r--r--tests/mediawiki-reader.wiki2
3 files changed, 8 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/MediaWiki.hs b/src/Text/Pandoc/Readers/MediaWiki.hs
index 794890eb6..7ac2f33ba 100644
--- a/src/Text/Pandoc/Readers/MediaWiki.hs
+++ b/src/Text/Pandoc/Readers/MediaWiki.hs
@@ -555,10 +555,14 @@ endline = () <$ try (newline <*
notFollowedBy' header <*
notFollowedBy anyListStart)
+imageIdentifiers :: [MWParser ()]
+imageIdentifiers = [sym (identifier ++ ":") | identifier <- identifiers]
+ where identifiers = ["File", "Image", "Archivo", "Datei", "Fichier"]
+
image :: MWParser Inlines
image = try $ do
sym "[["
- sym "File:" <|> sym "Image:"
+ choice imageIdentifiers
fname <- many1 (noneOf "|]")
_ <- many (try $ char '|' *> imageOption)
caption <- (B.str fname <$ sym "]]")
diff --git a/tests/mediawiki-reader.native b/tests/mediawiki-reader.native
index 238413445..87e4043f7 100644
--- a/tests/mediawiki-reader.native
+++ b/tests/mediawiki-reader.native
@@ -88,6 +88,7 @@ Pandoc (Meta {unMeta = fromList []})
,Para [Image [Str "the",Space,Emph [Str "caption"],Space,Str "with",Space,Link [Str "external",Space,Str "link"] ("http://google.com","")] ("example.jpg","fig:the caption with external link")]
,Para [Image [Str "caption"] ("example.jpg","fig:caption")]
,Para [Image [Str "example.jpg"] ("example.jpg","fig:example.jpg")]
+,Para [Image [Str "example_es.jpg"] ("example_es.jpg","fig:example_es.jpg")]
,Header 2 ("lists",[],[]) [Str "lists"]
,BulletList
[[Plain [Str "Start",Space,Str "each",Space,Str "line"]]
diff --git a/tests/mediawiki-reader.wiki b/tests/mediawiki-reader.wiki
index c0c22bec6..641f98eb9 100644
--- a/tests/mediawiki-reader.wiki
+++ b/tests/mediawiki-reader.wiki
@@ -173,6 +173,8 @@ http://johnmacfarlane.net/pandoc/
[[File:example.jpg]]
+[[Archivo:example_es.jpg]]
+
== lists ==
* Start each line