texlive[63026] Master/texmf-dist: lua-widow-control (14apr22)

commits+karl at tug.org commits+karl at tug.org
Thu Apr 14 21:47:46 CEST 2022


Revision: 63026
          http://tug.org/svn/texlive?view=revision&revision=63026
Author:   karl
Date:     2022-04-14 21:47:46 +0200 (Thu, 14 Apr 2022)
Log Message:
-----------
lua-widow-control (14apr22)

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-14 19:47:31 UTC (rev 63025)
+++ trunk/Master/texmf-dist/doc/luatex/lua-widow-control/README.md	2022-04-14 19:47:46 UTC (rev 63026)
@@ -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.4 (2022-04-07)_ <!--%%version %%dashdate-->
+_v2.0.5 (2022-04-13)_ <!--%%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-14 19:47:31 UTC (rev 63025)
+++ trunk/Master/texmf-dist/source/luatex/lua-widow-control/lwc-documentation.tex	2022-04-14 19:47:46 UTC (rev 63026)
@@ -37,7 +37,7 @@
 \startdocument[
     title=lua-widow-control,
     author=Max Chernoff,
-    version=2.0.4, %%version
+    version=2.0.5, %%version
     github=https://github.com/gucci-on-fleek/lua-widow-control,
     ctan=https://www.ctan.org/pkg/lua-widow-control,
 ]
@@ -310,12 +310,12 @@
 
 You could just disable then reenable \lwc/ every time that you use the command; however, \lwc/ provides a convenience macro that will do this automatically for you.
 
-\Lwc/ automatically patches the default \LaTeX{}, \ConTeXt{}, and Plain~\TeX{} section commands, so you shouldn't need to patch these yourself. \Lwc/ also patches the commands provided by \sans{memoir}, \sans{\acronym{KOMA}-script}, and \sans{titlesec}. You'll need to patch any other section commands yourself.
+\Lwc/ automatically patches the default \LaTeX{}, \ConTeXt{}, Plain~\TeX{}, and Op\TeX{} section commands, so you shouldn't need to patch these yourself. \Lwc/ also patches the commands provided by \sans{memoir}, \sans{\acronym{KOMA}-script}, and \sans{titlesec}. You'll need to patch any other section commands yourself.
 
 Note that the \LaTeX{} option does not \emph{append} commands to the disable list; rather, it \emph{sets} the list from scratch. This means that you can set an empty list to disable any command patching; however, this also means that if you want to disable one command on top of the defaults, you'll also need to manually include the default list.
 
 \startTABLE
