summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/mtx-context-meaning.tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkiv/mtx-context-meaning.tex')
-rw-r--r--tex/context/base/mkiv/mtx-context-meaning.tex20
1 files changed, 18 insertions, 2 deletions
diff --git a/tex/context/base/mkiv/mtx-context-meaning.tex b/tex/context/base/mkiv/mtx-context-meaning.tex
index 88b81ef04..2ec66780e 100644
--- a/tex/context/base/mkiv/mtx-context-meaning.tex
+++ b/tex/context/base/mkiv/mtx-context-meaning.tex
@@ -31,19 +31,31 @@
\setupbodyfont
[dejavu]
-\def\showmeaning#1%
+\unexpanded\def\ShowMeaning#1%
{\ctxlua{logs.pushtarget("both")}%
\writestatus{meaning}{\strippedcsname#1}%
\writestring{}%
\writestring{\expandafter\meaning\begincsname#1\endcsname}%
\ctxlua{logs.poptarget()}}
+\unexpanded\def\ShowTokens#1%
+ {\ctxlua{logs.pushtarget("both")}%
+ \writestatus{tokens}{\strippedcsname#1}%
+ \writestring{}%
+ \ifcase\contextlmtxmode
+ \writestring{only supported in lmtx}%
+ \else
+ \expandafter\showluatokens\begincsname#1\endcsname
+ \fi
+ \ctxlua{logs.poptarget()}}
+
\starttext
\usemodule[setups-macros]
\startluacode
local h = tex.hashtokens()
+ local t = environment.arguments.tokens
local function showmeaning(str)
local h = interfaces.macros.collect(str)
@@ -54,7 +66,11 @@
local hi = h[i]
context.type(hi)
context.par()
- context.showmeaning(hi)
+ if t then
+ context.ShowTokens(hi)
+ else
+ context.ShowMeaning(hi)
+ end
end
context.page()
end