From 3c4e1ff063100cbdf27f911fcbedbb842adf2af4 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 24 Mar 2012 16:11:56 -0700 Subject: RST reader: allow :math:`...` even when not followed by blank or \. This does not implement the complex rule described at http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#inline-markup-recognition-rules, but it should be good enough for most purposes. Closes #453. --- src/Text/Pandoc/Readers/RST.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs index 759d9802e..30d9aae44 100644 --- a/src/Text/Pandoc/Readers/RST.hs +++ b/src/Text/Pandoc/Readers/RST.hs @@ -807,9 +807,10 @@ strong = enclosed (string "**") (try $ string "**") inline >>= interpreted :: [Char] -> GenParser Char st [Char] interpreted role = try $ do - optional $ try $ string "\\ " + -- Note, this doesn't precisely implement the complex rule in + -- http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#inline-markup-recognition-rules + -- but it should be good enough for most purposes result <- enclosed (string $ ":" ++ role ++ ":`") (char '`') anyChar - try (string "\\ ") <|> lookAhead (count 1 $ oneOf " \t\n") <|> (eof >> return "") return result superscript :: GenParser Char ParserState Inline -- cgit v1.2.3