git.iko.soy/typeable/pandoc
on master help sign in
Org reader: use custom `anyLine`

Additional state changes need to be made after a newline is parsed, otherwise markup may not be recognized correctly. This fixes a bug where markup after certain block-types would not be recognized. E.g. `/emph/` in the following snippet was not parsed as emphasized. foo # comment /emph/

commit26e8d98be207fcee24375e8636f7861679c95406 authorAlbert Krewinkel <albert@zeitkraut.de> dateWed 18 May 2016, 16:21 (10 years ago) parent1dda535
1 file changed+10−3
src/Text/Pandoc/Readers/Org.hs+10−3
src/Text/Pandoc/Readers/Org.hs+10−3
@@ -37,8 +37,9 @@ import Text.Pandoc.Error
3737import Text.Pandoc.Options
3838import qualified Text.Pandoc.Parsing as P
3939import Text.Pandoc.Parsing hiding ( F, unF, askF, asksF, runF
40− , newline, orderedListMarker
41− , parseFromString, blanklines
40+ , anyLine, blanklines, newline
41+ , orderedListMarker
42+ , parseFromString
4243 )
4344import Text.Pandoc.Readers.LaTeX (inlineCommand, rawLaTeXInline)
4445import Text.Pandoc.Readers.Org.ParserState
@@ -247,6 +248,12 @@ blanklines =
247248 <* updateLastPreCharPos
248249 <* updateLastForbiddenCharPos
249250
251+anyLine :: OrgParser String
252+anyLine =
253+ P.anyLine
254+ <* updateLastPreCharPos
255+ <* updateLastForbiddenCharPos
256+
250257-- | Succeeds when we're in list context.
251258inList :: OrgParser ()
252259inList = do
@@ -304,7 +311,7 @@ stringyMetaAttribute attrCheck = try $ do
304311 attrName <- map toUpper <$> many1Till nonspaceChar (char ':')
305312 guard $ attrCheck attrName
306313 skipSpaces
307− attrValue <- manyTill anyChar newline
314+ attrValue <- anyLine
308315 return (attrName, attrValue)
309316
310317blockAttributes :: OrgParser BlockAttributes