git.iko.soy/typeable/pandoc
on master help sign in
Highlighting: Use reads instead of read.
f0e0e1eJohn MacFarlane
src/Text/Pandoc/Highlighting.hs+5−3
@@ -40,9 +40,11 @@ import Data.Char (toLower)
40highlightHtml :: Bool -- ^ True if inline HTML
40highlightHtml :: Bool -- ^ True if inline HTML
41 -> Attr -- ^ Attributes of the Code or CodeBlock
41 -> Attr -- ^ Attributes of the Code or CodeBlock
42 -> String -- ^ Raw contents of the Code or CodeBlock
42 -> String -- ^ Raw contents of the Code or CodeBlock
43− -> Either String Html -- ^ An error or the formatted Html
43+ -> Either String Html -- ^ An error or the formatted Html
44−highlightHtml inline (_, classes, keyvals) rawCode =
44+highlightHtml inline (id', classes, keyvals) rawCode =
45− let firstNum = read $ fromMaybe "1" $ lookup "startFrom" keyvals
45+ let firstNum = case reads (fromMaybe "1" $ lookup "startFrom" keyvals) of
46+ ((n,_):_) -> n
47+ [] -> 1
46 fmtOpts = [OptNumberFrom firstNum] ++
48 fmtOpts = [OptNumberFrom firstNum] ++
47 [OptInline | inline] ++
49 [OptInline | inline] ++
48 case find (`elem` ["number","numberLines","number-lines"]) classes of
50 case find (`elem` ["number","numberLines","number-lines"]) classes of