From 1a8af5fc442287ef2f7775c4de179e4520487a4f Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Sat, 19 Nov 2016 01:17:04 +0100 Subject: Org reader: Ensure images in paragraphs are not parsed as figures This fixes a regression introduced in 7e5220b57c5a48fabe6e43ba270db812593d3463. --- src/Text/Pandoc/Readers/Org/BlockStarts.hs | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src/Text/Pandoc/Readers/Org/BlockStarts.hs') diff --git a/src/Text/Pandoc/Readers/Org/BlockStarts.hs b/src/Text/Pandoc/Readers/Org/BlockStarts.hs index e4dc31342..53a999307 100644 --- a/src/Text/Pandoc/Readers/Org/BlockStarts.hs +++ b/src/Text/Pandoc/Readers/Org/BlockStarts.hs @@ -37,9 +37,11 @@ module Text.Pandoc.Readers.Org.BlockStarts , commentLineStart , bulletListStart , orderedListStart + , endOfBlock ) where -import Text.Pandoc.Readers.Org.Parsing +import Control.Monad ( void ) +import Text.Pandoc.Readers.Org.Parsing -- | Horizontal Line (five -- dashes or more) hline :: OrgParser () @@ -110,3 +112,25 @@ noteMarker = try $ do , (++) <$> string "fn:" <*> many1Till (noneOf "\n\r\t ") (char ']') ] + + -- | Succeeds if the parser is at the end of a block. +endOfBlock :: OrgParser () +endOfBlock = lookAhead . try $ do + void blankline <|> anyBlockStart <|> void noteMarker + where + -- | Succeeds if there is a new block starting at this position. + anyBlockStart :: OrgParser () + anyBlockStart = try . choice $ + [ exampleLineStart + , hline + , metaLineStart + , commentLineStart + , void noteMarker + , void tableStart + , void drawerStart + , void headerStart + , void latexEnvStart + , void bulletListStart + , void orderedListStart + ] + -- cgit v1.2.3