mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-27 09:55:57 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user