summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/lua-widow-control/t-lua-widow-control.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'macros/luatex/generic/lua-widow-control/t-lua-widow-control.mkiv')
-rw-r--r--macros/luatex/generic/lua-widow-control/t-lua-widow-control.mkiv21
1 files changed, 11 insertions, 10 deletions
diff --git a/macros/luatex/generic/lua-widow-control/t-lua-widow-control.mkiv b/macros/luatex/generic/lua-widow-control/t-lua-widow-control.mkiv
index 83f72b3905..9ea5ee5ce2 100644
--- a/macros/luatex/generic/lua-widow-control/t-lua-widow-control.mkiv
+++ b/macros/luatex/generic/lua-widow-control/t-lua-widow-control.mkiv
@@ -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