texlive[63125] Master/texmf-dist: lua-widow-control (24apr22)

commits+karl at tug.org commits+karl at tug.org
Sun Apr 24 22:12:31 CEST 2022


Revision: 63125
          http://tug.org/svn/texlive?view=revision&revision=63125
Author:   karl
Date:     2022-04-24 22:12:31 +0200 (Sun, 24 Apr 2022)
Log Message:
-----------
lua-widow-control (24apr22)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/luatex/lua-widow-control/README.md
    trunk/Master/texmf-dist/doc/luatex/lua-widow-control/lua-widow-control.pdf
    trunk/Master/texmf-dist/source/luatex/lua-widow-control/lwc-documentation.tex
    trunk/Master/texmf-dist/tex/context/third/lua-widow-control/t-lua-widow-control.mkiv
    trunk/Master/texmf-dist/tex/context/third/lua-widow-control/t-lua-widow-control.mkxl
    trunk/Master/texmf-dist/tex/lualatex/lua-widow-control/lua-widow-control.sty
    trunk/Master/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.lua
    trunk/Master/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.tex
    trunk/Master/texmf-dist/tex/optex/lua-widow-control/lua-widow-control.opm

Modified: trunk/Master/texmf-dist/doc/luatex/lua-widow-control/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/luatex/lua-widow-control/README.md	2022-04-24 20:11:55 UTC (rev 63124)
+++ trunk/Master/texmf-dist/doc/luatex/lua-widow-control/README.md	2022-04-24 20:12:31 UTC (rev 63125)
@@ -48,4 +48,4 @@
 Please note that a compiled document is absolutely **not** considered to be an "Executable Form" as defined by the MPL. The use of lua-widow-control in a document does not place **any** obligations on the document's author or distributors. The MPL and CC-BY-SA licenses **only** apply to you if you distribute the lua-widow-control source code or documentation.
 
 ---
-_v2.0.5 (2022-04-13)_ <!--%%version %%dashdate-->
+_v2.0.6 (2022-04-23)_ <!--%%version %%dashdate-->

Modified: trunk/Master/texmf-dist/doc/luatex/lua-widow-control/lua-widow-control.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/luatex/lua-widow-control/lwc-documentation.tex
===================================================================
--- trunk/Master/texmf-dist/source/luatex/lua-widow-control/lwc-documentation.tex	2022-04-24 20:11:55 UTC (rev 63124)
+++ trunk/Master/texmf-dist/source/luatex/lua-widow-control/lwc-documentation.tex	2022-04-24 20:12:31 UTC (rev 63125)
@@ -37,7 +37,7 @@
 \startdocument[
     title=lua-widow-control,
     author=Max Chernoff,
-    version=2.0.5, %%version
+    version=2.0.6, %%version
     github=https://github.com/gucci-on-fleek/lua-widow-control,
     ctan=https://www.ctan.org/pkg/lua-widow-control,
 ]

