Org reader: Read linebreaks

Linebreaks are marked by the string `\\` at the end of a line.
This commit is contained in:
Albert Krewinkel
2014-04-12 11:07:38 +02:00
parent 36066699c3
commit 82d4160bdc
2 changed files with 8 additions and 0 deletions
+4
View File
@@ -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
+4
View File
@@ -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*"