RST reader: Small tweaks to raw field lists.
* Don't allow line breaks in field names. * Strip off initial newline from 'raw' when field body begins on next line.
This commit is contained in:
parent
9f89269941
commit
ecc206f7c3
1 changed files with 2 additions and 3 deletions
|
@ -151,13 +151,12 @@ rawFieldListItem :: String -> Parser [Char] ParserState (String, String)
|
|||
rawFieldListItem indent = try $ do
|
||||
string indent
|
||||
char ':'
|
||||
name <- many1 $ noneOf ":"
|
||||
char ':'
|
||||
name <- many1Till (noneOf "\n") (char ':')
|
||||
skipSpaces
|
||||
first <- manyTill anyChar newline
|
||||
rest <- option "" $ try $ do lookAhead (string indent >> spaceChar)
|
||||
indentedBlock
|
||||
let raw = first ++ "\n" ++ rest ++ "\n"
|
||||
let raw = (if null first then "" else (first ++ "\n")) ++ rest ++ "\n"
|
||||
return (name, raw)
|
||||
|
||||
fieldListItem :: String
|
||||
|
|
Loading…
Add table
Reference in a new issue