From acd492c7f49e31f65ec044ce3ba66ffb80844e27 Mon Sep 17 00:00:00 2001 From: roblabla Date: Mon, 9 May 2016 15:22:02 +0200 Subject: Allow spaces before '!' in MediaWiki table header --- src/Text/Pandoc/Readers/MediaWiki.hs | 2 +- tests/mediawiki-reader.native | 5 +++++ tests/mediawiki-reader.wiki | 8 ++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) 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!This. -- cgit v1.2.3