diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2013-01-13 11:14:50 -0800 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2013-01-13 11:15:31 -0800 |
commit | 5c067bb457a96d8c7c35c9e1ca114169a02c1d2d (patch) | |
tree | f4ea9be0e6f1381b25787c7e92c75b9e92fb8242 /src/Text/Pandoc | |
parent | 5ecadd7bfac0fea7b4269822b82aacf63fb192be (diff) | |
download | pandoc-5c067bb457a96d8c7c35c9e1ca114169a02c1d2d.tar.gz |
RST reader: Line block improvements.
* Use nonbreaking spaces for initial indent (otherwise lost in HTML and
LaTeX).
* Allow multiple paragraphs in a single line block.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Readers/RST.hs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs index cc8293132..5f6850148 100644 --- a/src/Text/Pandoc/Readers/RST.hs +++ b/src/Text/Pandoc/Readers/RST.hs @@ -206,16 +206,21 @@ lineBlockLine = try $ do char '|' char ' ' <|> lookAhead (char '\n') white <- many spaceChar - line <- many $ (notFollowedBy newline >> inline) <|> (try $ endline >>~ char ' ') + line <- many1 $ (notFollowedBy newline >> inline) <|> (try $ endline >>~ char ' ') optional endline return $ if null white then mconcat line - else B.str white <> mconcat line + else B.str (spToNbsp white) <> mconcat line + +spToNbsp :: String -> String +spToNbsp (' ':xs) = '\160' : spToNbsp xs +spToNbsp (x:xs) = x : spToNbsp xs +spToNbsp [] = "" lineBlock :: RSTParser Blocks lineBlock = try $ do lines' <- many1 lineBlockLine - blanklines + skipMany1 $ blankline <|> try (char '|' >> blankline) return $ B.para (mconcat $ intersperse B.linebreak lines') -- |