git.iko.soy/typeable/pandoc
on master help sign in
HTML Reader: Recognise <br> tags inside <pre> blocks

Closes #1620

commit6740a9592a4cc20b501ea5c8d35c9fcb27203af0 authormpickering <matthewtpickering@gmail.com> dateThu 25 Sep 2014, 19:20 (12 years ago) parent1f0ba8e
1 file changed+6−1
src/Text/Pandoc/Readers/HTML.hs+6−1
src/Text/Pandoc/Readers/HTML.hs+6−1
@@ -440,7 +440,7 @@ pCodeBlock :: TagParser Blocks
440440pCodeBlock = try $ do
441441 TagOpen _ attr <- pSatisfy (~== TagOpen "pre" [])
442442 contents <- manyTill pAnyTag (pCloses "pre" <|> eof)
443− let rawText = concatMap fromTagText $ filter isTagText contents
443+ let rawText = concatMap tagToString contents
444444 -- drop leading newline if any
445445 let result' = case rawText of
446446 '\n':xs -> xs
@@ -451,6 +451,11 @@ pCodeBlock = try $ do
451451 _ -> result'
452452 return $ B.codeBlockWith (mkAttr attr) result
453453
454+tagToString :: Tag String -> String
455+tagToString (TagText s) = s
456+tagToString (TagOpen "br" _) = "\n"
457+tagToString _ = ""
458+
454459inline :: TagParser Inlines
455460inline = choice
456461 [ eNoteref