git.iko.soy/typeable/pandoc
on master help sign in
DokuWiki reader: parse markup inside monospace ('') (#5917)

Fixes #5916

commit33d2a1a84fb04c0044aa794f6dd2663dac1c06f1 authorAlexander Krotov <ilabdsf@gmail.com> dateMon 18 Nov 2019, 23:05 (7 years ago) parent787ad00
2 files changed+5−2
src/Text/Pandoc/Readers/DokuWiki.hs+2−2 test/Tests/Readers/DokuWiki.hs+3
src/Text/Pandoc/Readers/DokuWiki.hs+2−2
@@ -31,7 +31,7 @@ import Text.Pandoc.Definition
3131import Text.Pandoc.Error (PandocError (PandocParsecError))
3232import Text.Pandoc.Options
3333import Text.Pandoc.Parsing hiding (enclosed, nested)
34−import Text.Pandoc.Shared (crFilter, trim, underlineSpan, tshow)
34+import Text.Pandoc.Shared (crFilter, trim, underlineSpan, stringify, tshow)
3535
3636-- | Read DokuWiki from an input string and return a Pandoc document.
3737readDokuWiki :: PandocMonad m
@@ -179,7 +179,7 @@ nestedText end = innerSpace <|> countChar 1 nonspaceChar
179179 innerSpace = try $ many1Char spaceChar <* notFollowedBy end
180180
181181monospaced :: PandocMonad m => DWParser m B.Inlines
182−monospaced = try $ B.code <$> enclosed (string "''") nestedText
182+monospaced = try $ B.code . (T.concat . map stringify . B.toList) <$> enclosed (string "''") nestedInlines
183183
184184subscript :: PandocMonad m => DWParser m B.Inlines
185185subscript = try $ B.subscript <$> between (string "<sub>") (try $ string "</sub>") nestedInlines
test/Tests/Readers/DokuWiki.hs+3
@@ -46,6 +46,9 @@ tests = [ testGroup "inlines"
4646 , "Monospaced" =:
4747 "''monospaced''" =?>
4848 para (code "monospaced")
49+ , "Monospaced with nowiki" =:
50+ "''%%monospaced%%''" =?>
51+ para (code "monospaced")
4952 , "Combined" =:
5053 "**__//''combine''//__**" =?>
5154 para (strong $ underlineSpan $ emph $ code "combine")