From afb7e3ea263187a5245b6c5b98b1dec025c5f430 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 2 Feb 2021 22:20:14 +0000 Subject: lua-ul (2feb21) git-svn-id: svn://tug.org/texlive/trunk@57603 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/lualatex/lua-ul/docstrip-luacode.sty | 4 +- Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.lua | 6 ++- Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.sty | 61 +++++++++++++++------- .../lualatex/lua-ul/pre_append_to_vlist_filter.lua | 4 +- 4 files changed, 50 insertions(+), 25 deletions(-) (limited to 'Master/texmf-dist/tex/lualatex') diff --git a/Master/texmf-dist/tex/lualatex/lua-ul/docstrip-luacode.sty b/Master/texmf-dist/tex/lualatex/lua-ul/docstrip-luacode.sty index 944fcdc25e6..29f055258f4 100644 --- a/Master/texmf-dist/tex/lualatex/lua-ul/docstrip-luacode.sty +++ b/Master/texmf-dist/tex/lualatex/lua-ul/docstrip-luacode.sty @@ -1,4 +1,4 @@ -%% Copyright (C) 2020 by Marcel Krueger +%% Copyright (C) 2020-2021 by Marcel Krueger %% %% This file may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -13,7 +13,7 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage {docstrip-luacode} - [2020/03/07 v0.1.0 Directly execute Lua code from DocStrip files] + [2021/02/02 v0.1.1 Directly execute Lua code from DocStrip files] \expanded{% \def\noexpand\docstrip@luacode@argscanner#1\directlua{ tex.sprint(\the\catcodetable@string, "\string\\end{docstrip-luacode}") 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 13185d92877..45518e83542 100644 --- a/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.lua +++ b/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.lua @@ -6,7 +6,7 @@ -- -- lua-ul.dtx (with options: `luacode') -- --- Copyright (C) 2020 by Marcel Krueger +-- Copyright (C) 2020-2021 by Marcel Krueger -- -- This file may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either @@ -29,6 +29,7 @@ local has_attribute = node.direct.has_attribute local set_attribute = node.direct.set_attribute local dimensions = node.direct.dimensions local flush_node = node.direct.flush_node +local getattr = node.direct.getattributelist local getboth = node.direct.getboth local getfield = node.direct.getfield local getglue = node.direct.getglue @@ -49,6 +50,7 @@ local setlink = node.direct.setlink local hpack = node.direct.hpack local setfield = node.direct.setfield local slide = node.direct.slide +local setattr = node.direct.setattributelist local setglue = node.direct.setglue local setnext = node.direct.setnext local setshift = node.direct.setshift @@ -366,6 +368,7 @@ function add_underline_hlist(head, attr, outervalue) local w, st, sh = getglue(glue) local lead = nodecopy(underline_types[last_value]) setglue(lead, -w, -st, -sh, stretch_order, shrink_order) + setattr(glue, getattr(lead)) if underline_over_flag[last_value] then head = insert_before(head, n, glue) insert_after(head, glue, lead) @@ -393,6 +396,7 @@ function add_underline_hlist(head, attr, outervalue) local w, st, sh = getglue(glue) local lead = nodecopy(underline_types[last_value]) setglue(lead, -w, -st, -sh, stretch_order, shrink_order) + setattr(glue, getattr(lead)) if underline_over_flag[last_value] then insert_before(head, nil, glue) insert_after(head, glue, lead) 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 531d03eb448..f432fb068cb 100644 --- a/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.sty +++ b/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.sty @@ -6,7 +6,7 @@ %% %% lua-ul.dtx (with options: `package') %% -%% Copyright (C) 2020 by Marcel Krueger +%% Copyright (C) 2020-2021 by Marcel Krueger %% %% This file may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,7 +20,7 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage {lua-ul} - [2020/07/13 v0.1.0 Underlining and related functionality for LuaTeX] + [2021/02/02 v0.1.1 Underlining and related functionality for LuaTeX] \ifx\directlua\undefined \PackageError{lua-ul}{LuaLaTeX required}% @@ -62,36 +62,52 @@ \def\luaul@@setcolor\xcolor@#1#2{} \newcommand\luaul@setcolor[1]{% \ifx\XC@getcolor\undefined - \def\luaul@highlight@currentcolor{#1}% + \def\luaul@currentcolor{#1}% \else \begingroup \XC@getcolor{#1}\luaul@tmpcolor \expanded{\endgroup - \def\noexpand\luaul@highlight@currentcolor{% + \def\noexpand\luaul@currentcolor{% \expandafter\luaul@@setcolor\luaul@tmpcolor}}% \fi } + \newcommand\luaul@applycolor{% + \ifx\XC@getcolor\undefined + \color{\luaul@currentcolor}% + \else + \expandafter\XC@undeclaredcolor\luaul@currentcolor + \fi + } \NewDocumentCommand\LuaULSetHighLightColor{om}{% \edef\luaul@highlight@color{\IfValueTF{#1}{[#1]{#2}}{#2}}% } - \newunderlinetype\@underLine% - {\leaders\vrule height -.65ex depth .75ex} - \newcommand\underLine[1]{{\@underLine#1}} - \newunderlinetype\@strikeThrough% - {\leaders\vrule height .55ex depth -.45ex} - \newcommand\strikeThrough[1]{{\@strikeThrough#1}} + \newunderlinetype\@underLine{% + \leaders\vrule height -.65ex depth .75ex + } + \NewDocumentCommand\underLine{m}{{\@underLine#1}} + + \newunderlinetype\@strikeThrough{% + \leaders\vrule height .55ex depth -.45ex + } + \newunderlinetype\colored@strikeThrough[\number\dimexpr1ex@% + \luaul@currentcolor]{% + \luaul@applycolor + \leaders\vrule height .55ex depth -.45ex + } + \NewDocumentCommand\strikeThrough{om}{{% + \IfValueTF{#1}{% + \luaul@setcolor{#1}% + \colored@strikeThrough + }\@strikeThrough% + #2% + }} \newunderlinetype\@highLight[\number\dimexpr1ex@% - \luaul@highlight@currentcolor]% - {% - \ifx\XC@getcolor\undefined - \color{\luaul@highlight@currentcolor}% - \else - \expandafter\XC@undeclaredcolor\luaul@highlight@currentcolor - \fi - \leaders\vrule height 1.75ex depth .75ex - } - \newcommand\highLight[2][\luaul@highlight@color]{{% + \luaul@currentcolor]{% + \luaul@applycolor + \leaders\vrule height 1.75ex depth .75ex + } + \NewDocumentCommand\highLight{O{\luaul@highlight@color}m}{{% \luaul@setcolor{#1}% \@highLight#2% }} @@ -121,6 +137,11 @@ \LuaULResetUnderline*% } \fi +\output\expandafter\expandafter\expandafter{% + \expandafter\expandafter\expandafter\LuaULResetUnderline + \expandafter\expandafter\expandafter*% + \expandafter\@firstofone\the\output% +} %% %% %% End of file `lua-ul.sty'. diff --git a/Master/texmf-dist/tex/lualatex/lua-ul/pre_append_to_vlist_filter.lua b/Master/texmf-dist/tex/lualatex/lua-ul/pre_append_to_vlist_filter.lua index 2ab110e8297..810247ddfea 100644 --- a/Master/texmf-dist/tex/lualatex/lua-ul/pre_append_to_vlist_filter.lua +++ b/Master/texmf-dist/tex/lualatex/lua-ul/pre_append_to_vlist_filter.lua @@ -6,7 +6,7 @@ -- -- lua-ul.dtx (with options: `callback') -- --- Copyright (C) 2020 by Marcel Krueger +-- Copyright (C) 2020-2021 by Marcel Krueger -- -- This file may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either @@ -27,7 +27,7 @@ local prepend_prevdepth = node.prepend_prevdepth local callback_define for i=1,5 do - local name, func = debug.getupvalue(luatexbase.disable_callback, i) +local name, func = require'debug'.getupvalue(luatexbase.disable_callback, i) if name == 'callback_register' then callback_define = func break -- cgit v1.2.3