git.iko.soy/typeable/pandoc
on master help sign in
Mediawiki reader: allow space around storng/emph delimiters.

Closes #6993.

commit23f964b9076f9795b00e740d20feebeb1d6d91db authorJohn MacFarlane <jgm@berkeley.edu> dateWed 30 Dec 2020, 21:31 (6 years ago) parent0782d58
2 files changed+25−6
src/Text/Pandoc/Readers/MediaWiki.hs+4−6 test/command/6993.md+21
src/Text/Pandoc/Readers/MediaWiki.hs+4−6
@@ -678,19 +678,17 @@ url = do
678678-- | Parses a list of inlines between start and end delimiters.
679679inlinesBetween :: (PandocMonad m, Show b) => MWParser m a -> MWParser m b -> MWParser m Inlines
680680inlinesBetween start end =
681− trimInlines . mconcat <$> try (start >> many1Till inner end)
682− where inner = innerSpace <|> (notFollowedBy' (() <$ whitespace) >> inline)
683− innerSpace = try $ whitespace <* notFollowedBy' end
681+ trimInlines . mconcat <$> try (start >> many1Till inline end)
684682
685683emph :: PandocMonad m => MWParser m Inlines
686684emph = B.emph <$> nested (inlinesBetween start end)
687− where start = sym "''" >> lookAhead nonspaceChar
685+ where start = sym "''"
688686 end = try $ notFollowedBy' (() <$ strong) >> sym "''"
689687
690688strong :: PandocMonad m => MWParser m Inlines
691689strong = B.strong <$> nested (inlinesBetween start end)
692− where start = sym "'''" >> lookAhead nonspaceChar
693− end = try $ sym "'''"
690+ where start = sym "'''"
691+ end = sym "'''"
694692
695693doubleQuotes :: PandocMonad m => MWParser m Inlines
696694doubleQuotes = do
test/command/6993.mdnew file+21
@@ -0,0 +1,21 @@
1+```
2+% pandoc -f mediawiki -t native
3+'''Should be bold '''
4+^D
5+[Para [Strong [Str "Should",Space,Str "be",Space,Str "bold"]]]
6+```
7+
8+```
9+% pandoc -f mediawiki -t native
10+''' Should be bold'''
11+^D
12+[Para [Strong [Str "Should",Space,Str "be",Space,Str "bold"]]]
13+```
14+
15+```
16+% pandoc -f mediawiki -t native
17+'' Should be emph ''
18+^D
19+[Para [Emph [Str "Should",Space,Str "be",Space,Str "emph"]]]
20+```
21+