git.iko.soy/typeable/pandoc
on master help sign in
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.

commitecc206f7c3024db7bcf068e7af3df7bf71f1a327 authorJohn MacFarlane <fiddlosopher@gmail.com> dateSun 16 Sep 2012, 10:29 (14 years ago) parent9f89269
1 file changed+2−3
src/Text/Pandoc/Readers/RST.hs+2−3
src/Text/Pandoc/Readers/RST.hs+2−3
@@ -151,13 +151,12 @@ rawFieldListItem :: String -> Parser [Char] ParserState (String, String)
151151rawFieldListItem indent = try $ do
152152 string indent
153153 char ':'
154− name <- many1 $ noneOf ":"
155− char ':'
154+ name <- many1Till (noneOf "\n") (char ':')
156155 skipSpaces
157156 first <- manyTill anyChar newline
158157 rest <- option "" $ try $ do lookAhead (string indent >> spaceChar)
159158 indentedBlock
160− let raw = first ++ "\n" ++ rest ++ "\n"
159+ let raw = (if null first then "" else (first ++ "\n")) ++ rest ++ "\n"
161160 return (name, raw)
162161
163162fieldListItem :: String