aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-04-28 09:24:52 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-04-28 09:24:52 -0700
commitd4d5910e0a6ff868a16c3e17a2b610769a7d14c1 (patch)
tree294914822e74bfdec2f07e6530b7eb27fa27f751 /src/Text/Pandoc/Readers
parent5932d905ff49b90796b4adbf2c5cc2b8c3722a79 (diff)
downloadpandoc-d4d5910e0a6ff868a16c3e17a2b610769a7d14c1.tar.gz
HTML reader: Don't skip nonbreaking spaces.
Previously a paragraph containing just `&nbsp;` would be rendered as an empty paragraph. Thanks to Paul Vorbach for pointing out the bug.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/HTML.hs8
1 files changed, 7 insertions, 1 deletions
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)