diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 5 | ||||
-rw-r--r-- | src/Text/ParserCombinators/Pandoc.hs | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 585f813d7..4d49e1f28 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -163,7 +163,8 @@ parseMarkdown = do (title, author, date) <- option ([],[],"") titleBlock oldState <- getState oldInput <- getInput - parseBlocks -- go through once just to get list of reference keys + -- go through once just to get list of reference keys + manyTill (referenceKey <|> (do{anyLine; return Null})) eof newState <- getState let keysUsed = stateKeysUsed newState setInput oldInput @@ -492,7 +493,7 @@ rawHtmlBlocks = try (do -- referenceKey = try (do - skipSpaces + skipNonindentSpaces label <- reference char labelSep skipSpaces diff --git a/src/Text/ParserCombinators/Pandoc.hs b/src/Text/ParserCombinators/Pandoc.hs index 732d1b06d..55481b8dc 100644 --- a/src/Text/ParserCombinators/Pandoc.hs +++ b/src/Text/ParserCombinators/Pandoc.hs @@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Special parser combinators for Pandoc readers. -} module Text.ParserCombinators.Pandoc ( + anyLine, many1Till, followedBy', notFollowedBy', @@ -47,6 +48,10 @@ import Text.Pandoc.Definition import Text.Pandoc.Shared import Char ( toUpper, toLower ) +--- | Parse any line of text +anyLine :: GenParser Char st [Char] +anyLine = manyTill anyChar (newline <|> (do{eof; return '\n'})) + -- | Parses a character and returns 'Null' (so that the parser can move on -- if it gets stuck). nullBlock :: GenParser Char st Block |