mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-28 18:35:49 +00:00
Org reader: Read linebreaks
Linebreaks are marked by the string `\\` at the end of a line.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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*"
|
||||
|
||||
Reference in New Issue
Block a user