mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-25 01:36:45 +00:00
Add unicode code point in "Missing character" warning.
If the character isn't in the console font, the message is pretty useless, so we show the code point for anything non-ASCII. Closes #5538.
This commit is contained in:
@@ -27,6 +27,8 @@ import qualified Data.ByteString.Lazy.Char8 as BC
|
||||
import Data.Maybe (fromMaybe)
|
||||
import Data.Text (Text)
|
||||
import qualified Data.Text as T
|
||||
import Text.Printf (printf)
|
||||
import Data.Char (ord, isAscii)
|
||||
import System.Directory
|
||||
import System.Environment
|
||||
import System.Exit (ExitCode (..))
|
||||
@@ -243,7 +245,12 @@ missingCharacterWarnings :: Verbosity -> ByteString -> PandocIO ()
|
||||
missingCharacterWarnings verbosity log' = do
|
||||
let ls = BC.lines log'
|
||||
let isMissingCharacterWarning = BC.isPrefixOf "Missing character: "
|
||||
let warnings = [ UTF8.toStringLazy (BC.drop 19 l)
|
||||
let addCodePoint [] = []
|
||||
addCodePoint (c:cs)
|
||||
| isAscii c = c : addCodePoint cs
|
||||
| otherwise = c : " (U+" ++ printf "%04X" (ord c) ++ ")" ++
|
||||
addCodePoint cs
|
||||
let warnings = [ addCodePoint (UTF8.toStringLazy (BC.drop 19 l))
|
||||
| l <- ls
|
||||
, isMissingCharacterWarning l
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user