summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/newpax/newpax.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/newpax/newpax.dtx')
-rw-r--r--macros/latex/contrib/newpax/newpax.dtx73
1 files changed, 53 insertions, 20 deletions
diff --git a/macros/latex/contrib/newpax/newpax.dtx b/macros/latex/contrib/newpax/newpax.dtx
index 01f68546dd..12566c7053 100644
--- a/macros/latex/contrib/newpax/newpax.dtx
+++ b/macros/latex/contrib/newpax/newpax.dtx
@@ -2,7 +2,7 @@
%
% File: newpax.dtx
% Copyright 2006-2008, 2011, 2012 Heiko Oberdiek (original pax.sty)
-% Copyright (C) 2021 Ulrike Fischer
+% Copyright (C) 2021, 2022 Ulrike Fischer
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -29,7 +29,7 @@
%<@@=newpax>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{newpax}%
- [2021-03-07 v0.51 Annotation support for PDF graphics based on pax.sty adapted by (UF)]%
+ [2022-09-15 v0.53 Annotation support for PDF graphics based on pax.sty adapted by (UF)]%
\ExplSyntaxOn
\bool_if:nF
{
@@ -39,7 +39,7 @@
\PackageError{newpax}
{
PDF~resource~management~code~not~found!\MessageBreak
- newpage~will~no~work.
+ newpax~will~no~work.
}
{
Load~it~with \MessageBreak
@@ -701,8 +701,8 @@
%<*lua>
local ProvidesLuaModule = {
name = "newpax",
- version = "0.52", --TAGVERSION
- date = "2022-09-11", --TAGDATE
+ version = "0.53", --TAGVERSION
+ date = "2022-09-15", --TAGDATE
description = "newpax lua code",
license = "The LATEX Project Public License 1.3c"
}
@@ -1015,6 +1015,9 @@ end
local function outputKV_uri (pdfedict)
local type, value, hex = GETFROMDICTIONARY(pdfedict,constKEY_URI)
+ if TYPE(value) == "pdfe.reference" then
+ type,value,hex = GETFROMREFERENCE(value)
+ end
local a= strKV_BEG .. constKEY_URI .. strVALUE_BEG
if hex then
a = a .. strHEX_STR_BEG .. value .. strHEX_STR_END
@@ -1031,24 +1034,54 @@ local function outputKV_N (pdfedict)
return a
end
+-- if a gotoR has a filespec filespec we use this
+-- to output the reference. It is rather crude and handles only names and strings
+local function outputDICT (dictionary)
+ local tkeys = {}
+ local dict = DICTIONARYTOTABLE(dictionary)
+ for name,value in pairs(dict) do
+ table.insert(tkeys,name)
+ end
+ table.sort(tkeys)
+ local a = "<<"
+ for _,k in ipairs (tkeys) do
+ v=dict[k]
+ a = a .. strNAME.. k
+ if v[1]== 5 then -- it is a name
+ b = string.gsub(v[2], "/", "#2F")
+ a = a .. strNAME .. b
+ elseif v[1] == 6 then -- it is a string
+ local b
+ if v[3] then
+ b = "<" .. v[2] .. ">"
+ else
+ b = "(" .. v[2] .. ")"
+ end
+ a = a ..strRECT_SEP .. b
+ -- everything else is ignored for now!
+ end
+ end
+ a = a .. ">>"
+ return a
+end
+
local function outputKV_gotor (pdfedict) -- action dictionary
- local type, value, desttype, destvalue, hex
- local checktype, checkvalue, checkhex = GETFROMDICTIONARY(pdfedict,"F")
- if checktype==10 then
- -- TODO resolve reference deeper!!
- local a,b,c= GETFROMREFERENCE(checkvalue)
- type, value, hex = GETFROMDICTIONARY(b,"F")
- desttype,destvalue = GETFROMDICTIONARY(b,"D")
- else
- value=checkvalue
- desttype,destvalue = GETFROMDICTIONARY(pdfedict,"D")
- end
+ local type, value, hex = GETFROMDICTIONARY(pdfedict,"F")
+ local desttype, destvalue, destdetail = GETFROMDICTIONARY(pdfedict,"D")
local a = strKV_BEG .. constKEY_FILE .. strVALUE_BEG
- a = strKV_BEG .. constKEY_FILE .. strVALUE_BEG
- if hex then
- a = a .. strHEX_STR_BEG .. value .. strHEX_STR_END
+ if TYPE(value) == "pdfe.reference" then
+ local x,dictionary = GETFROMREFERENCE(value)
+ if TYPE(dictionary) == "pdfe.dictionary" then
+ a = a .. outputDICT (dictionary)
+ else
+ print("ERROR!? this is not a dictionary!!")
+ end
else
- a = a .. strLIT_STR_BEG .. value .. strLIT_STR_END
+ if hex then
+ a = a .. strHEX_STR_BEG .. value .. strHEX_STR_END
+ else
+ a = a .. strLIT_STR_BEG .. value .. strLIT_STR_END
+ end
end
a = a .. strVALUE_END .. strKV_END
if desttype == 7 then