summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/lualatex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-01-31 21:14:32 +0000
committerKarl Berry <karl@freefriends.org>2022-01-31 21:14:32 +0000
commit1d444b81d53d885a68ef7096605fc3bf3dba5fe8 (patch)
tree58b20743c108bbbfc2926dc50623fed565aa65fc /Master/texmf-dist/tex/lualatex
parent90e73850033e421c88fbb193007a39dad5b4b759 (diff)
autopuncitems (31jan22)
git-svn-id: svn://tug.org/texlive/trunk@61825 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/lualatex')
-rw-r--r--Master/texmf-dist/tex/lualatex/autopuncitems/autopuncitems.lua13
-rw-r--r--Master/texmf-dist/tex/lualatex/autopuncitems/autopuncitems.sty6
2 files changed, 14 insertions, 5 deletions
diff --git a/Master/texmf-dist/tex/lualatex/autopuncitems/autopuncitems.lua b/Master/texmf-dist/tex/lualatex/autopuncitems/autopuncitems.lua
index fc0a4b38b5e..07b68e3ed44 100644
--- a/Master/texmf-dist/tex/lualatex/autopuncitems/autopuncitems.lua
+++ b/Master/texmf-dist/tex/lualatex/autopuncitems/autopuncitems.lua
@@ -1,5 +1,5 @@
--% Kale Ewasiuk (kalekje@gmail.com)
---% 2022-01-18
+--% 2022-01-30
--% Copyright (C) 2021-2022 Kale Ewasiuk
--%
--% Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -41,6 +41,7 @@ ap.pass = '\\APpass' -- flag for passing item from punc, but still considered in
ap.code = 0 -- code for skipping punc if > 0, keep in count if == 1, omit from count if == 2
ap.autopassnested = true
+ap.skipnextprot = false
function ap.start(s)
ap.curr = 0
@@ -70,6 +71,8 @@ function ap.getdelim()
return d
end
+
+
function ap.protectnest(s)
local x = ''
if ap.autopassnested then x = ap.pass..'{}' end
@@ -88,12 +91,16 @@ end
function ap.go(s)
- s = ap.protectnest(s)
+ if ap.skipnextprot then
+ s = s:gsub(ap.item, ap.itemp)
+ else
+ s = ap.protectnest(s)
+ end
ap.start(s) -- start counters
--texio.write_nl('yooo...'..s)
s = s:gsub(ap.itemp, '\0\0'):gsub('\0', '', 1) -- make all items \0\0 then change first item to one \0
s = s:gsub('(%z)(%Z*)(%z?)', -- find betwen \0 .. \0
- function(it, s, _it) -- discarding duplicate item '_it' that was made in first gsub
+ function(it, s) -- discarding duplicate item '_it' that was made in first gsub
ap.addcount(s) -- add count, helps determine delimiter
return ap.rtrim(it..s)..ap.getdelim()..' '
end
diff --git a/Master/texmf-dist/tex/lualatex/autopuncitems/autopuncitems.sty b/Master/texmf-dist/tex/lualatex/autopuncitems/autopuncitems.sty
index 81c3f2dd6c3..11a4c66f69e 100644
--- a/Master/texmf-dist/tex/lualatex/autopuncitems/autopuncitems.sty
+++ b/Master/texmf-dist/tex/lualatex/autopuncitems/autopuncitems.sty
@@ -1,5 +1,5 @@
% Kale Ewasiuk (kalekje@gmail.com)
-% 2022-01-18
+% 2022-01-30
% Copyright (C) 2021-2022 Kale Ewasiuk
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -23,7 +23,7 @@
% OR OTHER DEALINGS IN THE SOFTWARE.
-\ProvidesPackage{autopuncitems}[2022-01-18]
+\ProvidesPackage{autopuncitems}[2022-01-30]
\RequirePackage{luacode}
\RequirePackage{etoolbox}
@@ -40,6 +40,8 @@
\newcommand{\disableAPautopassnest}{\luadirect{autopuncitems.autopassnested = false}}
\newcommand{\enableAPautopassnest}{\luadirect{autopuncitems.autopassnested = true}}
+\newcommand{\disableAPprotectnest}{\luadirect{autopuncitems.skipnextprot = true}}
+\newcommand{\enableAPprotectnest}{\luadirect{autopuncitems.skipnextprot = false}}
\NewDocumentCommand{\setAPeach}{m m m}{\setAPdef{#1}\setAPseclast{#2}\setAPlast{#3}} % set each one, default, second last, last
\NewDocumentCommand{\setAPall}{m}{\setAPdef{#1}\setAPseclast{#1}\setAPlast{#1}} % set all the same