-    \NC Plain \TeX{}
+    \NC \plainop/
     \NC \inlineTEX{\lwcdisablecmd{$\meta{\backslash macro}$}}
     \NC\NR
     \NC \LaTeX{}

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-14 19:47:31 UTC (rev 63025)
+++ trunk/Master/texmf-dist/tex/context/third/lua-widow-control/t-lua-widow-control.mkiv	2022-04-14 19:47:46 UTC (rev 63026)
@@ -1,10 +1,10 @@
 %D \module
 %D   [     file=t-lua-widow-control,
-%D      version=2.0.4, %%version
+%D      version=2.0.5, %%version
 %D        title=lua-widow-control,
 %D     subtitle=\ConTeXt module for lua-widow-control,
 %D       author=Max Chernoff,
-%D         date=2022-04-07, %%dashdate
+%D         date=2022-04-13, %%dashdate
 %D    copyright=Max Chernoff,
 %D      license=MPL-2.0+,
 %D          url=https://github.com/gucci-on-fleek/lua-widow-control]
@@ -83,20 +83,21 @@
 % Expansion of some parts of the document, such as section headings, is quite
 % undesirable, so we'll disable \lwc/ for certain commands.
 % We should only reenable \lwc/ at the end if it was already enabled.
-\newif\iflwc_should_reenable
+\newcount\lwc_disable_count
 
 \define\lwc_patch_pre{%
     \iflwc%
-        \lwc_should_reenabletrue%
-        \setuplwc[state=stop]%
-    \else%
-        \lwc_should_reenablefalse
+        \advance\lwc_disable_count by 1%
+        \setuplwc[\c!state=\v!stop]%
     \fi%
 }
 
-\define\lwc_patch_post{\iflwc_should_reenable%
-    \setuplwc[state=start]%
-\fi}
+\define\lwc_patch_post{
+    \ifnum\lwc_disable_count>0%
+        \setuplwc[\c!state=\v!start]%
+        \advance\lwc_disable_count by -1%
+    \fi%
+}
 
 \prependtoks\lwc_patch_pre\to\everybeforesectionheadhandle % Sectioning
 \prependtoks\lwc_patch_post\to\everyaftersectionheadhandle

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-14 19:47:31 UTC (rev 63025)
+++ trunk/Master/texmf-dist/tex/context/third/lua-widow-control/t-lua-widow-control.mkxl	2022-04-14 19:47:46 UTC (rev 63026)
@@ -1,10 +1,10 @@
 %D \module
 %D   [     file=t-lua-widow-control,
-%D      version=2.0.4, %%version
+%D      version=2.0.5, %%version
 %D        title=lua-widow-control,
 %D     subtitle=\ConTeXt module for lua-widow-control,
 %D       author=Max Chernoff,
-%D         date=2022-04-07, %%dashdate
+%D         date=2022-04-13, %%dashdate
 %D    copyright=Max Chernoff,
 %D      license=MPL-2.0+,
 %D          url=https://github.com/gucci-on-fleek/lua-widow-control]
@@ -83,20 +83,21 @@
 % Expansion of some parts of the document, such as section headings, is quite
 % undesirable, so we'll disable \lwc/ for certain commands.
 % We should only reenable \lwc/ at the end if it was already enabled.
-\newif\iflwc_should_reenable
+\newcount\lwc_disable_count
 
 \define\lwc_patch_pre{%
     \iflwc%
-        \lwc_should_reenabletrue%
-        \setuplwc[state=stop]%
-    \else%
-        \lwc_should_reenablefalse
+        \advance\lwc_disable_count by 1%
+        \setuplwc[\c!state=\v!stop]%
     \fi%
 }
 
-\define\lwc_patch_post{\iflwc_should_reenable%
-    \setuplwc[state=start]%
-\fi}
+\define\lwc_patch_post{
+    \ifnum\lwc_disable_count>0%
+        \setuplwc[\c!state=\v!start]%
+        \advance\lwc_disable_count by -1%
+    \fi%
+}
 
 \prependtoks\lwc_patch_pre\to\everybeforesectionheadhandle % Sectioning
 \prependtoks\lwc_patch_post\to\everyaftersectionheadhandle

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-14 19:47:31 UTC (rev 63025)
+++ trunk/Master/texmf-dist/tex/lualatex/lua-widow-control/lua-widow-control.sty	2022-04-14 19:47:46 UTC (rev 63026)
@@ -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.4}{2022-04-07} %%version %%dashdate
+\DeclareCurrentRelease{v2.0.5}{2022-04-13} %%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/07} %%slashdate
-    {v2.0.4} %%version
+    {2022/04/13} %%slashdate
+    {v2.0.5} %%version
     {Use Lua to remove widows and orphans}
 
 % Unconditional Package Loads
@@ -154,26 +154,25 @@
 
 % Expansion of some parts of the document, such as section headings, is quite
 % undesirable, so we'll disable \lwc/ for certain commands.
