aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Readers/MediaWiki.hs4
-rw-r--r--tests/mediawiki-reader.native13
-rw-r--r--tests/mediawiki-reader.wiki20
3 files changed, 36 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/MediaWiki.hs b/src/Text/Pandoc/Readers/MediaWiki.hs
index 38ffed835..7936be38b 100644
--- a/src/Text/Pandoc/Readers/MediaWiki.hs
+++ b/src/Text/Pandoc/Readers/MediaWiki.hs
@@ -30,6 +30,7 @@ Conversion of mediawiki text to 'Pandoc' document.
-}
{-
TODO:
+_ correctly handle tables within tables
_ parse templates?
-}
module Text.Pandoc.Readers.MediaWiki ( readMediaWiki ) where
@@ -255,7 +256,8 @@ tableCell = try $ do
attrs <- option [] $ try $ parseAttrs <$>
manyTill (satisfy (/='\n')) (char '|' <* notFollowedBy (char '|'))
skipMany spaceChar
- ls <- many (notFollowedBy (cellsep <|> rowsep <|> tableEnd) *> anyChar)
+ ls <- concat <$> many (notFollowedBy (cellsep <|> rowsep <|> tableEnd) *>
+ ((snd <$> withRaw table) <|> count 1 anyChar))
bs <- parseFromString (mconcat <$> many block) ls
let align = case lookup "align" attrs of
Just "left" -> AlignLeft
diff --git a/tests/mediawiki-reader.native b/tests/mediawiki-reader.native
index f556c698f..122b52545 100644
--- a/tests/mediawiki-reader.native
+++ b/tests/mediawiki-reader.native
@@ -224,5 +224,18 @@ Pandoc (Meta {docTitle = [], docAuthors = [], docDate = []})
,[[Para [Str "more"]]
,[Para [Str "2.0"]]
,[Para [Str "more"]]]]
+,Table [] [AlignDefault,AlignDefault] [0.0,0.0]
+ [[]
+ ,[]]
+ [[[Para [Str "Orange"]]
+ ,[Para [Str "Apple"]]]
+ ,[[Para [Str "Bread"]]
+ ,[Table [] [AlignDefault,AlignDefault] [0.0,0.0]
+ [[Para [Str "fruit"]]
+ ,[Para [Str "topping"]]]
+ [[[Para [Str "apple"]]
+ ,[Para [Str "ice",Space,Str "cream"]]]]]]
+ ,[[Para [Str "Butter"]]
+ ,[Para [Str "Ice",Space,Str "cream"]]]]
,Header 2 [Str "notes"]
,Para [Str "My",Space,Str "note!",Note [Plain [Str "This."]]]]
diff --git a/tests/mediawiki-reader.wiki b/tests/mediawiki-reader.wiki
index fc3015645..a9769594d 100644
--- a/tests/mediawiki-reader.wiki
+++ b/tests/mediawiki-reader.wiki
@@ -343,6 +343,26 @@ and cheese
| more || 2.0 || more
|}
+{|
+|-
+|Orange
+|Apple
+|-
+|Bread
+|
+{|
+!fruit
+!topping
+|-
+|apple
+|ice cream
+|}
+|-
+|Butter
+|Ice cream
+|}
+
+
== notes ==
My note!<ref>This.</ref>