git.iko.soy/typeable/pandoc
on master help sign in
Merge pull request #1068 from jaimeMF/mw-images-langs
b9cc29eJohn MacFarlane
src/Text/Pandoc/Readers/MediaWiki.hs+5−1
@@ -555,10 +555,14 @@ endline = () <$ try (newline <*
555 notFollowedBy' header <*
555 notFollowedBy' header <*
556 notFollowedBy anyListStart)
556 notFollowedBy anyListStart)
557
557
558+imageIdentifiers :: [MWParser ()]
559+imageIdentifiers = [sym (identifier ++ ":") | identifier <- identifiers]
560+ where identifiers = ["File", "Image", "Archivo", "Datei", "Fichier"]
561+
558image :: MWParser Inlines
562image :: MWParser Inlines
559image = try $ do
563image = try $ do
560 sym "[["
564 sym "[["
561− sym "File:" <|> sym "Image:"
565+ choice imageIdentifiers
562 fname <- many1 (noneOf "|]")
566 fname <- many1 (noneOf "|]")
563 _ <- many (try $ char '|' *> imageOption)
567 _ <- many (try $ char '|' *> imageOption)
564 caption <- (B.str fname <$ sym "]]")
568 caption <- (B.str fname <$ sym "]]")
tests/mediawiki-reader.native+1
@@ -88,6 +88,7 @@ Pandoc (Meta {unMeta = fromList []})
88,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")]
88,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")]
89,Para [Image [Str "caption"] ("example.jpg","fig:caption")]
89,Para [Image [Str "caption"] ("example.jpg","fig:caption")]
90,Para [Image [Str "example.jpg"] ("example.jpg","fig:example.jpg")]
90,Para [Image [Str "example.jpg"] ("example.jpg","fig:example.jpg")]
91+,Para [Image [Str "example_es.jpg"] ("example_es.jpg","fig:example_es.jpg")]
91,Header 2 ("lists",[],[]) [Str "lists"]
92,Header 2 ("lists",[],[]) [Str "lists"]
92,BulletList
93,BulletList
93 [[Plain [Str "Start",Space,Str "each",Space,Str "line"]]
94 [[Plain [Str "Start",Space,Str "each",Space,Str "line"]]
tests/mediawiki-reader.wiki+2
@@ -173,6 +173,8 @@ http://johnmacfarlane.net/pandoc/
173
173
174[[File:example.jpg]]
174[[File:example.jpg]]
175
175
176+[[Archivo:example_es.jpg]]
177+
176== lists ==
178== lists ==
177
179
178* Start each line
180* Start each line