summaryrefslogtreecommitdiff
path: root/macros/luatex/latex/autopuncitems/autopuncitems.sty
diff options
context:
space:
mode:
Diffstat (limited to 'macros/luatex/latex/autopuncitems/autopuncitems.sty')
-rw-r--r--macros/luatex/latex/autopuncitems/autopuncitems.sty40
1 files changed, 26 insertions, 14 deletions
diff --git a/macros/luatex/latex/autopuncitems/autopuncitems.sty b/macros/luatex/latex/autopuncitems/autopuncitems.sty
index 8045fa4737..81c3f2dd6c 100644
--- a/macros/luatex/latex/autopuncitems/autopuncitems.sty
+++ b/macros/luatex/latex/autopuncitems/autopuncitems.sty
@@ -1,6 +1,6 @@
% Kale Ewasiuk (kalekje@gmail.com)
-% 2021-12-20
-% Copyright (C) 2021 Kale Ewasiuk
+% 2022-01-18
+% Copyright (C) 2021-2022 Kale Ewasiuk
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
% of this software and associated documentation files (the "Software"), to deal
@@ -23,10 +23,15 @@
% OR OTHER DEALINGS IN THE SOFTWARE.
-\ProvidesPackage{autopuncitems}[2021-12-20]
+\ProvidesPackage{autopuncitems}[2022-01-18]
-\RequirePackage{enumitem}
\RequirePackage{luacode}
+\RequirePackage{etoolbox}
+
+\newtoggle{noenumitem}
+
+\DeclareOption{noenumitem}{\toggletrue{noenumitem}}
+\ProcessOptions*\relax
\luadirect{autopuncitems = require'autopuncitems'}
@@ -42,15 +47,22 @@
\NewDocumentCommand{\setAPlast}{m}{\luadirect{autopuncitems.punc[1] = \luastring{#1}}} % second last punc value
\NewDocumentCommand{\setAPseclast}{m}{\luadirect{autopuncitems.punc[2] = \luastring{#1}}} % final punc value
-\NewDocumentEnvironment{AutoPuncItemize}{ +b }{
-% \luadirect{texio.write_nl('auto >>>'..autopuncitems.go(\luastringN{#1}))}
- \luadirect{tex.print(autopuncitems.go(\luastringN{#1}))}
-}{}
+\NewDocumentEnvironment{AutoPuncItems}{ +b }{\luadirect{tex.print(autopuncitems.go(\luastringN{#1}))}}{} % does not expand
+\NewDocumentEnvironment{AutoPuncItemsO}{ +b }{\luadirect{tex.print(autopuncitems.go(\luastringO{#1}))}}{} % expands once
+\NewDocumentEnvironment{AutoPuncItemsE}{ +b }{\luadirect{tex.print(autopuncitems.go(\luastring{#1}))}}{} % full expansion IN-PROGRESS
-\SetEnumitemKey{autopunc}{
- first*=\expandafter\AutoPuncItemize,
- after=\endAutoPuncItemize,
+\iftoggle{noenumitem}{}{% do nothing to enumitem if noenumitem is passed. Useful for beamer
+ \RequirePackage{enumitem}
+ \global\SetEnumitemKey{autopunc}{
+ first*=\expandafter\AutoPuncItems,
+ after=\endAutoPuncItems,
+ }
+ \global\SetEnumitemKey{autopuncO}{
+ first*=\expandafter\AutoPuncItemsO,
+ after=\endAutoPuncItemsO,
+ }
+ \global\SetEnumitemKey{autopuncE}{
+ first*=\expandafter\AutoPuncItemsE,
+ after=\endAutoPuncItemsE,
+ }
}
-
-
-