summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/newpax/newpax.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/newpax/newpax.lua')
-rw-r--r--Master/texmf-dist/tex/latex/newpax/newpax.lua61
1 files changed, 47 insertions, 14 deletions
diff --git a/Master/texmf-dist/tex/latex/newpax/newpax.lua b/Master/texmf-dist/tex/latex/newpax/newpax.lua
index 92b94c1f014..715a721f4f4 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.51", --TAGVERSION
- date = "2021-03-07", --TAGDATE
+ version = "0.52", --TAGVERSION
+ date = "2022-06-27", --TAGDATE
description = "newpax lua code",
license = "The LATEX Project Public License 1.3c"
}
@@ -341,15 +341,48 @@ 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 dict = DICTIONARYTOTABLE(dictionary)
+ local a = "<<"
+ for k,v in pairs (dict) do
+ 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, 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
@@ -380,35 +413,35 @@ local function outputENTRY_dest (destcount,name,pagereftonum,destnamestoref,pdfe
a = a .. strARG_BEG .. data[2][2] .. strARG_END
a = a .. strKVS_BEG
if data[2][2] == constDEST_XYZ then
- if data[3][2] then
+ if data[3] and data[3][2] then
a = a .. strKV_BEG .. constKEY_DEST_X .. strVALUE_BEG .. data[3][2] .. strVALUE_END .. strKV_END
else
a = a .. strKV_BEG .. constKEY_DEST_X .. strVALUE_BEG .. mediabox[1] .. strVALUE_END .. strKV_END
end
- if data[4][2] then
+ if data[4] and data[4][2] then
a = a .. strKV_BEG .. constKEY_DEST_Y .. strVALUE_BEG .. data[4][2] .. strVALUE_END .. strKV_END
else
a = a .. strKV_BEG .. constKEY_DEST_X .. strVALUE_BEG .. mediabox[4] .. strVALUE_END .. strKV_END
end
- if data[5][2] then
+ if data[5] and data[5][2] then
a = a .. strKV_BEG .. constKEY_DEST_ZOOM .. strVALUE_BEG .. data[5][2] .. strVALUE_END .. strKV_END
end
elseif data[2][2] == constDEST_FIT then -- nothing to do
elseif data[2][2] == constDEST_FITB then -- nothing to do
elseif data[2][2] == constDEST_FITH then
- if data[3][2] then
+ if data[3] and data[3][2] then
a = a .. strKV_BEG .. constKEY_DEST_Y .. strVALUE_BEG .. data[3][2] .. strVALUE_END .. strKV_END
end
elseif data[2][2] == constDEST_FITBH then
- if data[3][2] then
+ if data[3] and data[3][2] then
a = a .. strKV_BEG .. constKEY_DEST_Y .. strVALUE_BEG .. data[3][2] .. strVALUE_END .. strKV_END
end
elseif data[2][2] == constDEST_FITV then
- if data[3][2] then
+ if data[3] and data[3][2] then
a = a .. strKV_BEG .. constKEY_DEST_X .. strVALUE_BEG .. data[3][2] .. strVALUE_END .. strKV_END
end
elseif data[2][2] == constDEST_FITBV then
- if data[3][2] then
+ if data[3] and data[3][2] then
a = a .. strKV_BEG .. constKEY_DEST_X .. strVALUE_BEG .. data[3][2] .. strVALUE_END .. strKV_END
end
elseif data[2][2] == constDEST_FITR and data[6] then