Mediawiki reader: allow space around storng/emph delimiters.
Closes #6993.
This commit is contained in:
parent
0782d5882c
commit
23f964b907
2 changed files with 25 additions and 6 deletions
|
@ -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
|
||||
|
|
21
test/command/6993.md
Normal file
21
test/command/6993.md
Normal file
|
@ -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"]]]
|
||||
```
|
||||
|
Loading…
Add table
Reference in a new issue