git.iko.soy/typeable/pandoc
on master help sign in
RST reader: Small tweaks to raw field lists.
ecc206fJohn MacFarlane
src/Text/Pandoc/Readers/RST.hs+2−3
@@ -151,13 +151,12 @@ rawFieldListItem :: String -> Parser [Char] ParserState (String, String)
151rawFieldListItem indent = try $ do
151rawFieldListItem indent = try $ do
152 string indent
152 string indent
153 char ':'
153 char ':'
154− name <- many1 $ noneOf ":"
154+ name <- many1Till (noneOf "\n") (char ':')
155− char ':'
156 skipSpaces
155 skipSpaces
157 first <- manyTill anyChar newline
156 first <- manyTill anyChar newline
158 rest <- option "" $ try $ do lookAhead (string indent >> spaceChar)
157 rest <- option "" $ try $ do lookAhead (string indent >> spaceChar)
159 indentedBlock
158 indentedBlock
160− let raw = first ++ "\n" ++ rest ++ "\n"
159+ let raw = (if null first then "" else (first ++ "\n")) ++ rest ++ "\n"
161 return (name, raw)
160 return (name, raw)
162
161
163fieldListItem :: String
162fieldListItem :: String