aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2016-05-09 09:37:12 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2016-05-09 09:37:12 -0700
commitc1b19b17c4853bb0113a340c54a1726b7e31e1a8 (patch)
treed63195836424d99e76c98727ff9aa872c7ceacef
parent21d1a3b57cc37cc8c13eaf24faf0743259afdb9a (diff)
parentacd492c7f49e31f65ec044ce3ba66ffb80844e27 (diff)
downloadpandoc-c1b19b17c4853bb0113a340c54a1726b7e31e1a8.tar.gz
Merge pull request #2906 from roblabla/feature-mediaWikiTableHeaderSpaces
Allow spaces before '!' in MediaWiki table header
-rw-r--r--src/Text/Pandoc/Readers/MediaWiki.hs2
-rw-r--r--tests/mediawiki-reader.native5
-rw-r--r--tests/mediawiki-reader.wiki8
3 files changed, 14 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/MediaWiki.hs b/src/Text/Pandoc/Readers/MediaWiki.hs
index 950497992..d3cee08e2 100644
--- a/src/Text/Pandoc/Readers/MediaWiki.hs
+++ b/src/Text/Pandoc/Readers/MediaWiki.hs
@@ -225,7 +225,7 @@ table = do
Nothing -> 1.0
caption <- option mempty tableCaption
optional rowsep
- hasheader <- option False $ True <$ (lookAhead (char '!'))
+ hasheader <- option False $ True <$ (lookAhead (skipSpaces *> char '!'))
(cellspecs',hdr) <- unzip <$> tableRow
let widths = map ((tableWidth *) . snd) cellspecs'
let restwidth = tableWidth - sum widths
diff --git a/tests/mediawiki-reader.native b/tests/mediawiki-reader.native
index cf80d0664..6afeb602c 100644
--- a/tests/mediawiki-reader.native
+++ b/tests/mediawiki-reader.native
@@ -252,6 +252,11 @@ Pandoc (Meta {unMeta = fromList []})
[[]]
[[[Para [Str "Orange"]]]]
,Para [Str "Paragraph",Space,Str "after",Space,Str "the",Space,Str "table."]
+,Table [] [AlignDefault,AlignDefault] [0.0,0.0]
+ [[Para [Str "fruit"]]
+ ,[Para [Str "topping"]]]
+ [[[Para [Str "apple"]]
+ ,[Para [Str "ice",Space,Str "cream"]]]]
,Header 2 ("notes",[],[]) [Str "notes"]
,Para [Str "My",Space,Str "note!",Note [Plain [Str "This."]]]
,Para [Str "URL",Space,Str "note.",Note [Plain [Link ("",[],[]) [Str "http://docs.python.org/library/functions.html#range"] ("http://docs.python.org/library/functions.html#range","")]]]]
diff --git a/tests/mediawiki-reader.wiki b/tests/mediawiki-reader.wiki
index 862bb3b48..11cd52d9c 100644
--- a/tests/mediawiki-reader.wiki
+++ b/tests/mediawiki-reader.wiki
@@ -381,6 +381,14 @@ and cheese
|Orange
|}Paragraph after the table.
+{|
+ !fruit
+ !topping
+ |-
+ |apple
+ |ice cream
+ |}
+
== notes ==
My note!<ref>This.</ref>