Modified: trunk/Master/texmf-dist/tex/context/third/lua-widow-control/t-lua-widow-control.mkiv
===================================================================
--- trunk/Master/texmf-dist/tex/context/third/lua-widow-control/t-lua-widow-control.mkiv	2022-04-24 20:11:55 UTC (rev 63124)
+++ trunk/Master/texmf-dist/tex/context/third/lua-widow-control/t-lua-widow-control.mkiv	2022-04-24 20:12:31 UTC (rev 63125)
@@ -1,10 +1,10 @@
 %D \module
 %D   [     file=t-lua-widow-control,
-%D      version=2.0.5, %%version
+%D      version=2.0.6, %%version
 %D        title=lua-widow-control,
 %D     subtitle=\ConTeXt module for lua-widow-control,
 %D       author=Max Chernoff,
-%D         date=2022-04-13, %%dashdate
+%D         date=2022-04-23, %%dashdate
 %D    copyright=Max Chernoff,
 %D      license=MPL-2.0+,
 %D          url=https://github.com/gucci-on-fleek/lua-widow-control]

Modified: trunk/Master/texmf-dist/tex/context/third/lua-widow-control/t-lua-widow-control.mkxl
===================================================================
--- trunk/Master/texmf-dist/tex/context/third/lua-widow-control/t-lua-widow-control.mkxl	2022-04-24 20:11:55 UTC (rev 63124)
+++ trunk/Master/texmf-dist/tex/context/third/lua-widow-control/t-lua-widow-control.mkxl	2022-04-24 20:12:31 UTC (rev 63125)
@@ -1,10 +1,10 @@
 %D \module
 %D   [     file=t-lua-widow-control,
-%D      version=2.0.5, %%version
+%D      version=2.0.6, %%version
 %D        title=lua-widow-control,
 %D     subtitle=\ConTeXt module for lua-widow-control,
 %D       author=Max Chernoff,
-%D         date=2022-04-13, %%dashdate
+%D         date=2022-04-23, %%dashdate
 %D    copyright=Max Chernoff,
 %D      license=MPL-2.0+,
 %D          url=https://github.com/gucci-on-fleek/lua-widow-control]

Modified: trunk/Master/texmf-dist/tex/lualatex/lua-widow-control/lua-widow-control.sty
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/lua-widow-control/lua-widow-control.sty	2022-04-24 20:11:55 UTC (rev 63124)
+++ trunk/Master/texmf-dist/tex/lualatex/lua-widow-control/lua-widow-control.sty	2022-04-24 20:12:31 UTC (rev 63125)
@@ -13,7 +13,7 @@
 
 \DeclareRelease{}{0000-00-00}{lua-widow-control-2022-02-22.sty}
 \DeclareRelease{v1.1.6}{2022-02-22}{lua-widow-control-2022-02-22.sty}
-\DeclareCurrentRelease{v2.0.5}{2022-04-13} %%version %%dashdate
+\DeclareCurrentRelease{v2.0.6}{2022-04-23} %%version %%dashdate
 
 % If this version of LaTeX doesn't support command hooks, then we load
 % the last v1.1.X version of the package.
@@ -23,8 +23,8 @@
 
 \ProvidesExplPackage
     {lua-widow-control}
-    {2022/04/13} %%slashdate
-    {v2.0.5} %%version
+    {2022/04/23} %%slashdate
+    {v2.0.6} %%version
     {Use Lua to remove widows and orphans}
 
 % Unconditional Package Loads
@@ -72,7 +72,9 @@
 }
 
 % Define (most of) the keys
-\keys_define:nn { \c__lwc_name_str } {
+\cs_generate_variant:Nn \keys_define:nn { Vn }
+
+\keys_define:Vn { \c__lwc_name_str } {
     emergencystretch .dim_gset:N       = \g__lwc_emergencystretch_dim,
     emergencystretch .value_required:n = true,
     emergencystretch .initial:x        = \dim_max:nn { 3em } { 30pt },
@@ -213,10 +215,10 @@
 }
 
 % Memoir
-\cs_gset_nopar:Npn \pen at ltyabovepfbreak { 23 } % GitHub #32
+\cs_gset_nopar:Npn \pen at ltyabovepfbreak { 23 } % Issue #32
 
 % Define some final keys
-\keys_define:nn { \c__lwc_name_str } {
+\keys_define:Vn { \c__lwc_name_str } {
     enable .choice:,
     enable / true  .code:n     = \__lwc_enable:,
     enable / false .code:n     = \__lwc_disable:,
@@ -260,9 +262,12 @@
 }
 
 % Add the user interface for the keys
-\ProcessKeysPackageOptions{ \c__lwc_name_str }
+\exp_args:NV \ProcessKeysPackageOptions { \c__lwc_name_str }
 
-\NewDocumentCommand \lwcsetup {m} { \keys_set:nn{\c__lwc_name_str}{#1} }
+\cs_generate_variant:Nn \keys_set:nn { Vn }
+\NewDocumentCommand \lwcsetup {m} {
+    \keys_set:Vn { \c__lwc_name_str }{ #1 }
+}
 
 % Legacy Commands
 \NewDocumentCommand \lwcemergencystretch { } {

Modified: trunk/Master/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.lua	2022-04-24 20:11:55 UTC (rev 63124)
+++ trunk/Master/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.lua	2022-04-24 20:12:31 UTC (rev 63125)
@@ -23,7 +23,6 @@
     end
 end
 
-
 --[[
     \lwc/ is intended to be format-agonistic. It only runs on Lua\TeX{},
     but there are still some slight differences between formats. Here, we
@@ -50,7 +49,7 @@
     This is probably a useless micro-optimization, but it can't hurt.
   ]]
 local last = node.slide
-local copy = node.copy_list
+local copy = node.copy_list or node.copylist
 local par_id = node.id("par") or node.id("local_par")
 local glue_id = node.id("glue")
 local glyph_id = node.id("glyph")
@@ -61,19 +60,13 @@
 local find_attribute = node.find_attribute or node.findattribute
 local flush_list = node.flush_list or node.flushlist
 local free = node.free
+local node_id = node.is_node or node.isnode
 local min_col_width = tex.sp("250pt")
 
 --[[
     Package/module initialization
   ]]
-local warning,
-      info,
-      attribute,
-      contrib_head,
-      stretch_order,
-      pagenum,
-      emergencystretch,
-      max_cost
+local warning, info, attribute, contrib_head, stretch_order, pagenum, emergencystretch, max_cost
 
 if lmtx then
     debug_print("LMTX")
@@ -107,8 +100,8 @@
         debug_print("Plain/LaTeX")
         luatexbase.provides_module {
             name = lwc.name,
-            date = "2022/04/13", --%%slashdate
-            version = "2.0.5", --%%version
+            date = "2022/04/23", --%%slashdate
+            version = "2.0.6", --%%version
             description = [[
 
 This module provides a LuaTeX-based solution to prevent
@@ -137,7 +130,6 @@
     return "At " .. pagenum() .. "/" .. #paragraphs
 end
 
-
 --[[
     Function definitions
   ]]
@@ -223,12 +215,10 @@
     debug_print(get_location(), chars)
 end
 
-
 function lwc.paragraph_cost(demerits, lines)
     return demerits / math.sqrt(lines)
 end
 
-
 --- Saves each paragraph, but lengthened by 1 line
 function lwc.save_paragraphs(head)
     -- Ensure that we were actually given a par (only under \ConTeXt{} for some reason)
@@ -241,7 +231,7 @@
     -- Prevent the "underfull hbox" warnings when we store a potential paragraph
     local renable_box_warnings
     if (context or optex) or
-       #luatexbase.callback_descriptions("hpack_quality") == 0
+        #luatexbase.callback_descriptions("hpack_quality") == 0
     then -- See #18 and michal-h21/linebreaker#3
         renable_box_warnings = true
         lwc.callbacks.disable_box_warnings.enable()
@@ -302,7 +292,6 @@
     return head
 end
 
-
 local last_paragraph = 0
 --- Tags the beginning and the end of each paragraph as it is added to the page.
 ---
@@ -330,7 +319,7 @@
     local prev
 
     while head.next do
-        local id = node.is_node(head) -- Returns the internal node id
+        local id = node_id(head)
 
         if ids[id] then
             warning [[Circular node list detected!
@@ -377,19 +366,19 @@
         The list of penalties is from:
         https://tug.org/TUGboat/tb39-3/tb123mitt-widows-code.pdf#subsection.0.2.1
       ]]
-    if  penalty ~= 0 and
-        penalty <  10000 and
-       (penalty == widowpenalty or
-        penalty == displaywidowpenalty or
-        penalty == clubpenalty or
-        penalty == clubpenalty + widowpenalty or
-        penalty == clubpenalty + displaywidowpenalty or
-        penalty == brokenpenalty or
-        penalty == brokenpenalty + widowpenalty or
-        penalty == brokenpenalty + displaywidowpenalty or
-        penalty == brokenpenalty + clubpenalty or
-        penalty == brokenpenalty + clubpenalty + widowpenalty or
-        penalty == brokenpenalty + clubpenalty + displaywidowpenalty) and
+    if penalty ~= 0 and
+        penalty < 10000 and
+        (penalty == widowpenalty or
+            penalty == displaywidowpenalty or
+            penalty == clubpenalty or
+            penalty == clubpenalty + widowpenalty or
+            penalty == clubpenalty + displaywidowpenalty or
+            penalty == brokenpenalty or
+            penalty == brokenpenalty + widowpenalty or
+            penalty == brokenpenalty + displaywidowpenalty or
+            penalty == brokenpenalty + clubpenalty or
+            penalty == brokenpenalty + clubpenalty + widowpenalty or
+            penalty == brokenpenalty + clubpenalty + displaywidowpenalty) and
         #paragraphs >= 1 then
     else
         paragraphs = {}
@@ -407,7 +396,7 @@
     -- We find the current "best" replacement, then free the unused ones
     for i, paragraph in pairs(paragraphs) do
         if paragraph.cost < best_cost and
-           i ~= last_paragraph
+            i ~= last_paragraph
         then
             -- Clear the old best paragraph
             flush_list(paragraphs[paragraph_index].node)
@@ -432,7 +421,7 @@
     )
 
     if best_cost > tex.getcount(max_cost) or
-       paragraph_index == last_paragraph
+        paragraph_index == last_paragraph
     then
         -- If the best replacement is too bad, we can't do anything
         warning("Widow/Orphan NOT removed on page " .. pagenum())
@@ -523,7 +512,7 @@
     end
 
     info(
-    "Widow/orphan successfully removed at paragraph "
+        "Widow/orphan successfully removed at paragraph "
         .. paragraph_index
         .. " on page "
         .. pagenum()
@@ -642,7 +631,6 @@
     end
 end
 
-
 -- Activate \lwc/
 if plain or latex then
     silence_luatexbase()

Modified: trunk/Master/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.tex
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.tex	2022-04-24 20:11:55 UTC (rev 63124)
+++ trunk/Master/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.tex	2022-04-24 20:12:31 UTC (rev 63125)
@@ -3,7 +3,7 @@
 % SPDX-License-Identifier: MPL-2.0+
 % SPDX-FileCopyrightText: 2022 Max Chernoff
 
-\wlog{lua-widow-control v2.0.5} %%version
+\wlog{lua-widow-control v2.0.6} %%version
 
 \ifx\directlua\undefined
     \errmessage{%

Modified: trunk/Master/texmf-dist/tex/optex/lua-widow-control/lua-widow-control.opm
===================================================================
--- trunk/Master/texmf-dist/tex/optex/lua-widow-control/lua-widow-control.opm	2022-04-24 20:11:55 UTC (rev 63124)
+++ trunk/Master/texmf-dist/tex/optex/lua-widow-control/lua-widow-control.opm	2022-04-24 20:12:31 UTC (rev 63125)
@@ -3,7 +3,7 @@
 % SPDX-License-Identifier: MPL-2.0+
 % SPDX-FileCopyrightText: 2022 Max Chernoff
 
-\_codedecl\lwcenable{lua-widow-control <v2.0.5>} %%version
+\_codedecl\lwcenable{lua-widow-control <v2.0.6>} %%version
 \_namespace{lwc}
 
 \_clubpenalty=1



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