git.iko.soy/typeable/pandoc
on master help sign in
HTML reader: Fixed detection of self-closing tags.

Earlier versions had a bug and would wrongly think opening tags containing attributes with slashes in them were self-closing. Closes #2146.

commit9857aa866af243d3fe89b5a951a4463e825e6a0c authorJohn MacFarlane <jgm@berkeley.edu> dateMon 11 May 2015, 16:17 (11 years ago) parent4b251e9
2 files changed+3−3
src/Text/Pandoc/Parsing.hs+1−1 src/Text/Pandoc/Readers/HTML.hs+2−2
src/Text/Pandoc/Parsing.hs+1−1
@@ -1206,7 +1206,7 @@ citeKey = try $ do
12061206 guard =<< notAfterString
12071207 suppress_author <- option False (char '-' *> return True)
12081208 char '@'
1209− firstChar <- alphaNum <|> char '_'
1209+ firstChar <- alphaNum <|> char '_' <|> char '*' -- @* for wildcard in nocite
12101210 let regchar = satisfy (\c -> isAlphaNum c || c == '_')
12111211 let internal p = try $ p <* lookAhead regchar
12121212 rest <- many $ regchar <|> internal (oneOf ":.#$%&-+?<>~/")
src/Text/Pandoc/Readers/HTML.hs+2−2
@@ -51,7 +51,7 @@ import Text.Pandoc.Options (ReaderOptions(readerParseRaw, readerTrace)
5151import Text.Pandoc.Parsing hiding ((<|>))
5252import Text.Pandoc.Walk
5353import Data.Maybe ( fromMaybe, isJust)
54−import Data.List ( intercalate, isInfixOf, isPrefixOf )
54+import Data.List ( intercalate, isInfixOf, isPrefixOf, isSuffixOf )
5555import Data.Char ( isDigit )
5656import Control.Monad ( liftM, guard, when, mzero, void, unless )
5757import Control.Arrow ((***))
@@ -874,7 +874,7 @@ htmlInBalanced :: (Monad m)
874874 -> ParserT String st m String
875875htmlInBalanced f = try $ do
876876 (TagOpen t _, tag) <- htmlTag f
877− guard $ '/' `notElem` tag -- not a self-closing tag
877+ guard $ not $ "/>" `isSuffixOf` tag -- not a self-closing tag
878878 let stopper = htmlTag (~== TagClose t)
879879 let anytag = snd <$> htmlTag (const True)
880880 contents <- many $ notFollowedBy' stopper >>