From d4d5910e0a6ff868a16c3e17a2b610769a7d14c1 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 28 Apr 2012 09:24:52 -0700 Subject: HTML reader: Don't skip nonbreaking spaces. Previously a paragraph containing just ` ` would be rendered as an empty paragraph. Thanks to Paul Vorbach for pointing out the bug. --- src/Text/Pandoc/Readers/HTML.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/Text/Pandoc/Readers') diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs index 0c017b2e4..ee61bbac6 100644 --- a/src/Text/Pandoc/Readers/HTML.hs +++ b/src/Text/Pandoc/Readers/HTML.hs @@ -46,9 +46,15 @@ import Text.Pandoc.Shared import Text.Pandoc.Parsing import Data.Maybe ( fromMaybe, isJust ) import Data.List ( intercalate ) -import Data.Char ( isSpace, isDigit, toLower ) +import Data.Char ( isDigit, toLower ) import Control.Monad ( liftM, guard, when ) +isSpace :: Char -> Bool +isSpace ' ' = True +isSpace '\t' = True +isSpace '\n' = True +isSpace _ = False + -- | Convert HTML-formatted string to 'Pandoc' document. readHtml :: ParserState -- ^ Parser state -> String -- ^ String to parse (assumes @'\n'@ line endings) -- cgit v1.2.3