diff options
Diffstat (limited to 'macros/luatex/generic/penlight/penlightextras.lua')
-rw-r--r-- | macros/luatex/generic/penlight/penlightextras.lua | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/macros/luatex/generic/penlight/penlightextras.lua b/macros/luatex/generic/penlight/penlightextras.lua index 7d0a7eb6b5..5f5f76aefb 100644 --- a/macros/luatex/generic/penlight/penlightextras.lua +++ b/macros/luatex/generic/penlight/penlightextras.lua @@ -1,5 +1,5 @@ --% Kale Ewasiuk (kalekje@gmail.com) ---% 2022-10-24 +--% 2023-07-18 --% Copyright (C) 2021-2022 Kale Ewasiuk --% --% Permission is hereby granted, free of charge, to any person obtaining a copy @@ -28,14 +28,16 @@ __PL_SKIP_LUAKEYS__ = __PL_SKIP_LUAKEYS__ or false __PL_GLOBALS__ = __PL_GLOBALS__ or false __PL_EXTRAS__ = 1 __PL_NO_HYPERREF__ = __PL_NO_HYPERREF__ or false +-- __PENLIGHT__ = 'penlight' or 'pl' -- requires penlight local pl = _G['penlight'] or _G['pl'] -- penlight for this namespace is pl if not __PL_SKIP_LUAKEYS__ then - luakeys = require'luakeys' + luakeys = require'luakeys'() end + -- some bonus string operations, % text operator, and functional programming pl.stringx.import() pl.stringx.format_operator() @@ -311,7 +313,7 @@ function pl.tex.get_ref_info(l) t = pl.tablex.map(string.trimfl, t) end t[#t+1] = r -- add the og return of label - pl.help_wrt(t, 'ref info') + --pl.help_wrt(t, 'ref info') return t end @@ -511,7 +513,7 @@ pl.array2d.map_slice1 = pl.tablex.map_slice -- todo option for multiple filters with AND logic, like the filter files?? function pl.tablex.filterstr(t, exp, case) -- case = case sensitive - case = hasval(case) + case = pl.hasval(case) -- apply lua patterns to a table to filter iter -- str or table of str's can be passed, OR logic is used if table is passed if case then @@ -699,12 +701,11 @@ __PDFmetadata__ = {} pl.tex.add_xspace_intext = true -function pl.tex.updatePDFtable(k, v, o) +function pl.tex.updatePDFtable(k, v, o) -- key val overwrite k = k:upfirst() - if not pl.hasval(o) and __PDFmetadata__[k] ~= nil then - return + if pl.hasval(o) or (__PDFmetadata__[k] == nil) then + __PDFmetadata__[k] = v end - __PDFmetadata__[k] = v end pl.tex.writePDFmetadata = function(t) -- write PDF metadata to xmpdata file |