git.iko.soy/typeable/pandoc
on master help sign in
HTML reader: Fix col width parsing for percentages < 10% (#4262)
f5f0b76n3fariox
src/Text/Pandoc/Readers/HTML.hs+6−3
@@ -531,15 +531,18 @@ pCol = try $ do
531 skipMany pBlank
531 skipMany pBlank
532 optional $ pSatisfy (matchTagClose "col")
532 optional $ pSatisfy (matchTagClose "col")
533 skipMany pBlank
533 skipMany pBlank
534− return $ case lookup "width" attribs of
534+ let width = case lookup "width" attribs of
535 Nothing -> case lookup "style" attribs of
535 Nothing -> case lookup "style" attribs of
536 Just ('w':'i':'d':'t':'h':':':xs) | '%' `elem` xs ->
536 Just ('w':'i':'d':'t':'h':':':xs) | '%' `elem` xs ->
537− fromMaybe 0.0 $ safeRead ('0':'.':filter
537+ fromMaybe 0.0 $ safeRead (filter
538 (`notElem` (" \t\r\n%'\";" :: [Char])) xs)
538 (`notElem` (" \t\r\n%'\";" :: [Char])) xs)
539 _ -> 0.0
539 _ -> 0.0
540 Just x | not (null x) && last x == '%' ->
540 Just x | not (null x) && last x == '%' ->
541− fromMaybe 0.0 $ safeRead ('0':'.':init x)
541+ fromMaybe 0.0 $ safeRead (init x)
542 _ -> 0.0
542 _ -> 0.0
543+ if width > 0.0
544+ then return $ width / 100.0
545+ else return 0.0
543
546
544pColgroup :: PandocMonad m => TagParser m [Double]
547pColgroup :: PandocMonad m => TagParser m [Double]
545pColgroup = try $ do
548pColgroup = try $ do