diff options
author | Karl Berry <karl@freefriends.org> | 2020-07-13 21:25:11 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-07-13 21:25:11 +0000 |
commit | 1bdbf077bf4fdc35723513987d890907a2d47ed6 (patch) | |
tree | ef017282408c2fb5917c0803582fca7907cb325b /Master/texmf-dist/tex | |
parent | 3e77979c65d09a262497f9d5df7414009d5c6a4a (diff) |
lua-ul (13jul20)
git-svn-id: svn://tug.org/texlive/trunk@55831 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.lua | 40 | ||||
-rw-r--r-- | Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.sty | 6 |
2 files changed, 41 insertions, 5 deletions
diff --git a/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.lua b/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.lua index 581370206b5..13185d92877 100644 --- a/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.lua +++ b/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.lua @@ -65,9 +65,11 @@ local set_lua = token.set_lua local scan_keyword = token.scan_keyword local scan_list = token.scan_list local scan_int = token.scan_int +local scan_toks = token.scan_toks local put_next = token.put_next local texerror = tex.error +local functions = lua.get_functions_table() local char_given = token.command_id'char_given' local underlineattrs = {} @@ -85,6 +87,41 @@ local vmode do end local texnest = tex.nest +local scan_raw_hlist do + local create = token.create + local lbrace, rbrace = token.new(0x7B, 1), token.new(0x7D, 2) + tex.enableprimitives('luaul@', {'everyhbox'}) + local set_everyhbox do + local set_toks1, set_toks2 = {create'immediateassignment', + create'luaul@everyhbox', lbrace}, + {rbrace, create'relax'} + function set_everyhbox(t) + token.put_next(set_toks2) + token.put_next(t) + token.put_next(set_toks1) + token.scan_token() + end + end + local func = luatexbase.new_luafunction"luaul.restore_everyhbox" + local everyhbox_saved + functions[func] = function() set_everyhbox(everyhbox_saved) end + local toks = {rbrace, -- Housekeeping, only for balance reasons + lbrace, create'the', create'luaul@everyhbox', rbrace, + create'hpack', lbrace, + token.new(func, token.command_id'lua_call')} + function scan_raw_hlist() + assert(token.get_next().command == 1) + put_next(toks) + token.get_next() -- Scan a corresponding brace to keep TeX's brace tracking happy + local saved_toks = scan_toks(false, true) + everyhbox_saved = saved_toks + set_everyhbox{} + local list = scan_list() + set_everyhbox(saved_toks) + return list + end +end + local saved_values = {} local function new_underline_type() for i=1,#underlineattrs do @@ -94,7 +131,7 @@ local function new_underline_type() end local strict_flag = scan_keyword'strict' local over_flag = scan_keyword'over' - local b = todirect(scan_list()) + local b = todirect(scan_raw_hlist()) for i=1,#underlineattrs do tex.attribute[underlineattrs[i]] = saved_values[i] end @@ -179,7 +216,6 @@ local function reset_underline() end tex.attribute[j] = -0x7FFFFFFF end -local functions = lua.get_functions_table() local new_underline_type_func = luatexbase.new_luafunction"luaul.new_underline_type" local set_underline_func = diff --git a/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.sty b/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.sty index 11323eb9f02..531d03eb448 100644 --- a/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.sty +++ b/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.sty @@ -20,7 +20,7 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage {lua-ul} - [2020/03/31 v0.0.4 Underlining and related functionality for LuaTeX] + [2020/07/13 v0.1.0 Underlining and related functionality for LuaTeX] \ifx\directlua\undefined \PackageError{lua-ul}{LuaLaTeX required}% @@ -54,7 +54,7 @@ \expandafter\luaul@maybedefineuse \expanded{{\csstring#2@@#3}}% {\LuaULSetUnderline - \LuaULNewUnderlineType#1\hbox{#4\hskip0pt}% + \LuaULNewUnderlineType#1{#4\hskip0pt}% }}% } \ifluaul@predefined @@ -62,7 +62,7 @@ \def\luaul@@setcolor\xcolor@#1#2{} \newcommand\luaul@setcolor[1]{% \ifx\XC@getcolor\undefined - \def\luaul@highlight@currentcolor{#1} + \def\luaul@highlight@currentcolor{#1}% \else \begingroup \XC@getcolor{#1}\luaul@tmpcolor |