texlive[55831] Master: lua-ul (13jul20)

commits+karl at tug.org commits+karl at tug.org
Mon Jul 13 23:25:11 CEST 2020


Revision: 55831
          http://tug.org/svn/texlive?view=revision&revision=55831
Author:   karl
Date:     2020-07-13 23:25:11 +0200 (Mon, 13 Jul 2020)
Log Message:
-----------
lua-ul (13jul20)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/lualatex/lua-ul/lua-ul.pdf
    trunk/Master/texmf-dist/source/lualatex/lua-ul/lua-ul.dtx
    trunk/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.lua
    trunk/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.sty
    trunk/Master/tlpkg/libexec/ctan2tds

Modified: trunk/Master/texmf-dist/doc/lualatex/lua-ul/lua-ul.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/lualatex/lua-ul/lua-ul.dtx
===================================================================
--- trunk/Master/texmf-dist/source/lualatex/lua-ul/lua-ul.dtx	2020-07-13 21:11:36 UTC (rev 55830)
+++ trunk/Master/texmf-dist/source/lualatex/lua-ul/lua-ul.dtx	2020-07-13 21:25:11 UTC (rev 55831)
@@ -20,6 +20,7 @@
 %</gobble>
 \input docstrip.tex
 \keepsilent
+\askforoverwritefalse
 \let\MetaPrefix\relax
 \preamble
 \endpreamble
@@ -335,9 +336,11 @@
 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 = {}
@@ -355,6 +358,48 @@
 end
 local texnest = tex.nest
 
+%    \end{macrocode}
+% \changes{0.1.0}{2020-07-13}{Ensure that \texttt{\string\everyhbox} doesn't interfere with hlist scanning}
+% To avoid influence from \texttt{\string\everyhbox} we reset \texttt{\string\everyhbox} to an empty token list directly before scanning.
+% As an added complication, we need to use a name which is guaranteed to be the primitive tokenlist and we
+% might have to restore it before reading the actual argument (There might be a reason why \texttt{\string\everyhbox} was sat after all.
+% Also we have to ensure that braces swallowed by LuaTeX are balanced, otherwise we get hard to trace errors in alignment contexts.
+%    \begin{macrocode}
+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 at 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 at 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
@@ -364,7 +409,7 @@
   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
@@ -457,7 +502,6 @@
   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 =
@@ -748,7 +792,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]
 
 % \fi
 % Only \LuaLaTeX{} is supported.
@@ -762,7 +806,7 @@
 \directlua{require'lua-ul'}
 \RequirePackage{xparse}
 %    \end{macrocode}
-% We support some options. Especially \verb+minimal+ will disable the predefined commands \verb+\underLine+ and \verb+\strikeThrough+ and allow you to define similar commands with your custom settings instead, \verb+soul+ tries to replicate names of the \verb soul  package.
+% We support some options. Especially \verb+minimal+ will disable the predefined commands \verb+\underLine+ and \verb+\strikeThrough+ and allow you to define similar commands with your custom settings instead, \verb+soul+ tries to replicate names of the \verb+soul+ package.
 %    \begin{macrocode}
 \newif\ifluaul at predefined
 \newif\ifluaul at soulnames
@@ -802,7 +846,7 @@
     \expandafter\luaul at maybedefineuse
       \expanded{{\csstring#2@@#3}}%
       {\LuaULSetUnderline
-        \LuaULNewUnderlineType#1\hbox{#4\hskip0pt}%
+        \LuaULNewUnderlineType#1{#4\hskip0pt}%
   }}%
 }
 \ifluaul at predefined
@@ -818,7 +862,7 @@
   \def\luaul@@setcolor\xcolor@#1#2{}
   \newcommand\luaul at setcolor[1]{%
     \ifx\XC at getcolor\undefined
-      \def\luaul at highlight@currentcolor{#1}
+      \def\luaul at highlight@currentcolor{#1}%
     \else
       \begingroup
         \XC at getcolor{#1}\luaul at tmpcolor

Modified: trunk/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.lua	2020-07-13 21:11:36 UTC (rev 55830)
+++ trunk/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.lua	2020-07-13 21:25:11 UTC (rev 55831)
@@ -65,9 +65,11 @@
 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 @@
 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 at 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 at 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 @@
   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 @@
   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 =

Modified: trunk/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.sty
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.sty	2020-07-13 21:11:36 UTC (rev 55830)
+++ trunk/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.sty	2020-07-13 21:25:11 UTC (rev 55831)
@@ -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 at maybedefineuse
       \expanded{{\csstring#2@@#3}}%
       {\LuaULSetUnderline
-        \LuaULNewUnderlineType#1\hbox{#4\hskip0pt}%
+        \LuaULNewUnderlineType#1{#4\hskip0pt}%
   }}%
 }
 \ifluaul at predefined
@@ -62,7 +62,7 @@
   \def\luaul@@setcolor\xcolor@#1#2{}
   \newcommand\luaul at setcolor[1]{%
     \ifx\XC at getcolor\undefined
-      \def\luaul at highlight@currentcolor{#1}
+      \def\luaul at highlight@currentcolor{#1}%
     \else
       \begingroup
         \XC at getcolor{#1}\luaul at tmpcolor

Modified: trunk/Master/tlpkg/libexec/ctan2tds
===================================================================
--- trunk/Master/tlpkg/libexec/ctan2tds	2020-07-13 21:11:36 UTC (rev 55830)
+++ trunk/Master/tlpkg/libexec/ctan2tds	2020-07-13 21:25:11 UTC (rev 55831)
@@ -2844,7 +2844,7 @@
  'listings'     => 'latex',  # requires interaction
  'lmake'        => 'latex',  # requires interaction
  'lni'		=> 'tex --8bit',
- 'lua-ul'	=> 'tex',
+ 'lua-ul'	=> 'etex',
  'luaindex'     => 'lualatex --shell-escape',
  'luatexja'     => 'lualatex',
  'mandi'	=> 'pdflatex-preserve-pdf',



More information about the tex-live-commits mailing list.