texlive[67821] Master: addtoluatexpath (5aug23)
commits+karl at tug.org
commits+karl at tug.org
Sat Aug 5 22:05:51 CEST 2023
Revision: 67821
http://tug.org/svn/texlive?view=revision&revision=67821
Author: karl
Date: 2023-08-05 22:05:51 +0200 (Sat, 05 Aug 2023)
Log Message:
-----------
addtoluatexpath (5aug23)
Modified Paths:
--------------
trunk/Master/tlpkg/bin/tlpkg-ctan-check
trunk/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc
Added Paths:
-----------
trunk/Master/texmf-dist/doc/luatex/addtoluatexpath/
trunk/Master/texmf-dist/doc/luatex/addtoluatexpath/README.md
trunk/Master/texmf-dist/tex/luatex/addtoluatexpath/
trunk/Master/texmf-dist/tex/luatex/addtoluatexpath/addtoluatexpath.sty
trunk/Master/tlpkg/tlpsrc/addtoluatexpath.tlpsrc
Added: trunk/Master/texmf-dist/doc/luatex/addtoluatexpath/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/luatex/addtoluatexpath/README.md (rev 0)
+++ trunk/Master/texmf-dist/doc/luatex/addtoluatexpath/README.md 2023-08-05 20:05:51 UTC (rev 67821)
@@ -0,0 +1,57 @@
+# addtoluatexpath
+
+
+The `addtoluatexpath` package provides a convenient way to add input and Lua package paths in your document.
+You may want this package, for example, if a `.cls` or `.sty` file is located a network or cloud storage drive.
+
+## Usage
+* You can either pass the comma-separated paths via package options like `\RequirePackage[path1,path2]{addtoluatexpath}` in pre-amble,
+ or by using the macro `\addtoluatexpath{path1,path2}` after the package has been loaded.
+* If you wish to include first-level sub-directories as well as a path, inlcude a `/*` at the end of the path.
+ eg. `\RequirePackage[C:/Users/me/Desktop/*]{addtoluatexpath}` adds your Desktop and all folders in the desktop to path.
+* If you wish to include all nested sub-directories of all levels, include a `/**` at the end of the path.
+* If you want to add to Lua path (`package.path`) only, include `notex=true` in the argument.
+* If you want to add to tex input path only, include `nolua=true` in the argument.
+ eg. `\RequirePackage[nolua=true, C:/Users/me/Desktop/*, /**]{addtoluatexpath}`
+
+## Note
+This package appends to the `package.path` Lua variable and the `\input at path` command (it first uses `\providecommand` to intialize it).
+Lua files in the added paths can then added via `require'fileinpath1'`; however `loadfile` and `dofile` still require the full path.
+`graphicx` internally uses `\input at path` as a default list of the paths;
+therefore, paths specified by this package will also include graphics if the `graphicx` package is loaded after paths are set.
+However, if `\graphicspath{}` is used after paths are added by this package, graphics search paths will not use `\input at path`, omitting the paths you added with this package.
+
+## Dependencies
+`luacode`, `luakeys`, `penlight` (only if using `*` in paths)
+
+## Repo & Contact
+
+* <https://github.com/kalekje/addtoluatexpath>
+
+* [kalekje at gmail.com](mailto:kalekje at gmail.com)
+
+
+## License
+
+Copyright (C) 2023 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
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
+OR OTHER DEALINGS IN THE SOFTWARE.
+
Property changes on: trunk/Master/texmf-dist/doc/luatex/addtoluatexpath/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/luatex/addtoluatexpath/addtoluatexpath.sty
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/addtoluatexpath/addtoluatexpath.sty (rev 0)
+++ trunk/Master/texmf-dist/tex/luatex/addtoluatexpath/addtoluatexpath.sty 2023-08-05 20:05:51 UTC (rev 67821)
@@ -0,0 +1,52 @@
+\ProvidesPackage{addtoluatexpath}[2023-08-04]
+
+\RequirePackage{luacode}
+
+\providecommand{\input at path}{} % initialize input at path if not defined yet
+
+\begin{luacode*}
+
+ function atlp_main(atlp_raw) -- add to path from raw string
+
+ local atlp_tbl = require'luakeys'().parse(atlp_raw, {naked_as_value=true}) -- paths as table
+
+ local atlp_no_lua = atlp_tbl['nolua'] or false -- check and set nolua=true
+ local atlp_no_tex = atlp_tbl['notex'] or false -- check and set notex=true
+
+ if atlp_raw:find('*') ~= nil then -- if *, must use penlight to expand subdirectories
+ penlight = require'penlight'
+ atlp_tbl = penlight.List(atlp_tbl) -- convert to pl.List for easy manipulation
+ end
+
+ for __, p in ipairs(atlp_tbl) do
+ if p:find('*') == nil then -- add paths without *, continue loop after
+ if not atlp_no_lua then package.path = package.path .. ';'..p..'/?.lua;' end
+ if not atlp_no_tex then token.set_macro('input at path', token.get_macro('input at path')..'{'..p..'/}', 'global') end
+ goto continue
+ end
+
+ local p, c = p:gsub('*','') -- if * added, include subdirectories
+ local atlp_subdirs = penlight.List(penlight.dir.getdirectories(p))
+ -- troubleshooting --texio.write_nl(penlight.pretty.write(atlp_subdirs))
+ if c == 2 then
+ atlp_subdirs = atlp_subdirs:map(function(s) return s ..'/**' end) -- add ** to subdirs for recursive inclusion
+ end
+ atlp_tbl:append(p) -- make sure p (current path without *) is still added!
+ atlp_tbl:extend(atlp_subdirs) -- extend path to include additional subdirs; the for loop is lengthened
+
+ ::continue::
+ end
+
+ -- -- troubleshooting: show all paths
+ --texio.write_nl('Lua Paths >>> \n'..package.path:gsub(';','\n'))
+ --texio.write_nl('TeX Paths >>> \n'..token.get_macro('input at path'):gsub('}{','\n'))
+
+ end
+
+ atlp_main(token.get_macro('@raw at opt@addtoluatexpath.sty'))
+
+\end{luacode*}
+
+\NewDocumentCommand{\addtoluatexpath}{m}{\luadirect{atlp_main(\luastring{#1})}} % a command
+
+\AtEndOfPackage{\let\@unprocessedoptions\relax}
Property changes on: trunk/Master/texmf-dist/tex/luatex/addtoluatexpath/addtoluatexpath.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check 2023-08-04 23:43:34 UTC (rev 67820)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check 2023-08-05 20:05:51 UTC (rev 67821)
@@ -26,7 +26,8 @@
academicons accanthis accents accessibility accfonts accsupp achemso
acmart acmconf acro acronym acroterm
active-conf actuarialangle actuarialsymbol
- addfont addliga addlines adfathesis adforn adhocfilelist adigraph
+ addfont addliga addlines addtoluatexpath
+ adfathesis adforn adhocfilelist adigraph
adjmulticol adfsymbols adjustbox adobemapping
adrconv adtrees advdate
ae aeguill aesupp afparticle afthesis
Added: trunk/Master/tlpkg/tlpsrc/addtoluatexpath.tlpsrc
===================================================================
Modified: trunk/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc 2023-08-04 23:43:34 UTC (rev 67820)
+++ trunk/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc 2023-08-05 20:05:51 UTC (rev 67821)
@@ -8,6 +8,7 @@
depend collection-basic
#
depend addliga
+depend addtoluatexpath
depend auto-pst-pdf-lua
depend barracuda
depend bezierplot
More information about the tex-live-commits
mailing list.