diff options
author | Karl Berry <karl@freefriends.org> | 2022-09-16 20:39:06 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-09-16 20:39:06 +0000 |
commit | c77c2adbc5de3de16dd4be1dae4674212b334146 (patch) | |
tree | 73e0e6fd550e9426041fc82f48dde273a7f0ee44 /Master/texmf-dist/tex/latex/newpax/newpax.lua | |
parent | 8d4833f80b5b4471ecbc0b38eef5ac0a5cb5bcd0 (diff) |
newpax (16sep22)
git-svn-id: svn://tug.org/texlive/trunk@64415 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/newpax/newpax.lua')
-rw-r--r-- | Master/texmf-dist/tex/latex/newpax/newpax.lua | 69 |
1 files changed, 51 insertions, 18 deletions
diff --git a/Master/texmf-dist/tex/latex/newpax/newpax.lua b/Master/texmf-dist/tex/latex/newpax/newpax.lua index a3635a398ee..84af72af05b 100644 --- a/Master/texmf-dist/tex/latex/newpax/newpax.lua +++ b/Master/texmf-dist/tex/latex/newpax/newpax.lua @@ -6,7 +6,7 @@ -- -- newpax.dtx (with options: `lua') -- --- 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 @@ -20,8 +20,8 @@ -- 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" } @@ -325,6 +325,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 @@ -341,24 +344,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 |