summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/RST.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-09-16 10:29:35 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-09-16 10:29:35 -0700
commitecc206f7c3024db7bcf068e7af3df7bf71f1a327 (patch)
tree9bb429a44749bd033d9a7fdb9c7cd9961c5989bf /src/Text/Pandoc/Readers/RST.hs
parent9f89269941cc8b15612aaddd6ba44e9dac5293c1 (diff)
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.
Diffstat (limited to 'src/Text/Pandoc/Readers/RST.hs')
-rw-r--r--src/Text/Pandoc/Readers/RST.hs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
index 74653efcf..1d64ff220 100644
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -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