aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authormpickering <matthewtpickering@gmail.com>2014-09-25 19:20:12 +0100
committermpickering <matthewtpickering@gmail.com>2014-09-25 19:20:12 +0100
commit6740a9592a4cc20b501ea5c8d35c9fcb27203af0 (patch)
tree1c4deeb8a6e47e7b6cf9084c6aabcaffee5cfbc2 /src/Text/Pandoc
parent1f0ba8ec11763d6f6335e0355402c5f4570850e8 (diff)
downloadpandoc-6740a9592a4cc20b501ea5c8d35c9fcb27203af0.tar.gz
HTML Reader: Recognise <br> tags inside <pre> blocks
Closes #1620
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/HTML.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs
index 4ea5f41d5..4e0bb375a 100644
--- a/src/Text/Pandoc/Readers/HTML.hs
+++ b/src/Text/Pandoc/Readers/HTML.hs
@@ -440,7 +440,7 @@ pCodeBlock :: TagParser Blocks
pCodeBlock = try $ do
TagOpen _ attr <- pSatisfy (~== TagOpen "pre" [])
contents <- manyTill pAnyTag (pCloses "pre" <|> eof)
- let rawText = concatMap fromTagText $ filter isTagText contents
+ let rawText = concatMap tagToString contents
-- drop leading newline if any
let result' = case rawText of
'\n':xs -> xs
@@ -451,6 +451,11 @@ pCodeBlock = try $ do
_ -> result'
return $ B.codeBlockWith (mkAttr attr) result
+tagToString :: Tag String -> String
+tagToString (TagText s) = s
+tagToString (TagOpen "br" _) = "\n"
+tagToString _ = ""
+
inline :: TagParser Inlines
inline = choice
[ eNoteref