From c77c2adbc5de3de16dd4be1dae4674212b334146 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 16 Sep 2022 20:39:06 +0000 Subject: newpax (16sep22) git-svn-id: svn://tug.org/texlive/trunk@64415 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/latex/newpax/newpax.dtx | 73 +++++++++++++++++------- Master/texmf-dist/source/latex/newpax/newpax.ins | 4 +- 2 files changed, 55 insertions(+), 22 deletions(-) (limited to 'Master/texmf-dist/source') diff --git a/Master/texmf-dist/source/latex/newpax/newpax.dtx b/Master/texmf-dist/source/latex/newpax/newpax.dtx index 01f68546ddb..12566c70537 100644 --- a/Master/texmf-dist/source/latex/newpax/newpax.dtx +++ b/Master/texmf-dist/source/latex/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 diff --git a/Master/texmf-dist/source/latex/newpax/newpax.ins b/Master/texmf-dist/source/latex/newpax/newpax.ins index 62ec48b0c9f..ccce1d73c00 100644 --- a/Master/texmf-dist/source/latex/newpax/newpax.ins +++ b/Master/texmf-dist/source/latex/newpax/newpax.ins @@ -2,7 +2,7 @@ File: newpax.ins -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 @@ -34,7 +34,7 @@ for those people who are interested. \let\MetaPrefix\relax \preamble -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 -- cgit v1.2.3