@@ -32,7 +32,7 @@ import Text.Pandoc.Definition
3232import Text.Pandoc.Logging (Verbosity (..))
3333import Text.Pandoc.Options
3434import Text.Pandoc.Parsing hiding (enclosed, nested)
35−import Text.Pandoc.Shared (crFilter)
35+import Text.Pandoc.Shared (crFilter, safeRead)
3636import Text.Pandoc.XML (fromEntities)
3737import Text.Printf (printf)
3838
@@ -500,9 +500,12 @@ emph = try $ fmap B.emph (enclosed (string "''") nestedInlines)
500500escapedChar :: PandocMonad m => TikiWikiParser m B.Inlines
501501escapedChar = try $ do
502502 string "~"
503− inner <- many1 $ oneOf "0123456789"
503+ mNumber <- safeRead <$> many1 digit
504504 string "~"
505− return $B.str [toEnum (read inner :: Int) :: Char]
505+ return $ B.str $
506+ case mNumber of
507+ Just number -> [toEnum (number :: Int) :: Char]
508+ Nothing -> []
506509
507510-- UNSUPPORTED, as there doesn't seem to be any facility in calibre
508511-- for this