@@ -61,7 +61,7 @@ import Control.Monad.Reader
6161import Control.Monad.State.Strict
6262import Data.Bits ((.|.))
6363import qualified Data.ByteString.Lazy as B
64−import Data.Char (chr, isDigit, ord, readLitChar)
64+import Data.Char (chr, ord, readLitChar)
6565import Data.List
6666import qualified Data.Map as M
6767import Data.Maybe
@@ -939,19 +939,18 @@ elemToRunStyle ns element parentStyle
939939 }
940940elemToRunStyle _ _ _ = defaultRunStyle
941941
942−isNumericNotNull :: String -> Bool
943−isNumericNotNull str = (str /= []) && (all isDigit str)
944−
945942getHeaderLevel :: NameSpaces -> Element -> Maybe (String,Int)
946943getHeaderLevel ns element
947944 | Just styleId <- findAttrByName ns "w" "styleId" element
948945 , Just index <- stripPrefix "Heading" styleId
949− , isNumericNotNull index = Just (styleId, read index)
946+ , Just n <- stringToInteger index
947+ , n > 0 = Just (styleId, fromInteger n)
950948 | Just styleId <- findAttrByName ns "w" "styleId" element
951949 , Just index <- findChildByName ns "w" "name" element >>=
952950 findAttrByName ns "w" "val" >>=
953951 stripPrefix "heading "
954− , isNumericNotNull index = Just (styleId, read index)
952+ , Just n <- stringToInteger index
953+ , n > 0 = Just (styleId, fromInteger n)
955954getHeaderLevel _ _ = Nothing
956955
957956blockQuoteStyleIds :: [String]