summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/lua-widow-control/lua-widow-control.sty
diff options
context:
space:
mode:
Diffstat (limited to 'macros/luatex/generic/lua-widow-control/lua-widow-control.sty')
-rw-r--r--macros/luatex/generic/lua-widow-control/lua-widow-control.sty24
1 files changed, 14 insertions, 10 deletions
diff --git a/macros/luatex/generic/lua-widow-control/lua-widow-control.sty b/macros/luatex/generic/lua-widow-control/lua-widow-control.sty
index 0690a23208..62090c061b 100644
--- a/macros/luatex/generic/lua-widow-control/lua-widow-control.sty
+++ b/macros/luatex/generic/lua-widow-control/lua-widow-control.sty
@@ -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,12 +204,17 @@
\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 }
\AddtoDoHook { heading / endgroup } { \__lwc_patch_post: \use_none:n }
}
+% Memoir
+\cs_gset_nopar:Npn \pen@ltyabovepfbreak { 23 } % GitHub #32
+
% Define some final keys
\keys_define:nn { \c__lwc_name_str } {
enable .choice:,