summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/lua-widow-control/lwc-documentation.mkxl
diff options
context:
space:
mode:
Diffstat (limited to 'macros/luatex/generic/lua-widow-control/lwc-documentation.mkxl')
-rw-r--r--macros/luatex/generic/lua-widow-control/lwc-documentation.mkxl66
1 files changed, 46 insertions, 20 deletions
diff --git a/macros/luatex/generic/lua-widow-control/lwc-documentation.mkxl b/macros/luatex/generic/lua-widow-control/lwc-documentation.mkxl
index f8208bcc4c..a4d153de5b 100644
--- a/macros/luatex/generic/lua-widow-control/lwc-documentation.mkxl
+++ b/macros/luatex/generic/lua-widow-control/lwc-documentation.mkxl
@@ -1,9 +1,10 @@
% lua-widow-control
% https://github.com/gucci-on-fleek/lua-widow-control
% SPDX-License-Identifier: MPL-2.0+
-% SPDX-FileCopyrightText: 2021 gucci-on-fleek
+% SPDX-FileCopyrightText: 2021 Max Chernoff
\startenvironment[lwc-documentation]
+\unprotect
\mainlanguage[en]
@@ -85,6 +86,8 @@ fonts.handlers.otf.addfeature {
%%%%%%%%%%%%%%%%%%%%%%
\setuppagenumbering[location=footer, style=\ss\lining]
+\let\old@tex=\tex
+\def\tex#1{\expandafter\old@tex\normalexpanded{{#1}}} % Allow expansion in the \tex macro (for \allowbreak)
% Acronym styling
\definecharacterkerning[acronymkerning][factor=0.05]
@@ -103,7 +106,7 @@ setbounds currentpicture to boundingbox OverlayBox;
\defineoverlay[warning][\useMPgraphic{warning}]
\define[1]\warning{
- \blank[big]
+ \blank[line]
\midaligned{\framed[
frame=off,
background=warning,
@@ -115,11 +118,17 @@ setbounds currentpicture to boundingbox OverlayBox;
#1
}}
- \blank[big]
+ \blank[line]
}
-\setupitemize[each][packed][style=\lining]
-\setupcaptions[headstyle=\ssbf\lining, style=\ss]
+\setupitemize[each][
+ style=\lining,
+ inbetween={\blank[quarterline]},
+]
+\setupcaptions[
+ headstyle=\ssbf\lining,
+ style=\ss,
+]
\setupdelimitedtext[blockquote][
style=\ss,
@@ -140,13 +149,13 @@ setbounds currentpicture to boundingbox OverlayBox;
\word
\bfb
\feature[+][smallcaps]
- \spaceskip=0.4em
+ \interwordspace=0.4em
\veryraggedcenter
\stopsetups
\setuphead[section][
- before={\setuplwc[state=stop]\blank[big, preference]},
- after={\blank[medium, samepage]\setuplwc[state=start]},
+ before={\blank[big, preference]},
+ after={\blank[medium, samepage]},
textstyle=\setups{style:section},
number=no,
]
@@ -190,8 +199,30 @@ setbounds currentpicture to boundingbox OverlayBox;
title={},
author={},
version={},
+ ctan={},
+ github={},
]
+\startluacode
+local function strip_url(str)
+ local url_table = url.hashed(str)
+ url_table.fragment = nil
+ url_table.scheme = nil
+ url_table.authority = url_table.authority:gsub("^www%.", "")
+ tex.sprint(-2, url.decode(url.construct(url_table)))
+end
+
+interfaces.implement {
+ name = "strip_url",
+ actions = strip_url,
+ arguments = "1 string"
+}
+\stopluacode
+
+\define[1]\strippedurl{%
+ \goto{\tt\hyphenatedurl{\clf_strip_url{#1}}}[url(#1)]
+}
+
\startsetups[titleblock]
\startalignment [middle]
\begingroup
@@ -204,6 +235,8 @@ setbounds currentpicture to boundingbox OverlayBox;
\begingroup
\ssa\lining
+ \documentvariable{author}
+ \blank[medium]
v\,\documentvariable{version}
\par
\endgroup
@@ -212,7 +245,8 @@ setbounds currentpicture to boundingbox OverlayBox;
\blackrule[depth=-0.25\baselineskip, height=\dimexpr0.25\baselineskip + 0.4pt, width=8em]
\par
- \from[projecturl]
+ \strippedurl{\documentvariable{ctan}}
+ \strippedurl{\documentvariable{github}}
\blank[big]
\noindentation
@@ -269,24 +303,16 @@ setbounds currentpicture to boundingbox OverlayBox;
\setupbtxlist[apa][
alternative=a,
before=,
- after=,
+ after={\blank[quarterline]},
style=\lining,
margin=0pt,
width=1.5em,
]
-\unprotect
\starttexdefinition mutable protected btx:apa:url
- \goto{
- \hyphenatedurl{
- \clf_btxflush{\currentbtxdataset}{\currentbtxtag}{url}
+ \strippedurl{\clf_btxflush{\currentbtxdataset}{\currentbtxtag}{url}
}
- }[
- url(
- \clf_btxflush{\currentbtxdataset}{\currentbtxtag}{url}
- )
- ]
\stoptexdefinition
-\protect
+\protect
\stopenvironment