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.
This commit is contained in:
John MacFarlane
2012-03-24 16:11:56 -07:00
parent d7f2b5d0f5
commit 3c4e1ff063
+3 -2
View File
@@ -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