summaryrefslogtreecommitdiff
path: root/tex/context/base/char-utf.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/char-utf.lua')
-rw-r--r--tex/context/base/char-utf.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/tex/context/base/char-utf.lua b/tex/context/base/char-utf.lua
index e3f7605a8..267c97c26 100644
--- a/tex/context/base/char-utf.lua
+++ b/tex/context/base/char-utf.lua
@@ -30,8 +30,11 @@ if not characters.blocks then require("char-ini") end
local lpegmatch = lpeg.match
local lpegpatterns = lpeg.patterns
local p_utf8character = lpegpatterns.utf8character
+local p_utf8byte = lpegpatterns.utf8byte
local utfchartabletopattern = lpeg.utfchartabletopattern
+local formatters = string.formatters
+
local allocate = utilities.storage.allocate or function() return { } end
local charfromnumber = characters.fromnumber
@@ -60,6 +63,8 @@ characters.filters = filters
local utffilters = { }
characters.filters.utf = utffilters
+local data = characters.data
+
-- is characters.combined cached?
--[[ldx--
@@ -611,4 +616,23 @@ end
--
-- print(test,done,test==done,false)
+local f_default = formatters["[%U] "]
+local f_description = formatters["[%s] "]
+
+local function convert(n)
+ local d = data[n]
+ d = d and d.description
+ if d then
+ return f_description(d)
+ else
+ return f_default(n)
+ end
+end
+
+local pattern = Cs((p_utf8byte / convert)^1)
+
+function utffilters.verbose(data)
+ return data and lpegmatch(pattern,data) or ""
+end
+
return characters