MediaWiki reader: Accept image links in more languages

In some of the Wikipedia versions the local version of 'File' is used (for example 'Archivo' in Spanish)
This commit is contained in:
Jaime Marquínez Ferrándiz 2013-11-24 12:51:41 +01:00
parent e1a9a61774
commit 303e42a94f
3 changed files with 8 additions and 1 deletions

View file

@ -549,10 +549,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 "]]")

View file

@ -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"]]

View file

@ -173,6 +173,8 @@ http://johnmacfarlane.net/pandoc/
[[File:example.jpg]]
[[Archivo:example_es.jpg]]
== lists ==
* Start each line