diff options
author | Albert Krewinkel <albert@zeitkraut.de> | 2016-05-18 16:21:56 +0200 |
---|---|---|
committer | Albert Krewinkel <albert@zeitkraut.de> | 2016-05-19 09:35:47 +0200 |
commit | 26e8d98be207fcee24375e8636f7861679c95406 (patch) | |
tree | d327ab1edfec6cdddef9bb28780a977d16f19e99 | |
parent | 1dda5353781fa605c00dd18af5f8527bc31956ef (diff) | |
download | pandoc-26e8d98be207fcee24375e8636f7861679c95406.tar.gz |
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/
-rw-r--r-- | src/Text/Pandoc/Readers/Org.hs | 13 |
1 files changed, 10 insertions, 3 deletions
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 |