From 12fd8a1b4fa2a1cec2c363284f9baa572dbc96b9 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Thu, 2 Jul 2020 17:28:32 +0200 Subject: 2020-07-02 16:06:00 --- tex/context/base/mkiv/cldf-ini.lua | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'tex/context/base/mkiv/cldf-ini.lua') 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 "<>" -- argument.mode end return "<>" + else + return "<>" end - return "<>" end -- cgit v1.2.3