From 485fa81559749f564a56c8b9638c4d03921ba9dd Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Sun, 22 Apr 2007 04:38:05 +0000 Subject: Resolved issue #10: instead of adding "\n\n" to the end of strings in Main, do it in readMarkdown and readRST. (Note: the point of this is to ensure that a block at the end of the file gets treated as if it has blank space after it, which is generally what is wanted.) git-svn-id: https://pandoc.googlecode.com/svn/trunk@588 788f1e2b-df1e-0410-8736-df70ead52e1b --- src/Main.hs | 2 +- src/Text/Pandoc/Readers/Markdown.hs | 2 +- src/Text/Pandoc/Readers/RST.hs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Main.hs b/src/Main.hs index 980afb25b..7e8ea829a 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -444,7 +444,7 @@ main = do Nothing -> stateColumns defaultParserState let tabFilter = if preserveTabs then id else (tabsToSpaces tabStop) - let addBlank str = str ++ "\n\n" + let addBlank str = str let removeCRs str = filter (/= '\r') str -- remove DOS-style line endings let filter = tabFilter . addBlank . removeCRs let startParserState = diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 353dd45dd..b6acce62b 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -47,7 +47,7 @@ import Text.ParserCombinators.Parsec -- | Read markdown from an input string and return a Pandoc document. readMarkdown :: ParserState -> String -> Pandoc -readMarkdown = readWith parseMarkdown +readMarkdown state str = (readWith parseMarkdown) state (str ++ "\n\n") -- | Parse markdown string with default options and print result (for testing). testString :: String -> IO () diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs index d2143af38..b13d2fdf9 100644 --- a/src/Text/Pandoc/Readers/RST.hs +++ b/src/Text/Pandoc/Readers/RST.hs @@ -42,7 +42,7 @@ import Data.Char ( toUpper ) -- | Parse reStructuredText string and return Pandoc document. readRST :: ParserState -> String -> Pandoc -readRST = readWith parseRST +readRST state str = (readWith parseRST) state (str ++ "\n\n") -- | Parse a string and print result (for testing). testString :: String -> IO () -- cgit v1.2.3