diff options
author | John MacFarlane <jgm@berkeley.edu> | 2021-08-10 12:50:23 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-08-10 12:50:23 -0700 |
commit | 3a924d8f96a336f6adcee5dd4c924c14a92a5bf7 (patch) | |
tree | 302c6033e8bf6f392a4dc0838642e3e92066b1ea /src/Text | |
parent | 7ca4233793f3ba42b2c79c3526a4ab2664fea2e2 (diff) | |
download | pandoc-3a924d8f96a336f6adcee5dd4c924c14a92a5bf7.tar.gz |
HTML reader: treat commments as blank when parsing.
This modifies pBlank. Previously comments could sometimes
flummox the parser.
Cloes #7482.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Readers/HTML/Parsing.hs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Readers/HTML/Parsing.hs b/src/Text/Pandoc/Readers/HTML/Parsing.hs index bd8d7c96c..27a23aa69 100644 --- a/src/Text/Pandoc/Readers/HTML/Parsing.hs +++ b/src/Text/Pandoc/Readers/HTML/Parsing.hs @@ -30,11 +30,11 @@ module Text.Pandoc.Readers.HTML.Parsing ) where -import Control.Monad (guard, void, mzero) +import Control.Monad (void, mzero) import Data.Maybe (fromMaybe) import Data.Text (Text) import Text.HTML.TagSoup - ( Attribute, Tag (..), isTagText, isTagPosition, isTagOpen, isTagClose, (~==) ) + ( Attribute, Tag (..), isTagPosition, isTagOpen, isTagClose, (~==) ) import Text.Pandoc.Class.PandocMonad (PandocMonad (..)) import Text.Pandoc.Definition (Attr) import Text.Pandoc.Parsing @@ -118,9 +118,11 @@ pCloses tagtype = try $ do _ -> mzero pBlank :: PandocMonad m => TagParser m () -pBlank = try $ do - (TagText str) <- pSatisfy isTagText - guard $ T.all isSpace str +pBlank = void $ pSatisfy isBlank + where + isBlank (TagText t) = T.all isSpace t + isBlank (TagComment _) = True + isBlank _ = False pLocation :: PandocMonad m => TagParser m () pLocation = do |