From 7fad73646137e653e3f2f90fbc8436e477b7bb86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20Fabian=20Kr=C3=BCger?= Date: Sun, 7 Nov 2021 00:06:27 +0100 Subject: [PATCH] Fix texio compatibility --- luametalatex-firstcode.lua | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/luametalatex-firstcode.lua b/luametalatex-firstcode.lua index e77daa4..39a07ba 100644 --- a/luametalatex-firstcode.lua +++ b/luametalatex-firstcode.lua @@ -26,6 +26,36 @@ end -- end -- }) +do + luametalatex.texio = texio + local compat_texio = {} + for k,v in next, texio do compat_texio[k] = v end + local writenl = texio.writenl + local write = texio.write + texio = compat_texio + function texio.write(selector, ...) + if selector == 'term' then + selector = 'terminal' + elseif selector == 'log' then + selector = 'logfile' + elseif selector == 'term and log' then + selector = 'terminal_and_logfile' + end + return write(selector, ...) + end + function texio.write_nl(selector, ...) + if selector == 'term' then + selector = 'terminal' + elseif selector == 'log' then + selector = 'logfile' + elseif selector == 'term and log' then + selector = 'terminal_and_logfile' + end + return writenl(selector, ...) + end +end + + local new_whatsit = require'luametalatex-whatsits'.new local whatsit_id = node.id'whatsit' local spacer_cmd, relax_cmd = token.command_id'spacer', token.command_id'relax'