aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Readers/MediaWiki.hs16
-rw-r--r--test/command/2649.md109
2 files changed, 116 insertions, 9 deletions
diff --git a/src/Text/Pandoc/Readers/MediaWiki.hs b/src/Text/Pandoc/Readers/MediaWiki.hs
index f0d01136f..cdd1ce99f 100644
--- a/src/Text/Pandoc/Readers/MediaWiki.hs
+++ b/src/Text/Pandoc/Readers/MediaWiki.hs
@@ -219,7 +219,9 @@ para = do
table :: PandocMonad m => MWParser m Blocks
table = do
tableStart
- styles <- option [] parseAttrs <* blanklines
+ styles <- option [] parseAttrs
+ skipMany spaceChar
+ optional blanklines
let tableWidth = case lookup "width" styles of
Just w -> fromMaybe 1.0 $ parseWidth w
Nothing -> 1.0
@@ -267,14 +269,10 @@ rowsep = try $ guardColumnOne *> skipSpaces *> sym "|-" <*
many (char '-') <* optional parseAttr <* blanklines
cellsep :: PandocMonad m => MWParser m ()
-cellsep = try $
- (guardColumnOne *> skipSpaces <*
- ( (char '|' <* notFollowedBy (oneOf "-}+"))
- <|> (char '!')
- )
- )
- <|> (() <$ try (string "||"))
- <|> (() <$ try (string "!!"))
+cellsep = try $ do
+ skipSpaces
+ (char '|' *> notFollowedBy (oneOf "-}+") *> optional (char '|'))
+ <|> (char '!' *> optional (char '!'))
tableCaption :: PandocMonad m => MWParser m Inlines
tableCaption = try $ do
diff --git a/test/command/2649.md b/test/command/2649.md
new file mode 100644
index 000000000..af84693c4
--- /dev/null
+++ b/test/command/2649.md
@@ -0,0 +1,109 @@
+```
+% pandoc -f mediawiki -t html5
+{| class="wikitable" style="line-height: 1.0"
+
+|- bgcolor="#efefef"
+|}
+^D
+<table>
+<tbody>
+<tr class="odd">
+</tr>
+</tbody>
+</table>
+```
+
+```
+% pandoc -f mediawiki -t html5
+{| border="4" cellspacing="2" cellpadding="0" WIDTH="100%"
+|-----
+| peildatum Simbase || november 2005 || '''uitslagen Flohrgambiet''' ||
+|-----
+| totaal aantal partijen Simbase || 7.316.773
+| wit wint || 53%
+|-----
+| percentage (en partijen) Flohrgambiet
+| 0.023 % (1.699) || zwart wint || 27%
+|-----
+| percentage Flohrgambiet in aug 2003
+| 0.035 % || remise || 20%
+|}
+^D
+<table>
+<tbody>
+<tr class="odd">
+<td><p>peildatum Simbase</p></td>
+<td><p>november 2005</p></td>
+<td><p><strong>uitslagen Flohrgambiet</strong></p></td>
+<td></td>
+</tr>
+<tr class="even">
+<td><p>totaal aantal partijen Simbase</p></td>
+<td><p>7.316.773</p></td>
+<td><p>wit wint</p></td>
+<td><p>53%</p></td>
+</tr>
+<tr class="odd">
+<td><p>percentage (en partijen) Flohrgambiet</p></td>
+<td><p>0.023 % (1.699)</p></td>
+<td><p>zwart wint</p></td>
+<td><p>27%</p></td>
+</tr>
+<tr class="even">
+<td><p>percentage Flohrgambiet in aug 2003</p></td>
+<td><p>0.035 %</p></td>
+<td><p>remise</p></td>
+<td><p>20%</p></td>
+</tr>
+</tbody>
+</table>
+```
+
+```
+% pandoc -f mediawiki -t html5
+{| class="wikitable" style="text-align:center; font-size:95%" valign="top" |
+! Plaats
+! Rijder
+! Aantal
+|-
+| 1
+|align=left| {{FR-VLAG}} [[Sébastien Loeb]] | 78
+|-
+| 2
+|align=left| {{FR-VLAG}} '''[[Sébastien Ogier]]'''
+| 38
+|-
+| 10
+|align=left| {{FI-VLAG}} [[Hannu Mikkola]]
+| 18
+|}
+^D
+<table>
+<tbody>
+<tr class="odd">
+<td></td>
+<td><p>Plaats</p></td>
+<td><p>Rijder</p></td>
+<td><p>Aantal</p></td>
+</tr>
+<tr class="even">
+<td><p>1</p></td>
+<td>
+<p><a href="Sébastien_Loeb" title="wikilink">Sébastien Loeb</a></p></td>
+<td><p>78</p></td>
+</tr>
+<tr class="odd">
+<td><p>2</p></td>
+<td>
+<p><strong><a href="Sébastien_Ogier" title="wikilink">Sébastien Ogier</a></strong></p></td>
+<td><p>38</p></td>
+</tr>
+<tr class="even">
+<td><p>10</p></td>
+<td>
+<p><a href="Hannu_Mikkola" title="wikilink">Hannu Mikkola</a></p></td>
+<td><p>18</p></td>
+</tr>
+</tbody>
+</table>
+```