From 26e8d98be207fcee24375e8636f7861679c95406 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Wed, 18 May 2016 16:21:56 +0200 Subject: 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/ --- src/Text/Pandoc/Readers/Org.hs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Readers/Org.hs b/src/Text/Pandoc/Readers/Org.hs index 06af84494..da20e9407 100644 --- a/src/Text/Pandoc/Readers/Org.hs +++ b/src/Text/Pandoc/Readers/Org.hs @@ -37,8 +37,9 @@ import Text.Pandoc.Error import Text.Pandoc.Options import qualified Text.Pandoc.Parsing as P import Text.Pandoc.Parsing hiding ( F, unF, askF, asksF, runF - , newline, orderedListMarker - , parseFromString, blanklines + , anyLine, blanklines, newline + , orderedListMarker + , parseFromString ) import Text.Pandoc.Readers.LaTeX (inlineCommand, rawLaTeXInline) import Text.Pandoc.Readers.Org.ParserState @@ -247,6 +248,12 @@ blanklines = <* updateLastPreCharPos <* updateLastForbiddenCharPos +anyLine :: OrgParser String +anyLine = + P.anyLine + <* updateLastPreCharPos + <* updateLastForbiddenCharPos + -- | Succeeds when we're in list context. inList :: OrgParser () inList = do @@ -304,7 +311,7 @@ stringyMetaAttribute attrCheck = try $ do attrName <- map toUpper <$> many1Till nonspaceChar (char ':') guard $ attrCheck attrName skipSpaces - attrValue <- manyTill anyChar newline + attrValue <- anyLine return (attrName, attrValue) blockAttributes :: OrgParser BlockAttributes -- cgit v1.2.3