git.iko.soy/typeable/pandoc
on master help sign in
HTML reader: handle empty start attribute.

See #5162.

commit15d3cf80703769abc8443a73a56acae8c7f5687e authorJohn MacFarlane <jgm@berkeley.edu> dateMon 17 Dec 2018, 10:19 (8 years ago) parent4dc732f
1 file changed+2−4
src/Text/Pandoc/Readers/HTML.hs+2−4
src/Text/Pandoc/Readers/HTML.hs+2−4
@@ -49,7 +49,7 @@ import Control.Arrow (first)
4949import Control.Monad (guard, mplus, msum, mzero, unless, void)
5050import Control.Monad.Except (throwError)
5151import Control.Monad.Reader (ReaderT, ask, asks, lift, local, runReaderT)
52−import Data.Char (isAlphaNum, isDigit, isLetter)
52+import Data.Char (isAlphaNum, isLetter)
5353import Data.Default (Default (..), def)
5454import Data.Foldable (for_)
5555import Data.List (isPrefixOf)
@@ -319,9 +319,7 @@ pOrderedList = try $ do
319319 let (start, style) = (sta', sty')
320320 where sta = fromMaybe "1" $
321321 lookup "start" attribs
322− sta' = if all isDigit sta
323− then read sta
324− else 1
322+ sta' = fromMaybe 1 $ safeRead sta
325323
326324 pickListStyle = pickStyleAttrProps ["list-style-type", "list-style"]
327325