summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-11-08 23:21:20 +0000
committerKarl Berry <karl@freefriends.org>2021-11-08 23:21:20 +0000
commite9ab0cf018b97d1ca34b3b78396d5152b19ac92c (patch)
treef23ba71514aa2ec5a8be60a0d3f3078a3e4d777a /Master/texmf-dist/tex/context
parentd15021e33a9c5e367a54267fd7c0db9798c4ba90 (diff)
lua-widow-control (9nov21)
git-svn-id: svn://tug.org/texlive/trunk@61002 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context')
-rw-r--r--Master/texmf-dist/tex/context/third/lua-widow-control/t-lua-widow-control.mkxl27
1 files changed, 23 insertions, 4 deletions
diff --git a/Master/texmf-dist/tex/context/third/lua-widow-control/t-lua-widow-control.mkxl b/Master/texmf-dist/tex/context/third/lua-widow-control/t-lua-widow-control.mkxl
index 66eeadec579..62d091aea6c 100644
--- a/Master/texmf-dist/tex/context/third/lua-widow-control/t-lua-widow-control.mkxl
+++ b/Master/texmf-dist/tex/context/third/lua-widow-control/t-lua-widow-control.mkxl
@@ -1,11 +1,11 @@
%D \module
%D [ file=t-lua-widow-control,
-%D version=1.0.0, %%version
+%D version=1.1.0, %%version
%D title=lua-widow-control,
%D subtitle=\ConTeXt module for lua-widow-control,
-%D author=gucci-on-fleek,
-%D date=2021-10-09, %%date
-%D copyright=gucci-on-fleek,
+%D author=Max Chernoff,
+%D date=2021-11-08, %%date
+%D copyright=Max Chernoff,
%D license=MPL-2.0+,
%D url=https://github.com/gucci-on-fleek/lua-widow-control]
\startmodule[lua-widow-control]
@@ -28,6 +28,8 @@
}
\to\everysetuplwc
+\define\iflwc{\ctxlua{lwc.if_lwc_enabled()}}
+
\ctxloadluafile{lua-widow-control}
\setuplwc[emergencystretch=3em, \c!state=\v!start]
@@ -50,5 +52,22 @@
\definefontfeature[default][default][expansion=quality]
\setupalign[hz]
+% 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
+
+\define\lwc@patch@pre{\iflwc%
+ \lwc@should@reenabletrue%
+ \setuplwc[state=stop]%
+\fi}
+
+\define\lwc@patch@post{\iflwc@should@reenable%
+ \setuplwc[state=start]%
+\fi}
+
+\prependtoks\lwc@patch@pre\to\everybeforesectionheadhandle % Sectioning
+\prependtoks\lwc@patch@post\to\everyaftersectionheadhandle
+
\protect
\stopmodule