git.iko.soy/typeable/pandoc
on master help sign in
Merge pull request #3019 from tarleb/org-verbatim-fix

Org reader: fix parsing of verbatim inlines

commit06a3e6a03f8cdef118bea59c45230b80b9534b19 authorJohn MacFarlane <jgm@berkeley.edu> dateThu 14 Jul 2016, 08:43 (10 years ago) parent00b11bc529146d
2 files changed+7−2
src/Text/Pandoc/Readers/Org/Inlines.hs+4−2 tests/Tests/Readers/Org.hs+3
src/Text/Pandoc/Readers/Org/Inlines.hs+4−2
@@ -614,7 +614,7 @@ displayMath = return . B.displayMath <$> choice [ rawMathBetween "\\[" "\\]"
614614 ]
615615
616616updatePositions :: Char
617− -> OrgParser (Char)
617+ -> OrgParser Char
618618updatePositions c = do
619619 when (c `elem` emphasisPreChars) updateLastPreCharPos
620620 when (c `elem` emphasisForbiddenBorderChars) updateLastForbiddenCharPos
@@ -637,7 +637,9 @@ verbatimBetween :: Char
637637 -> OrgParser String
638638verbatimBetween c = try $
639639 emphasisStart c *>
640− many1TillNOrLessNewlines 1 (noneOf "\n\r") (emphasisEnd c)
640+ many1TillNOrLessNewlines 1 verbatimChar (emphasisEnd c)
641+ where
642+ verbatimChar = noneOf "\n\r" >>= updatePositions
641643
642644-- | Parses a raw string delimited by @c@ using Org's math rules
643645mathStringBetween :: Char
tests/Tests/Readers/Org.hs+3
@@ -185,6 +185,9 @@ tests =
185185 , "3" <> subscript "{}"
186186 , "4" <> superscript ("(a(" <> strong "b(c" <> ")d))")
187187 ])
188+ , "Verbatim text can contain equal signes (=)" =:
189+ "=is_subst = True=" =?>
190+ para (code "is_subst = True")
188191
189192 , "Image" =:
190193 "[[./sunset.jpg]]" =?>