git.iko.soy/typeable/pandoc
on master help sign in
Org reader: Read linebreaks

Linebreaks are marked by the string `\\` at the end of a line.

commit82d4160bdcc149df020d1f95f4a7d893a9ecb42a authorAlbert Krewinkel <tarleb@moltkeplatz.de> dateSat 12 Apr 2014, 11:07 (13 years ago) parent3606669
2 files changed+8
src/Text/Pandoc/Readers/Org.hs+4 tests/Tests/Readers/Org.hs+4
src/Text/Pandoc/Readers/Org.hs+4
@@ -506,6 +506,7 @@ anyLineNewline = (++ "\n") <$> anyLine
506506inline :: OrgParser Inlines
507507inline =
508508 choice [ whitespace
509+ , linebreak
509510 , link
510511 , str
511512 , endline
@@ -535,6 +536,9 @@ whitespace = B.space <$ skipMany1 spaceChar
535536 <* updateLastForbiddenCharPos
536537 <?> "whitespace"
537538
539+linebreak :: OrgParser Inlines
540+linebreak = try $ B.linebreak <$ string "\\\\" <* skipSpaces <* newline
541+
538542str :: OrgParser Inlines
539543str = B.str <$> many1 (noneOf $ specialChars ++ "\n\r ")
540544 <* updateLastStrPos
tests/Tests/Readers/Org.hs+4
@@ -94,6 +94,10 @@ tests =
9494 "a_{n+1}" =?>
9595 para (str "a" <> subscript "n+1")
9696
97+ , "Linebreak" =:
98+ "line \\\\ \nbreak" =?>
99+ para ("line" <> linebreak <> "break")
100+
97101 , "Markup-chars not occuring on word break are symbols" =:
98102 unlines [ "this+that+ +so+on"
99103 , "seven*eight* nine*"