diff options
author | Hans Hagen <pragma@wxs.nl> | 2021-10-15 15:03:57 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2021-10-15 15:03:57 +0200 |
commit | 6ca88e6f1f15cea89db047839c3126a501f39eea (patch) | |
tree | e87d8a0ad20389157a8ccb02278d3a94152877c9 /tex | |
parent | cc7fcf11d31b2db23ba3adca896507f9faf128cc (diff) | |
download | context-6ca88e6f1f15cea89db047839c3126a501f39eea.tar.gz |
2021-10-15 13:59:00
Diffstat (limited to 'tex')
31 files changed, 478 insertions, 243 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 33a8cdb40..a550984d2 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2021.10.13 16:56} +\newcontextversion{2021.10.15 13:57} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index 2cf44c56b..6eaebb20d 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2021.10.13 16:56} +\edef\contextversion{2021.10.15 13:57} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-nl.mkii b/tex/context/base/mkii/mult-nl.mkii index 1aac09199..9095e93ed 100644 --- a/tex/context/base/mkii/mult-nl.mkii +++ b/tex/context/base/mkii/mult-nl.mkii @@ -188,6 +188,7 @@ \setinterfacevariable{enumeration}{doornummering} \setinterfacevariable{environment}{omgeving} \setinterfacevariable{even}{even} +\setinterfacevariable{explicit}{explicit} \setinterfacevariable{export}{export} \setinterfacevariable{external}{extern} \setinterfacevariable{extremestretch}{extremestretch} diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 022391a60..c97e9b74b 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2021.10.13 16:56} +\newcontextversion{2021.10.15 13:57} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index ed579d53a..24aa443d2 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -45,7 +45,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2021.10.13 16:56} +\edef\contextversion{2021.10.15 13:57} %D Kind of special: diff --git a/tex/context/base/mkiv/mult-def.lua b/tex/context/base/mkiv/mult-def.lua index bb3f458bf..7c62df864 100644 --- a/tex/context/base/mkiv/mult-def.lua +++ b/tex/context/base/mkiv/mult-def.lua @@ -7,7 +7,11 @@ if not modules then modules = { } end modules ['mult-def'] = { dataonly = true, } --- we can remove some commands, like inleftmargin and so (see typo-mar.mkiv) +-- We can remove some commands, like inleftmargin and so (see typo-mar.mkiv). Also, +-- some keywords are unique for mkiv or lmtx so at some point we might split this +-- file. On the other hand, it's a way to standardize. + +-- StartMovie and StartSound etc can go. return { ["commands"]={ diff --git a/tex/context/base/mkiv/spac-ver.lua b/tex/context/base/mkiv/spac-ver.lua index efc157a2b..9e0bc2dd8 100644 --- a/tex/context/base/mkiv/spac-ver.lua +++ b/tex/context/base/mkiv/spac-ver.lua @@ -172,7 +172,7 @@ local nodepool = nuts.pool local new_penalty = nodepool.penalty local new_kern = nodepool.kern -local new_glue = nodepool.glue +----- new_glue = nodepool.glue local new_rule = nodepool.rule local nodecodes = nodes.nodecodes diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 50a3a1f99..6bcf6b371 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex 57b1a2f59..aaba8ae4f 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/strc-doc.lua b/tex/context/base/mkiv/strc-doc.lua index 9094446c1..d613d1aa7 100644 --- a/tex/context/base/mkiv/strc-doc.lua +++ b/tex/context/base/mkiv/strc-doc.lua @@ -40,6 +40,8 @@ local v_all = variables.all local v_positive = variables.positive local v_current = variables.current +local texgetcount = tex.getcount + local trace_sectioning = false trackers.register("structures.sectioning", function(v) trace_sectioning = v end) local trace_details = false trackers.register("structures.details", function(v) trace_details = v end) @@ -48,6 +50,7 @@ local report_used = logs.reporter("structure") local context = context local commands = commands +local ctx_doifelse = commands.doifelse local structures = structures local helpers = structures.helpers @@ -1211,3 +1214,80 @@ implement { name = "popsectionblock", actions = sections.popblock, } + +interfaces.implement { + name = "doifelsefirstsectionpage", + arguments = "1 argument", + public = true, + protected = true, + actions = function(name) + local found = false + -- local list = structures.lists.collected + local list = lists.collected + if list then + local realpage = texgetcount("realpageno") + for i=1,#list do + local listdata = list[i] + local metadata = listdata.metadata + if metadata and metadata.kind == "section" and metadata.name == name then + -- local current = structures.documents.data.status[metadata.level] + local current = data.status[metadata.level] + if current and current.references.internal == listdata.references.internal then + found = listdata.references.realpage == realpage + break + end + end + end + end + ctx_doifelse(found) + end, +} + +-- could be faster (in huge lists) + +-- local firstpages = table.setmetatableindex(function(t,name) +-- -- local list = structures.lists.collected +-- local list = lists.collected +-- local pages = { } +-- if list then +-- for i=1,#list do +-- local listdata = list[i] +-- local metadata = listdata.metadata +-- if metadata and metadata.kind == "section" and metadata.name == name then +-- local references = listdata.references +-- if references then +-- pages[references.internal] = listdata +-- end +-- end +-- end +-- end +-- t[name] = pages +-- return pages +-- end) +-- +-- interfaces.implement { +-- name = "doifelsefirstsectionpage", +-- arguments = "1 argument", +-- public = true, +-- protected = true, +-- actions = function(name) +-- local found = firstpages[name] +-- if found then +-- local level = structures.sections.levelmap[name] +-- if level then +-- -- local current = structures.documents.data.status[level] +-- local current = data.status[level] +-- if current then +-- local realpage = texgetcount("realpageno") +-- found = found[current.references.internal] +-- found = found and found.references.realpage == realpage +-- else +-- found = false +-- end +-- else +-- found = false +-- end +-- end +-- ctx_doifelse(found) +-- end, +-- } diff --git a/tex/context/base/mkiv/strc-ref.lua b/tex/context/base/mkiv/strc-ref.lua index ba4ee9c5d..2dee95b40 100644 --- a/tex/context/base/mkiv/strc-ref.lua +++ b/tex/context/base/mkiv/strc-ref.lua @@ -2662,7 +2662,6 @@ end implement { name = "referenceposx", actions = function() context("%p",referencepos("x")) end } implement { name = "referenceposy", actions = function() context("%p",referencepos("y")) end } - implement { name = "referencecolumn", actions = function() diff --git a/tex/context/base/mkxl/back-pdf.mkxl b/tex/context/base/mkxl/back-pdf.mkxl index 5770e6aad..d8b5bd6ee 100644 --- a/tex/context/base/mkxl/back-pdf.mkxl +++ b/tex/context/base/mkxl/back-pdf.mkxl @@ -35,7 +35,7 @@ \registerctxluafile{lpdf-grp}{autosuffix} \registerctxluafile{lpdf-wid}{autosuffix} \registerctxluafile{lpdf-fld}{autosuffix} -\registerctxluafile{lpdf-mov}{autosuffix} +%registerctxluafile{lpdf-mov}{autosuffix} \registerctxluafile{lpdf-u3d}{autosuffix} % this will become a module %registerctxluafile{lpdf-swf}{} % this will become a module \registerctxluafile{lpdf-tag}{autosuffix} diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index d206418cf..e1b48998e 100644 --- a/tex/context/base/mkxl/cont-new.mkxl +++ b/tex/context/base/mkxl/cont-new.mkxl @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2021.10.13 16:56} +\newcontextversion{2021.10.15 13:57} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl index 670c6e383..698a259ef 100644 --- a/tex/context/base/mkxl/context.mkxl +++ b/tex/context/base/mkxl/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \immutable\edef\contextformat {\jobname} -\immutable\edef\contextversion{2021.10.13 16:56} +\immutable\edef\contextversion{2021.10.15 13:57} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error diff --git a/tex/context/base/mkxl/core-uti.lmt b/tex/context/base/mkxl/core-uti.lmt index de514df30..2266119de 100644 --- a/tex/context/base/mkxl/core-uti.lmt +++ b/tex/context/base/mkxl/core-uti.lmt @@ -289,7 +289,6 @@ function job.save(filename) -- we could return a table but it can get pretty lar f:write("local utilitydata = { }\n\n") f:write(serialize(comment,"utilitydata.comment",true),"\n\n") for l=1,#savelist do - -- f:write("do\n\n") -- no solution for the jit limitatione either local list = savelist[l] local target = format("utilitydata.%s",list[1]) local data = list[2] @@ -310,14 +309,11 @@ function job.save(filename) -- we could return a table but it can get pretty lar else f:write(definer,"\n\n",serialize(data,name,true),"\n\n") end - -- f:write("end\n\n") end if job.pack then packers.strip(jobpacker) -packnumberdata(jobpacker.index) - -- f:write("do\n\n") + packnumberdata(jobpacker.index) f:write(serialize(jobpacker,"utilitydata.job.packed",true),"\n\n") - -- f:write("end\n\n") end f:write("return utilitydata") f:close() @@ -346,9 +342,8 @@ local function load(filename) return data end else - os.remove(filename) -- probably a bad file (or luajit overflow as it cannot handle large tables well) - report_passes("removing stale job data file %a, restart job, message: %s%s",filename,tostring(data), - jit and " (try luatex instead of luajittex)" or "") + os.remove(filename) + report_passes("removing stale job data file %a, restart job, message: %s",filename,tostring(data)) os.exit(true) -- trigger second run end end diff --git a/tex/context/base/mkxl/grph-inc.lmt b/tex/context/base/mkxl/grph-inc.lmt index 0b83718f8..e19b48e49 100644 --- a/tex/context/base/mkxl/grph-inc.lmt +++ b/tex/context/base/mkxl/grph-inc.lmt @@ -322,7 +322,8 @@ local figure_paths = allocate(table.copy(figures.localpaths)) figures.paths = figure_paths local figures_order = allocate { - "pdf", "mps", "jpg", "png", "jp2", "jbig", "svg", "eps", "tif", "gif", "mov", "buffer", "tex", "cld", "auto", + -- "mov" is gone + "pdf", "mps", "jpg", "png", "jp2", "jbig", "svg", "eps", "tif", "gif", "buffer", "tex", "cld", "auto", } local figures_formats = allocate { -- magic and order will move here @@ -336,7 +337,7 @@ local figures_formats = allocate { -- magic and order will move here ["eps"] = { list = { "eps", "ai" } }, ["gif"] = { list = { "gif" } }, ["tif"] = { list = { "tif", "tiff" } }, - ["mov"] = { list = { "mov", "flv", "mp4" } }, -- "avi" is not supported + -- ["mov"] = { list = { "mov", "flv", "mp4" } }, -- "avi" is not supported ["buffer"] = { list = { "tmp", "buffer", "buf" } }, ["tex"] = { list = { "tex" } }, ["cld"] = { list = { "cld" } }, @@ -1690,35 +1691,35 @@ includers.nongeneric = includers_nongeneric -- -- -- mov -- -- -- -function checkers.mov(data) - local dr, du, ds = data.request, data.used, data.status - local width = todimen(dr.width or figures.defaultwidth) - local height = todimen(dr.height or figures.defaultheight) - local foundname = du.fullname - dr.width, dr.height = width, height - du.width, du.height, du.foundname = width, height, foundname - if trace_inclusion then - report_inclusion("including movie %a, width %p, height %p",foundname,width,height) - end - -- we need to push the node.write in between ... we could make a shared helper for this - ctx_startfoundexternalfigure(width .. "sp",height .. "sp") - context(function() - nodeinjections.insertmovie { - width = width, - height = height, - factor = bpfactor, - ["repeat"] = dr["repeat"], - controls = dr.controls, - preview = dr.preview, - label = dr.label, - foundname = foundname, - } - end) - ctx_stopfoundexternalfigure() - return data -end - -includers.mov = includers.nongeneric +-- function checkers.mov(data) +-- local dr, du, ds = data.request, data.used, data.status +-- local width = todimen(dr.width or figures.defaultwidth) +-- local height = todimen(dr.height or figures.defaultheight) +-- local foundname = du.fullname +-- dr.width, dr.height = width, height +-- du.width, du.height, du.foundname = width, height, foundname +-- if trace_inclusion then +-- report_inclusion("including movie %a, width %p, height %p",foundname,width,height) +-- end +-- -- we need to push the node.write in between ... we could make a shared helper for this +-- ctx_startfoundexternalfigure(width .. "sp",height .. "sp") +-- context(function() +-- nodeinjections.insertmovie { +-- width = width, +-- height = height, +-- factor = bpfactor, +-- ["repeat"] = dr["repeat"], +-- controls = dr.controls, +-- preview = dr.preview, +-- label = dr.label, +-- foundname = foundname, +-- } +-- end) +-- ctx_stopfoundexternalfigure() +-- return data +-- end +-- +-- includers.mov = includers.nongeneric -- -- -- mps -- -- -- diff --git a/tex/context/base/mkxl/lpdf-ano.lmt b/tex/context/base/mkxl/lpdf-ano.lmt index 485e143a7..763822707 100644 --- a/tex/context/base/mkxl/lpdf-ano.lmt +++ b/tex/context/base/mkxl/lpdf-ano.lmt @@ -1228,31 +1228,6 @@ function executers.show(arguments) } end -local pdf_movie = pdfconstant("Movie") -local pdf_start = pdfconstant("Start") -local pdf_stop = pdfconstant("Stop") -local pdf_resume = pdfconstant("Resume") -local pdf_pause = pdfconstant("Pause") - -local function movie_or_sound(operation,what,arguments) - arguments = (type(arguments) == "table" and arguments) or settings_to_array(arguments) - return pdfdictionary { - S = pdf_movie, - T = format("%s %s",what,arguments[1] or "noname"), - Operation = operation, - } -end - -function executers.startmovie (arguments) return movie_or_sound(pdf_start ,"movie",arguments) end -function executers.stopmovie (arguments) return movie_or_sound(pdf_stop ,"movie",arguments) end -function executers.resumemovie(arguments) return movie_or_sound(pdf_resume,"movie",arguments) end -function executers.pausemovie (arguments) return movie_or_sound(pdf_pause ,"movie",arguments) end - -function executers.startsound (arguments) return movie_or_sound(pdf_start ,"sound",arguments) end -function executers.stopsound (arguments) return movie_or_sound(pdf_stop ,"sound",arguments) end -function executers.resumesound(arguments) return movie_or_sound(pdf_resume,"sound",arguments) end -function executers.pausesound (arguments) return movie_or_sound(pdf_pause ,"sound",arguments) end - function specials.action(var) local operation = var.operation if var.operation and operation ~= "" then diff --git a/tex/context/base/mkxl/lpdf-aux.lmt b/tex/context/base/mkxl/lpdf-aux.lmt index 65bc2e6cc..441f4cf9c 100644 --- a/tex/context/base/mkxl/lpdf-aux.lmt +++ b/tex/context/base/mkxl/lpdf-aux.lmt @@ -11,7 +11,7 @@ local format, concat = string.format, table.concat local utfchar, utfbyte, char = utf.char, utf.byte, string.char local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns local P, C, R, S, Cc, Cs, V = lpeg.P, lpeg.C, lpeg.R, lpeg.S, lpeg.Cc, lpeg.Cs, lpeg.V -local rshift = bit32.rshift +----- rshift = bit32.rshift lpdf = lpdf or { } @@ -23,7 +23,8 @@ local cache = table.setmetatableindex(function(t,k) -- can be made weak v = format("%04x",v) else v = v - 0x10000 - v = format("%04x%04x",rshift(v,10)+0xD800,v%1024+0xDC00) -- will become >> when we drop luajittex + -- v = format("%04x%04x",rshift(v,10)+0xD800,v%1024+0xDC00) + v = format("%04x%04x",(v >> 10) + 0xD800,v%1024+0xDC00) end t[k] = v return v diff --git a/tex/context/base/mkxl/lpdf-mov.lmt b/tex/context/base/mkxl/lpdf-mov.lmt deleted file mode 100644 index 0f0eefd2f..000000000 --- a/tex/context/base/mkxl/lpdf-mov.lmt +++ /dev/null @@ -1,69 +0,0 @@ -if not modules then modules = { } end modules ['lpdf-mov'] = { - version = 1.001, - comment = "companion to lpdf-ini.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local format = string.format - -local lpdf = lpdf -local context = context - -local nodeinjections = backends.pdf.nodeinjections -local pdfconstant = lpdf.constant -local pdfdictionary = lpdf.dictionary -local pdfarray = lpdf.array -local pdfborder = lpdf.border - --- We should actually make sure that inclusion only happens once. But this mechanism --- is dropped in pdf anyway so it will go away (read: mapped onto the newer mechanisms). - -function nodeinjections.insertmovie(specification) - -- managed in figure inclusion: width, height, factor, repeat, controls, preview, label, foundname - local width = specification.width - local height = specification.height - local factor = specification.factor or number.dimenfactors.bp - local moviedict = pdfdictionary { - F = specification.foundname or specification.file, - Aspect = pdfarray { factor * width, factor * height }, - Poster = (specification.preview and true) or false, - } - local controldict = pdfdictionary { - ShowControls = (specification.controls and true) or false, - Mode = (specification["repeat"] and pdfconstant("Repeat")) or nil, - } - local bs, bc = pdfborder() - local action = pdfdictionary { - Subtype = pdfconstant("Movie"), - Border = bs, - C = bc, - T = format("movie %s",specification.tag or specification.label), - Movie = moviedict, - A = controldict, - } - context(nodeinjections.annotation(width,height,0,action())) -- test: context(...) -end - -function nodeinjections.insertsound(specification) - local controldict = nil - if specification["repeat"] then - controldict = pdfdictionary { - Mode = pdfconstant("Repeat") - } - end - local sounddict = pdfdictionary { - F = specification.foundname or specification.file - } - local bs, bc = pdfborder() - local action = pdfdictionary { - Subtype = pdfconstant("Movie"), - Border = bs, - C = bc, - T = format("sound %s",specification.tag or specification.label), - Movie = sounddict, - A = controldict, - } - context(nodeinjections.annotation(0,0,0,action())) -- test: context(...) -end diff --git a/tex/context/base/mkxl/lpdf-wid.lmt b/tex/context/base/mkxl/lpdf-wid.lmt index 5fde1b1a5..2999eb281 100644 --- a/tex/context/base/mkxl/lpdf-wid.lmt +++ b/tex/context/base/mkxl/lpdf-wid.lmt @@ -25,7 +25,8 @@ if not modules then modules = { } end modules ['lpdf-wid'] = { -- html5 media in pdf then. -- -- See mail by Michal Vlasák to the mailing list that discusses current support in --- viewers and also mentions (and submitted) a few fixes wrt embedding media. +-- viewers and also mentions (and submitted) a few fixes wrt embedding media. The +-- old sound and movie features are gone. local tonumber, next = tonumber, next local gmatch, gsub, find, lower = string.gmatch, string.gsub, string.find, string.lower diff --git a/tex/context/base/mkxl/luat-cod.lmt b/tex/context/base/mkxl/luat-cod.lmt index 2e5fa8062..6a7ebdd0b 100644 --- a/tex/context/base/mkxl/luat-cod.lmt +++ b/tex/context/base/mkxl/luat-cod.lmt @@ -138,9 +138,7 @@ if LUATEXFORMATID == nil then LUATEXFORMATID = status.format_id or 0 end -if JITSUPPORTED == nil then - JITSUPPORTED = false -end +JITSUPPORTED = false if INITEXMODE == nil then INITEXMODE = status.run_state == 0 -- initializing updating production diff --git a/tex/context/base/mkxl/luat-ini.lmt b/tex/context/base/mkxl/luat-ini.lmt index 3bfd191b9..3202ea42b 100644 --- a/tex/context/base/mkxl/luat-ini.lmt +++ b/tex/context/base/mkxl/luat-ini.lmt @@ -25,20 +25,12 @@ if not global then global = _G end -LUATEXVERSION = status.luatex_version/100 - + tonumber(status.luatex_revision)/10000 - -LUATEXENGINE = status.luatex_engine and string.lower(status.luatex_engine) - or (string.find(status.banner,"LuajitTeX",1,true) and "luajittex" or "luatex") - +LUATEXVERSION = status.luatex_version/100 + tonumber(status.luatex_revision)/10000 +LUATEXENGINE = string.lower(status.luatex_engine or "luametatex") LUATEXFUNCTIONALITY = status.development_id or 6346 - LUATEXFORMATID = status.format_id or 0 - -JITSUPPORTED = LUATEXENGINE == "luajittex" or jit - +JITSUPPORTED = false INITEXMODE = status.ini_version - CONTEXTLMTXMODE = 1 function os.setlocale() diff --git a/tex/context/base/mkxl/scrn-wid.lmt b/tex/context/base/mkxl/scrn-wid.lmt new file mode 100644 index 000000000..caa09adbd --- /dev/null +++ b/tex/context/base/mkxl/scrn-wid.lmt @@ -0,0 +1,317 @@ +if not modules then modules = { } end modules ['scrn-wid'] = { + version = 1.001, + comment = "companion to scrn-wid.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- Support for interactive features is handled elsewhere. Now that is some mess! In +-- the early days one had media features like sound and movies that were easy to set +-- up. Then at some point renditions came around which were more work and somewhat +-- unreliable. Now, both mechanism are obsolete and replaced by rich media which is +-- a huge mess and has no real concept of what media are supported. There's flash +-- cq. shockwave (basically obsolete too), and for instance mp4 needs to be handled +-- by a swf player, and there's u3d which somehow has its own specification. One +-- would expect native support for video and audio to be en-par with browsers but +-- alas ... pdf has lost the battle with html here due to a few decades of +-- unstability and changing support. So far we could catch on and even were ahead +-- but I wonder if we should keep doing that. As we can't trust support for media we +-- can better not embed anything and just use a hyperlink to an external resource. No +-- sane person will create media rich pdf's as long as it's that unpredictable. Just +-- look at the specification and viewer preferences and decide. + +local next = next + +interactions = interactions or { } +local interactions = interactions + +local context = context +local implement = interfaces.implement + +local allocate = utilities.storage.allocate + +local attachments = allocate() +local comments = allocate() +local renderings = allocate() +local linkedlists = allocate() + +interactions.attachments = attachments +interactions.renderings = renderings +interactions.linkedlists = linkedlists + +local texsetbox = tex.setbox + +local jobpasses = job.passes + +local texgetcount = tex.getcount + +local codeinjections = backends.codeinjections +local nodeinjections = backends.nodeinjections + +local variables = interfaces.variables +local v_auto = variables.auto + +local trace_attachments = false trackers.register("widgets.attachments", function(v) trace_attachments = v end) + +local report_attachments = logs.reporter("widgets","attachments") + +-- Symbols + +implement { + name = "presetsymbollist", + arguments = "string", + actions = function(list) + codeinjections.presetsymbollist(list) + end +} + +-- Attachments +-- +-- registered : unique id +-- tag : used at the tex end +-- file : name that the file has on the filesystem +-- name : name that the file will get in the output +-- title : up to the backend +-- subtitle : up to the backend +-- author : up to the backend +-- method : up to the backend (hidden == no rendering) + +local nofautoattachments, lastregistered = 0, nil + +local function checkregistered(specification) + local registered = specification.registered + if not registered or registered == "" or registered == v_auto then + nofautoattachments = nofautoattachments + 1 + lastregistered = "attachment-" .. nofautoattachments + specification.registered = lastregistered + return lastregistered + else + return registered + end +end + +local function checkbuffer(specification) + local buffer = specification.buffer + if buffer ~= "" then + specification.data = buffers.getcontent(buffer) or "<no data>" + end +end + +function attachments.register(specification) -- beware of tag/registered mixup(tag is namespace) + local registered = checkregistered(specification) + checkbuffer(specification) + attachments[registered] = specification + if trace_attachments then + report_attachments("registering %a",registered) + end + return specification +end + +function attachments.insert(specification) + local registered = checkregistered(specification) + local r = attachments[registered] + if r then + if trace_attachments then + report_attachments("including registered %a",registered) + end + for k, v in next, r do + local s = specification[k] + if s == "" then + specification[k] = v + end + end + elseif trace_attachments then + report_attachments("including unregistered %a",registered) + end + checkbuffer(specification) + return nodeinjections.attachfile(specification) +end + +implement { + name = "registerattachment", + actions = attachments.register, + arguments = { + { + { "tag" }, + { "registered" }, + { "title" }, + { "subtitle" }, + { "author" }, + { "file" }, + { "name" }, + { "buffer" }, + { "mimetype" }, + } + } +} + +implement { + name = "insertattachment", + actions = function(specification) + texsetbox("b_scrn_attachment_link",(attachments.insert(specification))) + end, + arguments = { + { + { "tag" }, + { "registered" }, + { "method" }, + { "width", "dimen" }, + { "height", "dimen" }, + { "depth", "dimen" }, + { "colormodel", "integer" }, + { "colorvalue", "integer" }, + { "color" }, + { "transparencyvalue", "integer" }, + { "symbol" }, + { "layer" }, + { "title" }, + { "subtitle" }, + { "author" }, + { "file" }, + { "name" }, + { "buffer" }, + { "mimetype" }, + } + } +} + +-- Comment + +function comments.insert(specification) + local buffer = specification.buffer + if buffer ~= "" then + specification.data = buffers.getcontent(buffer) or "" + end + return nodeinjections.comment(specification) +end + +implement { + name = "insertcomment", + actions = function(specification) + texsetbox("b_scrn_comment_link",(comments.insert(specification))) + end, + arguments = { + { + { "tag" }, + { "title" }, + { "subtitle" }, + { "author" }, + { "width", "dimen" }, + { "height", "dimen" }, + { "depth", "dimen" }, + { "nx" }, + { "ny" }, + { "colormodel", "integer" }, + { "colorvalue", "integer" }, + { "transparencyvalue", "integer" }, + { "option" }, + { "symbol" }, + { "buffer" }, + { "layer" }, + { "space" }, + } + } +} + +-- Renderings + +function renderings.register(specification) + if specification.label then + renderings[specification.label] = specification + return specification + end +end + +function renderings.rendering(label) + local rn = renderings[label] + if not rn then + -- todo: message + return renderings.register { label = label } + else + return rn + end +end + +function renderings.var(label,key) + local rn = renderings[label] + return rn and rn[key] or "" +end + +implement { + name = "renderingvar", + actions = { renderings.var, context }, + arguments = "2 strings", +} + +implement { + name = "registerrendering", + actions = renderings.register, + arguments = { + { + { "label" }, + { "mime" }, + { "filename" }, + { "option" }, + } + } +} + +-- Rendering: + +implement { + name = "insertrenderingwindow", + actions = function(specification) + codeinjections.insertrenderingwindow(specification) + end, + arguments = { + { + { "label" }, + { "width", "dimen" }, + { "height", "dimen" }, + { "option" }, + { "page", "integer" }, + { "openpage" }, + { "closepage" }, + } + } +} + +-- Linkedlists (only a context interface) + +implement { + name = "definelinkedlist", + arguments = "string", + actions = function(tag) + -- no need + end +} + +implement { + name = "enhancelinkedlist", + arguments = { "string", "integer" }, + actions = function(tag,n) + local ll = jobpasses.gettobesaved(tag) + if ll then + ll[n] = texgetcount("realpageno") + end + end +} + +implement { + name = "addlinklistelement", + arguments = "string", + actions = function(tag) + local tobesaved = jobpasses.gettobesaved(tag) + local collected = jobpasses.getcollected(tag) or { } + local currentlink = #tobesaved + 1 + local noflinks = #collected + tobesaved[currentlink] = 0 + local f = collected[1] or 0 + local l = collected[noflinks] or 0 + local p = collected[currentlink-1] or f + local n = collected[currentlink+1] or l + context.setlinkedlistproperties(currentlink,noflinks,f,p,n,l) + -- context.ctxlatelua(function() commands.enhancelinkedlist(tag,currentlink) end) + end +} diff --git a/tex/context/base/mkxl/scrn-wid.mklx b/tex/context/base/mkxl/scrn-wid.mklx index 6208ddab0..8bc3a3a1b 100644 --- a/tex/context/base/mkxl/scrn-wid.mklx +++ b/tex/context/base/mkxl/scrn-wid.mklx @@ -13,7 +13,7 @@ \writestatus{loading}{ConTeXt Interaction Macros / Widgets} -\registerctxluafile{scrn-wid}{} +\registerctxluafile{scrn-wid}{autosuffix} % todo: expansion in comments (default is expanded) % todo: check renderings ... acrobat crashes too easily on missing one @@ -559,52 +559,10 @@ % \definecomment[\v!comment] % \fi -%D Soundclips: +%D Conform Michals recommendations support for the old movie (and sound) annotations +%D has been removed. This also means that movies are no longer a valid external figure +%D format. So be it. %D -%D Defining sound tracks: -%D -%D \starttyping -%D \useexternalsoundtrack[label][file] -%D \stoptyping -%D -%D associated actions: StartSound StopSound PauseSound ResumeSound -%D -%D Todo: like external figures, also search on path, although, they need to be -%D present at viewing time, so ... -%D -%D A soundtrack needs to be embedded explicitly with \type {\checksoundtrack} -%D although we could hook it into the first goto. -%D -%D \starttyping -%D \useexternalsoundtrack[myaudio][hastobe.wav] % surprise ... no longer mp3 -%D -%D \starttext -%D \checksoundtrack{myaudio} -%D \goto{play sound}[StartSound{myaudio}] -%D \stoptext -%D \starttyping - -\installcorenamespace{externalsoundtracks} - -\installsetuponlycommandhandler \??externalsoundtracks {externalsoundtracks} - -\setupexternalsoundtracks - [\c!option=] - -\permanent\tolerant\protected\def\useexternalsoundtrack[#tag]#spacer[#filename]% - {\clf_registersoundclip - tag {#tag}% - file {#filename}% - \relax} - -\permanent\def\checksoundtrack#tag% yet untested in mkiv (also move management to lua) - {\iflocation - \clf_insertsoundclip - tag {#tag}% - repeat {\directexternalsoundtracksparameter\c!option}% - \relax - \fi} - %D Renderings (adapted to \MKIV\ by Michal Vlasák). We no longer have the \MKII\ internal %D and external rendering because over time all this widget stuff changed in \PDF\ and %D Acrobat. diff --git a/tex/context/base/mkxl/spac-ver.lmt b/tex/context/base/mkxl/spac-ver.lmt index c4da389f9..ca0544cf8 100644 --- a/tex/context/base/mkxl/spac-ver.lmt +++ b/tex/context/base/mkxl/spac-ver.lmt @@ -1014,7 +1014,7 @@ do end b_done = false b_packed = false - b_grid = grid + b_grid = grid == true or grid == 1 before() lpegmatch(pattern,str) after() diff --git a/tex/context/base/mkxl/strc-mar.mkxl b/tex/context/base/mkxl/strc-mar.mkxl index 229025f01..4c279f6dd 100644 --- a/tex/context/base/mkxl/strc-mar.mkxl +++ b/tex/context/base/mkxl/strc-mar.mkxl @@ -122,25 +122,18 @@ \expandafter\secondoftwoarguments \fi} -% \permanent\protected\tolerant\def\setmarking[#1]#:#2% -% {\ifarguments\orelse\ifconditional\inhibitsetmarking\else -% % probably best: \dontleavehmode -% \the\csname\??markingsyncs#1\endcsname -% \ifcstok{\namedmarkingparameter{#1}\c!expansion}\v!yes -% \marks\csname\??markingclass#1\endcsname{#2}% -% \else -% \marks\csname\??markingclass#1\endcsname{\detokenize{#2}}% -% \fi -% \fi} - \permanent\protected\tolerant\def\setmarking[#1]#:#2% {\ifarguments\orelse\ifconditional\inhibitsetmarking\else - % probably best: \dontleavehmode + % so no: \dontleavehmode \the\csname\??markingsyncs#1\endcsname \ifcstok{\namedmarkingparameter{#1}\c!expansion}\v!yes - \normalexpanded{\marks\csname\??markingclass#1\endcsname{#2}}% + \normalexpanded{% + \ifvmode\expandafter\flushatnextpar\else\expandafter\firstofoneargument\fi + {\marks\csname\??markingclass#1\endcsname{#2}}% + }% \else - \marks\csname\??markingclass#1\endcsname{#2}% + \ifvmode\expandafter\flushatnextpar\else\expandafter\firstofoneargument\fi + {\marks\csname\??markingclass#1\endcsname{#2}}% \fi \fi} diff --git a/tex/context/base/mkxl/strc-not.mklx b/tex/context/base/mkxl/strc-not.mklx index 6ada89961..34f74dd68 100644 --- a/tex/context/base/mkxl/strc-not.mklx +++ b/tex/context/base/mkxl/strc-not.mklx @@ -1046,6 +1046,8 @@ \newskip \s_strc_notes_inbetween \newconditional\c_strc_notes_first_flushed +% we can store them per insert so so real need to redo it + \appendtoks \edef\p_spacebefore{\rootnoteparameter\c!spacebefore}% \ifempty\p_spacebefore @@ -1053,7 +1055,7 @@ \else \setbox\scratchbox\vbox{\blank[\p_spacebefore]\global\s_strc_notes_before\lastskip}% \fi - \edef\p_spaceinbetween{\rootnoteparameter\c!spaceinbetween}% + \edef\p_spaceinbetween{\noteparameter\c!spaceinbetween}% \ifempty\p_spaceinbetween \global\s_strc_notes_inbetween\zeropoint \else @@ -1341,17 +1343,7 @@ \def\strc_notes_set_penalties {% stored in insert node \floatingpenalty \currentnotepenalty % now per note - % used when typesetting - \interlinepenalty\plushundred % plain value - % used when we need to split in columns - \ifnum\noteparameter\c!n>\plusone - \penalty\zerocount % otherwise no split in columns, maybe just always (tex just adds it to accumulated) - \fi} - -\def\strc_notes_set_penalties - {% stored in insert node - \floatingpenalty \currentnotepenalty % now per note - \page_inserts_set_penalty \currentnoteinsertionnumber\currentnotepenalty + \page_inserts_set_penalty\currentnoteinsertionnumber\currentnotepenalty % used when typesetting \interlinepenalty\plushundred % plain value % used when we need to split in columns @@ -1453,7 +1445,7 @@ \blank[\p_spaceinbetween]% \fi \else - \edef\p_spacebefore{\noteparameter\c!spacebefore}% + \edef\p_spacebefore{\rootnoteparameter\c!spacebefore}% \ifempty\p_spacebefore\else \blank[\p_spacebefore]% \fi diff --git a/tex/context/base/mkxl/strc-ref.mklx b/tex/context/base/mkxl/strc-ref.mklx index 3952a4faf..da1b6a42e 100644 --- a/tex/context/base/mkxl/strc-ref.mklx +++ b/tex/context/base/mkxl/strc-ref.mklx @@ -2023,8 +2023,6 @@ \definereference [\v!LastPage ] [action(last)] \definereference [\v!NextJump ] [action(forward)] \definereference [\v!NextPage ] [action(next)] -\definereference [\v!PauseMovie ] [action(pausemovie)] -\definereference [\v!PauseSound ] [action(pausesound)] \definereference [\v!PauseRendering ] [action(pauserendering)] \definereference [\v!PreviousJump ] [action(backward)] \definereference [\v!PreviousPage ] [action(previous)] @@ -2032,19 +2030,13 @@ \definereference [\v!SaveForm ] [action(exportform)] \definereference [\v!LoadForm ] [action(importform)] \definereference [\v!ResetForm ] [action(resetform)] -\definereference [\v!ResumeMovie ] [action(resumemovie)] -\definereference [\v!ResumeSound ] [action(resumesound)] \definereference [\v!ResumeRendering ] [action(resumerendering)] \definereference [\v!SaveDocument ] [action(save)] \definereference [\v!SaveNamedDocument] [action(savenamed)] \definereference [\v!OpenNamedDocument] [action(opennamed)] \definereference [\v!SearchDocument ] [action(search)] \definereference [\v!SearchAgain ] [action(searchagain)] -\definereference [\v!StartMovie ] [action(startmovie)] -\definereference [\v!StartSound ] [action(startsound)] \definereference [\v!StartRendering ] [action(startrendering)] -\definereference [\v!StopMovie ] [action(stopmovie)] -\definereference [\v!StopSound ] [action(stopsound)] \definereference [\v!StopRendering ] [action(stoprendering)] \definereference [\v!SubmitForm ] [action(submitform)] \definereference [\v!ToggleViewer ] [action(toggle)] diff --git a/tex/context/base/mkxl/strc-sec.mkxl b/tex/context/base/mkxl/strc-sec.mkxl index 6a4442e85..ba250311e 100644 --- a/tex/context/base/mkxl/strc-sec.mkxl +++ b/tex/context/base/mkxl/strc-sec.mkxl @@ -1340,6 +1340,10 @@ \finalizeautostructurelevels \to \everystoptext +%D Defined at the \LUA\ end: + +% \doifelsefirstsectionpage{chapter}{do this}{or that} % in pagebody building + \stopcontextdefinitioncode \protect \endinput diff --git a/tex/context/interface/mkii/keys-nl.xml b/tex/context/interface/mkii/keys-nl.xml index c52ef7ab2..86a5622e8 100644 --- a/tex/context/interface/mkii/keys-nl.xml +++ b/tex/context/interface/mkii/keys-nl.xml @@ -191,6 +191,7 @@ <cd:variable name='enumeration' value='doornummering'/> <cd:variable name='environment' value='omgeving'/> <cd:variable name='even' value='even'/> + <cd:variable name='explicit' value='explicit'/> <cd:variable name='export' value='export'/> <cd:variable name='external' value='extern'/> <cd:variable name='extremestretch' value='extremestretch'/> diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index e1a70fa4d..05dfc4b94 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 2021-10-13 16:56 +-- merge date : 2021-10-15 13:57 do -- begin closure to overcome local limits and interference |