-\bool_new:N \g__lwc_should_reenable_bool
+\int_new:N \g__lwc_disable_int
 
 \cs_new:Npn \__lwc_patch_pre: {
     % We should only reenable \lwc/ at the end if it was already enabled.
-    \__lwc_if_enabled:TF {
-        \bool_gset_true:N \g__lwc_should_reenable_bool
+    \__lwc_if_enabled:T {
+        \int_gincr:N \g__lwc_disable_int
         \__lwc_disable:
-    } {
-        \bool_gset_false:N \g__lwc_should_reenable_bool
     }
 }
 
 \cs_new:Npn \__lwc_patch_post: {
-    \bool_if:NT { \g__lwc_should_reenable_bool } {
+    \int_compare:nT { \g__lwc_disable_int > 0 } {
         \__lwc_enable:
+        \int_gdecr:N \g__lwc_disable_int
     }
 }
 
 \cs_new:Npn \__lwc_patch_cmd:c #1 {
-    \IfFormatAtLeastTF {2021/06/01 } {
+    \IfFormatAtLeastTF { 2021/06/01 } {
         \hook_gput_code:nnn { cmd / #1 / before } { \c__lwc_name_str } {
             \__lwc_patch_pre:
         }
@@ -205,6 +204,8 @@
     \clist_map_function:NN \g__lwc_disablecmds_cl \__lwc_patch_cmd:n
 }
 
+%%% Class and package-specifc patches
+
 % KOMA-Script
 \cs_if_exist:NT \AddtoDoHook {
     \AddtoDoHook { heading / begingroup } { \__lwc_patch_pre:  \use_none:n }
@@ -211,6 +212,9 @@
     \AddtoDoHook { heading / endgroup   } { \__lwc_patch_post: \use_none:n }
 }
 
+% Memoir
+\cs_gset_nopar:Npn \pen at ltyabovepfbreak { 23 } % GitHub #32
+
 % Define some final keys
 \keys_define:nn { \c__lwc_name_str } {
     enable .choice:,

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-14 19:47:31 UTC (rev 63025)
+++ trunk/Master/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.lua	2022-04-14 19:47:46 UTC (rev 63026)
@@ -107,8 +107,8 @@
         debug_print("Plain/LaTeX")
         luatexbase.provides_module {
             name = lwc.name,
-            date = "2022/04/07", --%%slashdate
-            version = "2.0.4", --%%version
+            date = "2022/04/13", --%%slashdate
+            version = "2.0.5", --%%version
             description = [[
 
 This module provides a LuaTeX-based solution to prevent

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-14 19:47:31 UTC (rev 63025)
+++ trunk/Master/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.tex	2022-04-14 19:47:46 UTC (rev 63026)
@@ -3,7 +3,7 @@
 % SPDX-License-Identifier: MPL-2.0+
 % SPDX-FileCopyrightText: 2022 Max Chernoff
 
-\wlog{lua-widow-control v2.0.4} %%version
+\wlog{lua-widow-control v2.0.5} %%version
 
 \ifx\directlua\undefined
     \errmessage{%
@@ -12,6 +12,8 @@
     }
 \fi
 
+\catcode`@=11
+
 \input ltluatex % \LuaTeX{}Base
 
 \clubpenalty=1
@@ -43,30 +45,44 @@
 
 % Expansion of some parts of the document, such as section headings, is quite
 % undesirable, so we'll disable \lwc/ for certain commands.
-\catcode`@=11
 
 % We should only reenable \lwc/ at the end if it was already enabled.
-\newif\iflwc at should@reenable
+\newcount\lwc at disable@count
 
 \def\lwc at patch@pre{%
     \iflwc%
-        \lwc at should@reenabletrue%
+        \advance\lwc at disable@count by 1%
         \lwcdisable%
-    \else%
-        \lwc at should@reenablefalse%
     \fi%
 }
 
-\def\lwc at patch@post{\iflwc at should@reenable%
-    \lwcenable%
-\fi}
+\def\lwc at patch@post{
+    \ifnum\lwc at disable@count>0%
+        \lwcenable%
+        \advance\lwc at disable@count by -1%
+    \fi
+}
 
+\def\lwc at extractcomponents #1:#2->#3\STOP{%
+    \def\lwc at params{#2}%
+    \def\lwc at body{#3}%
+}
+
 \def\lwcdisablecmd#1{%
-    \ifdefined#1
-        \expandafter\def\expandafter#1\expandafter{\lwc at patch@pre #1\lwc at patch@post}
-    \fi
+    \ifdefined#1%
+        \expandafter\lwc at extractcomponents\meaning#1\STOP%
+        \begingroup%
+            \catcode`@=11%
+            \expanded{%
+                \noexpand\scantokens{%
+                    \gdef\noexpand#1\lwc at params{%
+                        \noexpand\lwc at patch@pre\lwc at body\noexpand\lwc at patch@post%
+                    }%
+                }%
+            }%
+        \endgroup%
+    \fi%
 }
-\catcode`@=12
 
 \begingroup
     \suppressoutererror=1
@@ -73,4 +89,6 @@
     \lwcdisablecmd{\beginsection} % Sectioning
 \endgroup
 
+
+\catcode`@=12
 \endinput

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-14 19:47:31 UTC (rev 63025)
+++ trunk/Master/texmf-dist/tex/optex/lua-widow-control/lua-widow-control.opm	2022-04-14 19:47:46 UTC (rev 63026)
@@ -3,7 +3,8 @@
 % SPDX-License-Identifier: MPL-2.0+
 % SPDX-FileCopyrightText: 2022 Max Chernoff
 
-\_codedecl\lwcenable{lua-widow-control <v2.0.4>} %%version
+\_codedecl\lwcenable{lua-widow-control <v2.0.5>} %%version
+\_namespace{lwc}
 
 \_clubpenalty=1
 \_widowpenalty=1
@@ -19,11 +20,61 @@
 \_directlua{require "lua-widow-control"}
 
 % Define \TeX{} wrappers for Lua functions
-\_def\lwcenable{\_directlua{lwc.enable_callbacks()}}
-\_def\lwcdisable{\_directlua{lwc.disable_callbacks()}}
-\_def\iflwc{\_directlua{lwc.if_lwc_enabled()}}
+\_def\.enable{\_directlua{lwc.enable_callbacks()}}
+\_def\.disable{\_directlua{lwc.disable_callbacks()}}
+\_def\.iflwc{\_directlua{lwc.if_lwc_enabled()}}
 
+\_let\lwcenable=\.enable
+\_let\lwcdisable=\.disable
+
 % Enable \lwc/ by default when the package is loaded.
-\lwcenable
+\.enable
 
+% Expansion of some parts of the document, such as section headings, is quite
+% undesirable, so we'll disable \lwc/ for certain commands.
+
+% We should only reenable \lwc/ at the end if it was already enabled.
+\_newcount\.disable_count
+
+\_def\.patch_pre{%
+    \.iflwc%
+        \_advance\.disable_count by 1%
+        \.disable%
+    \_fi%
+}
+
+\_def\.patch_post{
+    \_ifnum\.disable_count>0%
+        \.enable%
+        \_advance\.disable_count by -1%
+    \_fi
+}
+
+\_def\.extractcomponents #1:#2->#3\STOP{%
+    \_def\.params{#2}%
+    \_def\.body{#3}%
+}
+
+\def\.disable_cmd#1{%
+    \_ifdefined#1%
+        \_ea\.extractcomponents\_meaning#1\STOP%
+        \_begingroup%
+            \_catcode`_=11%
+            \_expanded{%
+                \_noexpand\_scantokens{%
+                    \_gdef\_noexpand#1\.params{%
+                        \_noexpand\.patch_pre\.body\_noexpand\.patch_post%
+                    }%
+                }%
+            }%
+        \_endgroup%
+    \_fi%
+}
+\_let\lwcdisablecmd=\.disable_cmd
+
+\.disable_cmd{\_printchap}
+\.disable_cmd{\_printsec}
+\.disable_cmd{\_printsecc}
+
+\_endnamespace
 \_endcode



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