diff options
author | Hans Hagen <pragma@wxs.nl> | 2023-02-14 18:21:35 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2023-02-14 18:21:35 +0100 |
commit | cd404631d7079a9af603d173eb015f026731aa01 (patch) | |
tree | 588c6c8e860bb26955999dfc8be67eb78cc7ff7f /source/luametatex/source/lua/lmtnodelib.c | |
parent | d643b65f7ab840157f538914b07f8d3cddf94bec (diff) | |
download | context-cd404631d7079a9af603d173eb015f026731aa01.tar.gz |
2023-02-14 17:44:00
Diffstat (limited to 'source/luametatex/source/lua/lmtnodelib.c')
-rw-r--r-- | source/luametatex/source/lua/lmtnodelib.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source/luametatex/source/lua/lmtnodelib.c b/source/luametatex/source/lua/lmtnodelib.c index 6a07e3454..72b9918e4 100644 --- a/source/luametatex/source/lua/lmtnodelib.c +++ b/source/luametatex/source/lua/lmtnodelib.c @@ -5321,15 +5321,19 @@ static int nodelib_direct_patchattributes(lua_State *L) return 0; } +/* firstnode attributeid [nodetype] */ + static int nodelib_direct_findattribute(lua_State *L) /* returns attr value and node */ { halfword c = nodelib_valid_direct_from_index(L, 1); if (c) { halfword i = lmt_tohalfword(L, 2); + halfword t = lmt_optinteger(L, 3, -1); while (c) { - if (tex_nodetype_has_attributes(node_type(c))) { + if ((t < 0 || node_type(c) == t) && tex_nodetype_has_attributes(node_type(c))) { halfword p = node_attr(c); if (p) { + /* we could skip if the previous value is the same and didn't match */ p = node_next(p); while (p) { if (attribute_index(p) == i) { @@ -5757,6 +5761,8 @@ static int nodelib_direct_traversechar(lua_State *L) } } +/* maybe a variant that checks for an attribute */ + static int nodelib_direct_aux_next_glyph(lua_State *L) { halfword t; |