Merge pull request #3019 from tarleb/org-verbatim-fix

Org reader: fix parsing of verbatim inlines
This commit is contained in:
John MacFarlane 2016-07-14 08:43:39 -07:00 committed by GitHub
commit 06a3e6a03f
2 changed files with 7 additions and 2 deletions

View file

@ -614,7 +614,7 @@ displayMath = return . B.displayMath <$> choice [ rawMathBetween "\\[" "\\]"
]
updatePositions :: Char
-> OrgParser (Char)
-> OrgParser Char
updatePositions c = do
when (c `elem` emphasisPreChars) updateLastPreCharPos
when (c `elem` emphasisForbiddenBorderChars) updateLastForbiddenCharPos
@ -637,7 +637,9 @@ verbatimBetween :: Char
-> OrgParser String
verbatimBetween c = try $
emphasisStart c *>
many1TillNOrLessNewlines 1 (noneOf "\n\r") (emphasisEnd c)
many1TillNOrLessNewlines 1 verbatimChar (emphasisEnd c)
where
verbatimChar = noneOf "\n\r" >>= updatePositions
-- | Parses a raw string delimited by @c@ using Org's math rules
mathStringBetween :: Char

View file

@ -185,6 +185,9 @@ tests =
, "3" <> subscript "{}"
, "4" <> superscript ("(a(" <> strong "b(c" <> ")d))")
])
, "Verbatim text can contain equal signes (=)" =:
"=is_subst = True=" =?>
para (code "is_subst = True")
, "Image" =:
"[[./sunset.jpg]]" =?>