aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Krewinkel <tarleb@moltkeplatz.de>2014-04-12 11:07:38 +0200
committerAlbert Krewinkel <tarleb@moltkeplatz.de>2014-04-12 11:07:38 +0200
commit82d4160bdcc149df020d1f95f4a7d893a9ecb42a (patch)
tree6e23f6629700535710b156efa14578bce79a1ab6
parent36066699c31ca50566ca2492a5c112ecbe690a63 (diff)
downloadpandoc-82d4160bdcc149df020d1f95f4a7d893a9ecb42a.tar.gz
Org reader: Read linebreaks
Linebreaks are marked by the string `\\` at the end of a line.
-rw-r--r--src/Text/Pandoc/Readers/Org.hs4
-rw-r--r--tests/Tests/Readers/Org.hs4
2 files changed, 8 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Readers/Org.hs b/src/Text/Pandoc/Readers/Org.hs
index ceac69367..19dd03c6b 100644
--- a/src/Text/Pandoc/Readers/Org.hs
+++ b/src/Text/Pandoc/Readers/Org.hs
@@ -506,6 +506,7 @@ anyLineNewline = (++ "\n") <$> anyLine
inline :: OrgParser Inlines
inline =
choice [ whitespace
+ , linebreak
, link
, str
, endline
@@ -535,6 +536,9 @@ whitespace = B.space <$ skipMany1 spaceChar
<* updateLastForbiddenCharPos
<?> "whitespace"
+linebreak :: OrgParser Inlines
+linebreak = try $ B.linebreak <$ string "\\\\" <* skipSpaces <* newline
+
str :: OrgParser Inlines
str = B.str <$> many1 (noneOf $ specialChars ++ "\n\r ")
<* updateLastStrPos
diff --git a/tests/Tests/Readers/Org.hs b/tests/Tests/Readers/Org.hs
index 49130f0ab..567cc4c41 100644
--- a/tests/Tests/Readers/Org.hs
+++ b/tests/Tests/Readers/Org.hs
@@ -94,6 +94,10 @@ tests =
"a_{n+1}" =?>
para (str "a" <> subscript "n+1")
+ , "Linebreak" =:
+ "line \\\\ \nbreak" =?>
+ para ("line" <> linebreak <> "break")
+
, "Markup-chars not occuring on word break are symbols" =:
unlines [ "this+that+ +so+on"
, "seven*eight* nine*"