diff options
author | Hans Hagen <pragma@wxs.nl> | 2020-07-02 17:28:32 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2020-07-02 17:28:32 +0200 |
commit | 12fd8a1b4fa2a1cec2c363284f9baa572dbc96b9 (patch) | |
tree | b81423d0411502ba0216b773ebc1754b871fc1e3 /tex/context/base/mkiv/cldf-ini.lua | |
parent | 74abcdb3fc2356cd40aa94d002f2a19aac549b40 (diff) | |
download | context-12fd8a1b4fa2a1cec2c363284f9baa572dbc96b9.tar.gz |
2020-07-02 16:06:00
Diffstat (limited to 'tex/context/base/mkiv/cldf-ini.lua')
-rw-r--r-- | tex/context/base/mkiv/cldf-ini.lua | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/tex/context/base/mkiv/cldf-ini.lua b/tex/context/base/mkiv/cldf-ini.lua index 9569cf357..03c9be8f9 100644 --- a/tex/context/base/mkiv/cldf-ini.lua +++ b/tex/context/base/mkiv/cldf-ini.lua @@ -110,6 +110,10 @@ local newtoken = token.new local createtoken = token.create local setluatoken = token.set_lua +local isprintable = tex.isprintable or function(n) + return n and (type(n) == "string" or isnode(n) or istoken(n)) +end + local catcodenumbers = catcodes.numbers local ctxcatcodes = catcodenumbers.ctxcatcodes @@ -803,7 +807,8 @@ local function writer(parent,command,...) -- already optimized before call end elseif typ == "thread" then report_context("coroutines not supported as we cannot yield across boundaries") - elseif isnode(ti) then -- slow | why {} here ? + -- elseif isnode(ti) or istoken(ti) then + elseif isprintable(ti) then flush(currentcatcodes,"{",ti,"}") else local s = tostring(ti) @@ -967,7 +972,8 @@ local caller = function(parent,f,a,...) end elseif typ == "thread" then report_context("coroutines not supported as we cannot yield across boundaries") - elseif isnode(f) then -- slow + -- elseif isnode(f) or istoken(f) then + elseif isprintable(f) then flush(f) else local s = tostring(f) @@ -1062,8 +1068,7 @@ end) local function userdata(argument) if isnode(argument) then return formatters["<< %s node %i>>"](nodes.nodecodes[argument.id],tonut(argument)) - end - if istoken(argument) then + elseif istoken(argument) then local csname = argument.csname if csname then -- return formatters["<<\\%s>>"](csname) @@ -1074,8 +1079,9 @@ local function userdata(argument) return "<<function>>" -- argument.mode end return "<<token>>" + else + return "<<userdata>>" end - return "<<userdata>>" end |