diff options
author | John MacFarlane <jgm@berkeley.edu> | 2012-08-09 08:11:28 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2012-08-09 08:11:28 -0700 |
commit | a740de05086960eb6d926f68acd43fedb4599f6c (patch) | |
tree | bfdbb5d23d89aa7c431e1c2edf91560454e3358c /src/Text/Pandoc/Highlighting.hs | |
parent | 10cdd59fa8664caf5ac73dc06ee7076a4bbe69bd (diff) | |
download | pandoc-a740de05086960eb6d926f68acd43fedb4599f6c.tar.gz |
Use safeRead instead of using reads directly (various modules).
Diffstat (limited to 'src/Text/Pandoc/Highlighting.hs')
-rw-r--r-- | src/Text/Pandoc/Highlighting.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Highlighting.hs b/src/Text/Pandoc/Highlighting.hs index 080acebee..95df88099 100644 --- a/src/Text/Pandoc/Highlighting.hs +++ b/src/Text/Pandoc/Highlighting.hs @@ -47,6 +47,7 @@ module Text.Pandoc.Highlighting ( languages , Style ) where import Text.Pandoc.Definition +import Text.Pandoc.Shared (safeRead) import Text.Highlighting.Kate import Data.List (find) import Data.Maybe (fromMaybe) @@ -60,9 +61,9 @@ highlight :: (FormatOptions -> [SourceLine] -> a) -- ^ Formatter -> String -- ^ Raw contents of the CodeBlock -> Maybe a -- ^ Maybe the formatted result highlight formatter (_, classes, keyvals) rawCode = - let firstNum = case reads (fromMaybe "1" $ lookup "startFrom" keyvals) of - ((n,_):_) -> n - [] -> 1 + let firstNum = case safeRead (fromMaybe "1" $ lookup "startFrom" keyvals) of + Just n -> n + Nothing -> 1 fmtOpts = defaultFormatOpts{ startNumber = firstNum, numberLines = any (`elem` |