diff options
author | John MacFarlane <jgm@berkeley.edu> | 2020-12-30 21:31:28 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2020-12-30 21:31:28 -0800 |
commit | 23f964b9076f9795b00e740d20feebeb1d6d91db (patch) | |
tree | e9abe0d2573917e13e159fb2888d6993ac3dbf20 | |
parent | 0782d5882c8c04fbdffcb7026457b3cc79150692 (diff) | |
download | pandoc-23f964b9076f9795b00e740d20feebeb1d6d91db.tar.gz |
Mediawiki reader: allow space around storng/emph delimiters.
Closes #6993.
-rw-r--r-- | src/Text/Pandoc/Readers/MediaWiki.hs | 10 | ||||
-rw-r--r-- | test/command/6993.md | 21 |
2 files changed, 25 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Readers/MediaWiki.hs b/src/Text/Pandoc/Readers/MediaWiki.hs index e8985ab2c..d712b1120 100644 --- a/src/Text/Pandoc/Readers/MediaWiki.hs +++ b/src/Text/Pandoc/Readers/MediaWiki.hs @@ -678,19 +678,17 @@ url = do -- | Parses a list of inlines between start and end delimiters. inlinesBetween :: (PandocMonad m, Show b) => MWParser m a -> MWParser m b -> MWParser m Inlines inlinesBetween start end = - trimInlines . mconcat <$> try (start >> many1Till inner end) - where inner = innerSpace <|> (notFollowedBy' (() <$ whitespace) >> inline) - innerSpace = try $ whitespace <* notFollowedBy' end + trimInlines . mconcat <$> try (start >> many1Till inline end) emph :: PandocMonad m => MWParser m Inlines emph = B.emph <$> nested (inlinesBetween start end) - where start = sym "''" >> lookAhead nonspaceChar + where start = sym "''" end = try $ notFollowedBy' (() <$ strong) >> sym "''" strong :: PandocMonad m => MWParser m Inlines strong = B.strong <$> nested (inlinesBetween start end) - where start = sym "'''" >> lookAhead nonspaceChar - end = try $ sym "'''" + where start = sym "'''" + end = sym "'''" doubleQuotes :: PandocMonad m => MWParser m Inlines doubleQuotes = do diff --git a/test/command/6993.md b/test/command/6993.md new file mode 100644 index 000000000..b7f7f5384 --- /dev/null +++ b/test/command/6993.md @@ -0,0 +1,21 @@ +``` +% pandoc -f mediawiki -t native +'''Should be bold ''' +^D +[Para [Strong [Str "Should",Space,Str "be",Space,Str "bold"]]] +``` + +``` +% pandoc -f mediawiki -t native +''' Should be bold''' +^D +[Para [Strong [Str "Should",Space,Str "be",Space,Str "bold"]]] +``` + +``` +% pandoc -f mediawiki -t native +'' Should be emph '' +^D +[Para [Emph [Str "Should",Space,Str "be",Space,Str "emph"]]] +``` + |