aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc.hs4
-rw-r--r--src/Text/Pandoc/Readers/HTML.hs2
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs2
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs4
-rw-r--r--src/Text/Pandoc/Readers/RST.hs4
-rw-r--r--src/Text/Pandoc/Readers/TeXMath.hs3
6 files changed, 14 insertions, 5 deletions
diff --git a/src/Text/Pandoc.hs b/src/Text/Pandoc.hs
index 6cca14afe..390c27765 100644
--- a/src/Text/Pandoc.hs
+++ b/src/Text/Pandoc.hs
@@ -45,6 +45,10 @@ inline links:
>
> main = U.getContents >>= U.putStrLn . markdownToRST
+Note: all of the readers assume that the input text has @'\n'@
+line endings. So if you get your input text from a web form,
+you should remove @'\r'@ characters using @filter (/='\r')@.
+
-}
module Text.Pandoc
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs
index 506f77d1b..2e38da722 100644
--- a/src/Text/Pandoc/Readers/HTML.hs
+++ b/src/Text/Pandoc/Readers/HTML.hs
@@ -52,7 +52,7 @@ import Network.URI ( parseURIReference, URI (..) )
-- | Convert HTML-formatted string to 'Pandoc' document.
readHtml :: ParserState -- ^ Parser state
- -> String -- ^ String to parse
+ -> String -- ^ String to parse (assumes @'\n'@ line endings)
-> Pandoc
readHtml = readWith parseHtml
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index 5d02a2be5..c6e28cd45 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -42,7 +42,7 @@ import Data.List ( isPrefixOf, isSuffixOf )
-- | Parse LaTeX from string and return 'Pandoc' document.
readLaTeX :: ParserState -- ^ Parser state, including options for parser
- -> String -- ^ String to parse
+ -> String -- ^ String to parse (assumes @'\n'@ line endings)
-> Pandoc
readLaTeX = readWith parseLaTeX
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index ae682e72e..80bc53966 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -48,7 +48,9 @@ import Text.ParserCombinators.Parsec
import Control.Monad (when)
-- | Read markdown from an input string and return a Pandoc document.
-readMarkdown :: ParserState -> String -> Pandoc
+readMarkdown :: ParserState -- ^ Parser state, including options for parser
+ -> String -- ^ String to parse (assuming @'\n'@ line endings)
+ -> Pandoc
readMarkdown state s = (readWith parseMarkdown) state (s ++ "\n\n")
--
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
index 884d6f0e6..097d271cb 100644
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -37,7 +37,9 @@ import Control.Monad ( when )
import Data.List ( findIndex, delete, intercalate )
-- | Parse reStructuredText string and return Pandoc document.
-readRST :: ParserState -> String -> Pandoc
+readRST :: ParserState -- ^ Parser state, including options for parser
+ -> String -- ^ String to parse (assuming @'\n'@ line endings)
+ -> Pandoc
readRST state s = (readWith parseRST) state (s ++ "\n\n")
--
diff --git a/src/Text/Pandoc/Readers/TeXMath.hs b/src/Text/Pandoc/Readers/TeXMath.hs
index 04b0f3b8f..2f35910ce 100644
--- a/src/Text/Pandoc/Readers/TeXMath.hs
+++ b/src/Text/Pandoc/Readers/TeXMath.hs
@@ -35,7 +35,8 @@ import Text.ParserCombinators.Parsec
import Text.Pandoc.Definition
-- | Converts a string of raw TeX math to a list of 'Pandoc' inlines.
-readTeXMath :: String -> [Inline]
+readTeXMath :: String -- ^ String to parse (assumes @'\n'@ line endings)
+ -> [Inline]
readTeXMath inp = case parse teXMath ("formula: " ++ inp) inp of
Left _ -> [Str inp] -- if unparseable, just include original
Right res -> res