diff options
45 files changed, 685 insertions, 131 deletions
diff --git a/doc/context/manuals/allkind/mkiv-publications.pdf b/doc/context/manuals/allkind/mkiv-publications.pdf Binary files differindex bcb5af97f..49290c549 100644 --- a/doc/context/manuals/allkind/mkiv-publications.pdf +++ b/doc/context/manuals/allkind/mkiv-publications.pdf diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua index 83030e2e7..caf7e2f2a 100644 --- a/scripts/context/lua/mtx-context.lua +++ b/scripts/context/lua/mtx-context.lua @@ -285,11 +285,13 @@ local function multipass_copyluafile(jobname,run) local tuaname, tucname = jobname..".tua", jobname..".tuc" if validfile(tuaname) then if run then - for i=1,10 do - local tmpname = format("%s-tuc-%02d.tmp",jobname,i) - if validfile(tmpname) then - removefile(tmpname) - report("removing %a",tmpname) + if run == 1 then + for i=1,10 do + local tmpname = format("%s-tuc-%02d.tmp",jobname,i) + if validfile(tmpname) then + removefile(tmpname) + report("removing %a",tmpname) + end end end if validfile(tucname) then diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 89137f3fc..a9e563117 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -3103,7 +3103,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-file"] = package.loaded["l-file"] or true --- original size: 18308, stripped down to: 9948 +-- original size: 18672, stripped down to: 10256 if not modules then modules={} end modules ['l-file']={ version=1.001, @@ -3436,6 +3436,18 @@ function file.collapsepath(str,anchor) end end end +local tricky=S("/\\")*P(-1) +local attributes=lfs.attributes +function lfs.isdir(name) + if lpegmatch(tricky,name) then + return attributes(name,"mode")=="directory" + else + return attributes(name.."/.","mode")=="directory" + end +end +function lfs.isfile(name) + return attributes(name,"mode")=="file" +end local validchars=R("az","09","AZ","--","..") local pattern_a=lpeg.replacer(1-validchars) local pattern_a=Cs((validchars+P(1)/"-")^1) @@ -3841,7 +3853,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-dir"] = package.loaded["l-dir"] or true --- original size: 16056, stripped down to: 10707 +-- original size: 16182, stripped down to: 10810 if not modules then modules={} end modules ['l-dir']={ version=1.001, @@ -3867,9 +3879,13 @@ local chdir=lfs.chdir local mkdir=lfs.mkdir local onwindows=os.type=="windows" or find(os.getenv("PATH"),";",1,true) if onwindows then + local tricky=S("/\\")*P(-1) isdir=function(name) - name=gsub(name,"([/\\]+)$","/.") - return attributes(name,"mode")=="directory" + if lpegmatch(tricky,name) then + return attributes(name,"mode")=="directory" + else + return attributes(name.."/.","mode")=="directory" + end end isfile=function(name) return attributes(name,"mode")=="file" @@ -17287,8 +17303,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 712300 --- stripped bytes : 253386 +-- original bytes : 712790 +-- stripped bytes : 253465 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 89137f3fc..a9e563117 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -3103,7 +3103,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-file"] = package.loaded["l-file"] or true --- original size: 18308, stripped down to: 9948 +-- original size: 18672, stripped down to: 10256 if not modules then modules={} end modules ['l-file']={ version=1.001, @@ -3436,6 +3436,18 @@ function file.collapsepath(str,anchor) end end end +local tricky=S("/\\")*P(-1) +local attributes=lfs.attributes +function lfs.isdir(name) + if lpegmatch(tricky,name) then + return attributes(name,"mode")=="directory" + else + return attributes(name.."/.","mode")=="directory" + end +end +function lfs.isfile(name) + return attributes(name,"mode")=="file" +end local validchars=R("az","09","AZ","--","..") local pattern_a=lpeg.replacer(1-validchars) local pattern_a=Cs((validchars+P(1)/"-")^1) @@ -3841,7 +3853,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-dir"] = package.loaded["l-dir"] or true --- original size: 16056, stripped down to: 10707 +-- original size: 16182, stripped down to: 10810 if not modules then modules={} end modules ['l-dir']={ version=1.001, @@ -3867,9 +3879,13 @@ local chdir=lfs.chdir local mkdir=lfs.mkdir local onwindows=os.type=="windows" or find(os.getenv("PATH"),";",1,true) if onwindows then + local tricky=S("/\\")*P(-1) isdir=function(name) - name=gsub(name,"([/\\]+)$","/.") - return attributes(name,"mode")=="directory" + if lpegmatch(tricky,name) then + return attributes(name,"mode")=="directory" + else + return attributes(name.."/.","mode")=="directory" + end end isfile=function(name) return attributes(name,"mode")=="file" @@ -17287,8 +17303,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 712300 --- stripped bytes : 253386 +-- original bytes : 712790 +-- stripped bytes : 253465 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 89137f3fc..a9e563117 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -3103,7 +3103,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-file"] = package.loaded["l-file"] or true --- original size: 18308, stripped down to: 9948 +-- original size: 18672, stripped down to: 10256 if not modules then modules={} end modules ['l-file']={ version=1.001, @@ -3436,6 +3436,18 @@ function file.collapsepath(str,anchor) end end end +local tricky=S("/\\")*P(-1) +local attributes=lfs.attributes +function lfs.isdir(name) + if lpegmatch(tricky,name) then + return attributes(name,"mode")=="directory" + else + return attributes(name.."/.","mode")=="directory" + end +end +function lfs.isfile(name) + return attributes(name,"mode")=="file" +end local validchars=R("az","09","AZ","--","..") local pattern_a=lpeg.replacer(1-validchars) local pattern_a=Cs((validchars+P(1)/"-")^1) @@ -3841,7 +3853,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-dir"] = package.loaded["l-dir"] or true --- original size: 16056, stripped down to: 10707 +-- original size: 16182, stripped down to: 10810 if not modules then modules={} end modules ['l-dir']={ version=1.001, @@ -3867,9 +3879,13 @@ local chdir=lfs.chdir local mkdir=lfs.mkdir local onwindows=os.type=="windows" or find(os.getenv("PATH"),";",1,true) if onwindows then + local tricky=S("/\\")*P(-1) isdir=function(name) - name=gsub(name,"([/\\]+)$","/.") - return attributes(name,"mode")=="directory" + if lpegmatch(tricky,name) then + return attributes(name,"mode")=="directory" + else + return attributes(name.."/.","mode")=="directory" + end end isfile=function(name) return attributes(name,"mode")=="file" @@ -17287,8 +17303,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 712300 --- stripped bytes : 253386 +-- original bytes : 712790 +-- stripped bytes : 253465 -- end library merge diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index 89137f3fc..a9e563117 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -3103,7 +3103,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-file"] = package.loaded["l-file"] or true --- original size: 18308, stripped down to: 9948 +-- original size: 18672, stripped down to: 10256 if not modules then modules={} end modules ['l-file']={ version=1.001, @@ -3436,6 +3436,18 @@ function file.collapsepath(str,anchor) end end end +local tricky=S("/\\")*P(-1) +local attributes=lfs.attributes +function lfs.isdir(name) + if lpegmatch(tricky,name) then + return attributes(name,"mode")=="directory" + else + return attributes(name.."/.","mode")=="directory" + end +end +function lfs.isfile(name) + return attributes(name,"mode")=="file" +end local validchars=R("az","09","AZ","--","..") local pattern_a=lpeg.replacer(1-validchars) local pattern_a=Cs((validchars+P(1)/"-")^1) @@ -3841,7 +3853,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-dir"] = package.loaded["l-dir"] or true --- original size: 16056, stripped down to: 10707 +-- original size: 16182, stripped down to: 10810 if not modules then modules={} end modules ['l-dir']={ version=1.001, @@ -3867,9 +3879,13 @@ local chdir=lfs.chdir local mkdir=lfs.mkdir local onwindows=os.type=="windows" or find(os.getenv("PATH"),";",1,true) if onwindows then + local tricky=S("/\\")*P(-1) isdir=function(name) - name=gsub(name,"([/\\]+)$","/.") - return attributes(name,"mode")=="directory" + if lpegmatch(tricky,name) then + return attributes(name,"mode")=="directory" + else + return attributes(name.."/.","mode")=="directory" + end end isfile=function(name) return attributes(name,"mode")=="file" @@ -17287,8 +17303,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 712300 --- stripped bytes : 253386 +-- original bytes : 712790 +-- stripped bytes : 253465 -- end library merge diff --git a/tex/context/base/anch-pos.lua b/tex/context/base/anch-pos.lua index 4230d1d16..fc7e24b96 100644 --- a/tex/context/base/anch-pos.lua +++ b/tex/context/base/anch-pos.lua @@ -118,6 +118,8 @@ local nofusedregions = 0 local nofmissingregions = 0 local nofregular = 0 +jobpositions.used = false + -- todo: register subsets and count them indepently local function initializer() @@ -162,6 +164,7 @@ local function initializer() end -- so, we can be sparse and don't need 'or 0' code end + jobpositions.used = next(collected) end job.register('job.positions.collected', tobesaved, initializer) diff --git a/tex/context/base/cldf-prs.lua b/tex/context/base/cldf-prs.lua index f9fccd832..3c3836a3e 100644 --- a/tex/context/base/cldf-prs.lua +++ b/tex/context/base/cldf-prs.lua @@ -51,8 +51,8 @@ local scripted = Cs { "start", character = utf8character, -- nested = leftbrace * (V("rest") + (V("character")-rightbrace))^0 * rightbrace, nested = leftbrace * (V("start") -rightbrace)^0 * rightbrace, - content = Cs(V("nested") + sign^-1 * (cardinal + V("character"))), - content = V("nested") + sign^-1 * (cardinal + V("character")), + -- content = Cs(V("nested") + sign^-1 * (cardinal + V("character"))), + content = V("nested") + sign^-1 * (cardinal + V("character")) + sign, lowfirst = (subscript /"") * ( Cc("\\lohi{") * V("content") * Cc("}{") * (superscript/"") + Cc("\\low{" ) ) * V("content") * Cc("}"), highfirst = (superscript/"") * ( Cc("\\hilo{") * V("content") * Cc("}{") * (subscript /"") + Cc("\\high{") ) * V("content") * Cc("}"), } diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 45f7ff1ac..0845e92fd 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2014.07.18 14:12} +\newcontextversion{2014.07.25 12:57} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex b40607408..a7b446132 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index c3fc163f6..831a76c7f 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -28,7 +28,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2014.07.18 14:12} +\edef\contextversion{2014.07.25 12:57} \edef\contextkind {beta} %D For those who want to use this: @@ -221,6 +221,8 @@ \loadmkvifile{typo-prc} +\loadmarkfile{anch-pos} + \loadmkvifile{strc-ini} \loadmarkfile{strc-tag} \loadmarkfile{strc-doc} @@ -248,7 +250,7 @@ \loadmarkfile{spac-def} \loadmarkfile{spac-grd} -\loadmarkfile{anch-pos} +%loadmarkfile{anch-pos} \loadmkvifile{scrn-ini} \loadmkvifile{scrn-ref} diff --git a/tex/context/base/grph-inc.lua b/tex/context/base/grph-inc.lua index 064cc9c45..9ee5c6199 100644 --- a/tex/context/base/grph-inc.lua +++ b/tex/context/base/grph-inc.lua @@ -91,6 +91,7 @@ local v_high = variables.high local v_global = variables["global"] local v_local = variables["local"] local v_default = variables.default +local v_auto = variables.auto local maxdimen = 2^30-1 @@ -248,10 +249,12 @@ local pattern = (R("az","AZ") * P(":"))^-1 * ( -- a-z : | A-Z : ) * P(-1) * Cc(false) + Cc(true) function figures.badname(name) - if name and not hasscheme(name) then + if not name then + -- bad anyway + elseif not hasscheme(name) then return lpegmatch(pattern,name) else - return false + return lpegmatch(pattern,file.basename(name)) end end @@ -266,19 +269,19 @@ trackers.register("graphics.lognames", function(v) report_newline() report_figures("start names") for _, data in table.sortedhash(figures_found) do - local comment = data.comment report_newline() report_figure("asked : %s",data.askedname) - if data.badname then - comment = "bad name" - end if data.found then report_figure("format : %s",data.format) report_figure("found : %s",data.foundname) report_figure("used : %s",data.fullname) - end - if comment then - report_figure("comment : %s",comment) + if data.badname then + report_figure("comment : %s","bad name") + elseif data.comment then + report_figure("comment : %s",data.comment) + end + else + report_figure("comment : %s","not found") end end report_newline() @@ -688,7 +691,7 @@ local function register(askedname,specification) format = newformat if not figures_suffixes[format] then -- maybe the new format is lowres.png (saves entry in suffixes) - -- so let's do thsi extra check + -- so let's do this extra check local suffix = file.suffix(newformat) if figures_suffixes[suffix] then if trace_figures then @@ -698,8 +701,12 @@ local function register(askedname,specification) end end elseif io.exists(oldname) then - specification.fullname = oldname -- was newname + report_inclusion("file %a is bugged",oldname) + if format and validtypes[format] then + specification.fullname = oldname + end specification.converted = false + specification.bugged = true end end end @@ -710,14 +717,15 @@ local function register(askedname,specification) if trace_figures then report_inclusion("format %a is not supported",format) end - else + elseif validtypes[format] then specification.found = true if trace_figures then - if validtypes[format] then -- format? - report_inclusion("format %a natively supported by backend",format) - else - report_inclusion("format %a supported by output file format",format) - end + report_inclusion("format %a natively supported by backend",format) + end + else + specification.found = false + if trace_figures then + report_inclusion("format %a supported by output file format",format) end end else @@ -735,7 +743,10 @@ end local resolve_too = false -- true local internalschemes = { - file = true, + file = true, + tree = true, + dirfile = true, + dirtree = true, } local function locate(request) -- name, format, cache @@ -752,8 +763,15 @@ local function locate(request) -- name, format, cache local askedconversion = request.conversion local askedresolution = request.resolution -- - if request.format == "" or request.format == "unknown" then - request.format = nil + local askedformat = request.format + if not askedformat or askedformat == "" or askedformat == "unknown" then + askedformat = file.suffix(askedname) or "" + elseif askedformat == v_auto then + if trace_figures then + report_inclusion("ignoring suffix of %a",askedname) + end + askedformat = "" + askedname = file.removesuffix(askedname) end -- protocol check local hashed = urlhashed(askedname) @@ -765,7 +783,7 @@ local function locate(request) -- name, format, cache askedname = path end else --- local fname = methodhandler('finders',pathname .. "/" .. wantedfiles[k]) + -- local fname = methodhandler('finders',pathname .. "/" .. wantedfiles[k]) local foundname = resolvers.findbinfile(askedname) if not foundname or not lfs.isfile(foundname) then -- foundname can be dummy if trace_figures then @@ -774,7 +792,6 @@ local function locate(request) -- name, format, cache -- url not found return register(askedname) end - local askedformat = request.format or file.suffix(askedname) or "" local guessedformat = figures.guess(foundname) if askedformat ~= guessedformat then if trace_figures then @@ -799,7 +816,6 @@ local function locate(request) -- name, format, cache -- we could use the hashed data instead local askedpath= file.is_rootbased_path(askedname) local askedbase = file.basename(askedname) - local askedformat = request.format or file.suffix(askedname) or "" if askedformat ~= "" then askedformat = lower(askedformat) if trace_figures then @@ -861,7 +877,7 @@ local function locate(request) -- name, format, cache if foundname then return register(check, { askedname = askedname, - fullname = check, + fullname = foundname, -- check, format = askedformat, cache = askedcache, conversion = askedconversion, @@ -921,7 +937,7 @@ local function locate(request) -- name, format, cache for i=1,#figure_paths do local path = figure_paths[i] local check = path .. "/" .. name - local isfile = urlhashed(check).scheme == "file" + local isfile = internalschemes[urlhashed(check).scheme] if not isfile then if trace_figures then report_inclusion("warning: skipping path %a",path) @@ -1402,8 +1418,8 @@ local epstopdf = { -dAutoRotatePages=/None -dPDFSETTINGS=/%presets% -dEPSCrop - -sOutputFile=%newname% - %oldname% + -sOutputFile="%newname%" + "%oldname%" -c quit ]], } @@ -1523,9 +1539,9 @@ bmpconverter.default = converter local bases = allocate() figures.bases = bases -local bases_list = nil -- index => { basename, fullname, xmlroot } -local bases_used = nil -- [basename] => { basename, fullname, xmlroot } -- pointer to list -local bases_found = nil +local bases_list = nil -- index => { basename, fullname, xmlroot } +local bases_used = nil -- [basename] => { basename, fullname, xmlroot } -- pointer to list +local bases_found = nil local bases_enabled = false local function reset() diff --git a/tex/context/base/grph-inc.mkiv b/tex/context/base/grph-inc.mkiv index e8b63cc4b..fd6004427 100644 --- a/tex/context/base/grph-inc.mkiv +++ b/tex/context/base/grph-inc.mkiv @@ -147,6 +147,11 @@ %D the already set parameters need to be set again or otherwise %D the old values will be used. +%D New: \type {method=auto}: strips suffix and uses \quote {order} which is handy in +%D some of four workflows where sources are used for web and print and where +%D the web tools need a suffix (like gif) which we don't want as we want a high +%D quality format. + \newconditional\c_grph_include_trace_inheritance \installtextracker diff --git a/tex/context/base/l-dir.lua b/tex/context/base/l-dir.lua index 660529baf..bcf28d011 100644 --- a/tex/context/base/l-dir.lua +++ b/tex/context/base/l-dir.lua @@ -36,9 +36,14 @@ if onwindows then -- lfs.isdir does not like trailing / -- lfs.dir accepts trailing / + local tricky = S("/\\") * P(-1) + isdir = function(name) - name = gsub(name,"([/\\]+)$","/.") - return attributes(name,"mode") == "directory" + if lpegmatch(tricky,name) then + return attributes(name,"mode") == "directory" + else + return attributes(name.."/.","mode") == "directory" + end end isfile = function(name) diff --git a/tex/context/base/l-file.lua b/tex/context/base/l-file.lua index ebb2b39f4..c05372a05 100644 --- a/tex/context/base/l-file.lua +++ b/tex/context/base/l-file.lua @@ -495,6 +495,23 @@ function file.collapsepath(str,anchor) -- anchor: false|nil, true, "." end end +-- better this way: + +local tricky = S("/\\") * P(-1) +local attributes = lfs.attributes + +function lfs.isdir(name) + if lpegmatch(tricky,name) then + return attributes(name,"mode") == "directory" + else + return attributes(name.."/.","mode") == "directory" + end +end + +function lfs.isfile(name) + return attributes(name,"mode") == "file" +end + -- local function test(str,...) -- print(string.format("%-20s %-15s %-30s %-20s",str,file.collapsepath(str),file.collapsepath(str,true),file.collapsepath(str,"."))) -- end diff --git a/tex/context/base/lang-txt.lua b/tex/context/base/lang-txt.lua index f96ee52a1..4f9f242e6 100644 --- a/tex/context/base/lang-txt.lua +++ b/tex/context/base/lang-txt.lua @@ -990,6 +990,18 @@ data.labels={ vi="Đồ thị", }, }, + precedingpage={ + labels={ + en="on a preceding page", + nl="op een voorgaande bladzijde", + }, + }, + followingpage={ + labels={ + en="on a following page", + nl="op een volgende bladzijde", + }, + }, hencefore={ labels={ af="", diff --git a/tex/context/base/mult-de.mkii b/tex/context/base/mult-de.mkii index 6c5633010..1751f4780 100644 --- a/tex/context/base/mult-de.mkii +++ b/tex/context/base/mult-de.mkii @@ -180,6 +180,7 @@ \setinterfacevariable{flushleft}{flushleft} \setinterfacevariable{flushouter}{flushouter} \setinterfacevariable{flushright}{flushright} +\setinterfacevariable{followingpage}{followingpage} \setinterfacevariable{footer}{fusszeile} \setinterfacevariable{footnote}{fussnote} \setinterfacevariable{force}{zwinge} @@ -360,6 +361,7 @@ \setinterfacevariable{positive}{positiv} \setinterfacevariable{postponing}{verschieben} \setinterfacevariable{postscript}{postscript} +\setinterfacevariable{precedingpage}{followingpage} \setinterfacevariable{preference}{einstellung} \setinterfacevariable{preview}{vorschau} \setinterfacevariable{previous}{vorig} diff --git a/tex/context/base/mult-def.lua b/tex/context/base/mult-def.lua index 4d923f5c1..ffb95f76b 100644 --- a/tex/context/base/mult-def.lua +++ b/tex/context/base/mult-def.lua @@ -11405,6 +11405,14 @@ return { }, }, ["variables"]={ + ["followingpage"]={ + ["en"]="followingpage", + ["nl"]="opvolgendepagina", + }, + ["precedingpage"]={ + ["en"]="followingpage", + ["nl"]="voorafgaandepagina", + }, ["math"]={ ["en"]="math", }, diff --git a/tex/context/base/mult-en.mkii b/tex/context/base/mult-en.mkii index 188c85ab4..72185f3ab 100644 --- a/tex/context/base/mult-en.mkii +++ b/tex/context/base/mult-en.mkii @@ -180,6 +180,7 @@ \setinterfacevariable{flushleft}{flushleft} \setinterfacevariable{flushouter}{flushouter} \setinterfacevariable{flushright}{flushright} +\setinterfacevariable{followingpage}{followingpage} \setinterfacevariable{footer}{footer} \setinterfacevariable{footnote}{footnote} \setinterfacevariable{force}{force} @@ -360,6 +361,7 @@ \setinterfacevariable{positive}{positive} \setinterfacevariable{postponing}{postponing} \setinterfacevariable{postscript}{postscript} +\setinterfacevariable{precedingpage}{followingpage} \setinterfacevariable{preference}{preference} \setinterfacevariable{preview}{preview} \setinterfacevariable{previous}{previous} diff --git a/tex/context/base/mult-fr.mkii b/tex/context/base/mult-fr.mkii index 735682a60..2a6d85c91 100644 --- a/tex/context/base/mult-fr.mkii +++ b/tex/context/base/mult-fr.mkii @@ -180,6 +180,7 @@ \setinterfacevariable{flushleft}{flushleft} \setinterfacevariable{flushouter}{flushouter} \setinterfacevariable{flushright}{flushright} +\setinterfacevariable{followingpage}{followingpage} \setinterfacevariable{footer}{pdp} \setinterfacevariable{footnote}{notepdp} \setinterfacevariable{force}{force} @@ -360,6 +361,7 @@ \setinterfacevariable{positive}{positif} \setinterfacevariable{postponing}{postponing} \setinterfacevariable{postscript}{postscript} +\setinterfacevariable{precedingpage}{followingpage} \setinterfacevariable{preference}{preference} \setinterfacevariable{preview}{previsualisation} \setinterfacevariable{previous}{precedent} diff --git a/tex/context/base/mult-it.mkii b/tex/context/base/mult-it.mkii index a96b1b180..9eb0139a1 100644 --- a/tex/context/base/mult-it.mkii +++ b/tex/context/base/mult-it.mkii @@ -180,6 +180,7 @@ \setinterfacevariable{flushleft}{flushleft} \setinterfacevariable{flushouter}{flushouter} \setinterfacevariable{flushright}{flushright} +\setinterfacevariable{followingpage}{followingpage} \setinterfacevariable{footer}{piedipagina} \setinterfacevariable{footnote}{notapdp} \setinterfacevariable{force}{forza} @@ -360,6 +361,7 @@ \setinterfacevariable{positive}{positivo} \setinterfacevariable{postponing}{posporre} \setinterfacevariable{postscript}{postscript} +\setinterfacevariable{precedingpage}{followingpage} \setinterfacevariable{preference}{preferenza} \setinterfacevariable{preview}{anteprima} \setinterfacevariable{previous}{precedente} diff --git a/tex/context/base/mult-nl.mkii b/tex/context/base/mult-nl.mkii index 66cfbc83a..881b4f467 100644 --- a/tex/context/base/mult-nl.mkii +++ b/tex/context/base/mult-nl.mkii @@ -180,6 +180,7 @@ \setinterfacevariable{flushleft}{lijnlinks} \setinterfacevariable{flushouter}{lijnbuiten} \setinterfacevariable{flushright}{lijnrechts} +\setinterfacevariable{followingpage}{opvolgendepagina} \setinterfacevariable{footer}{voet} \setinterfacevariable{footnote}{voetnoot} \setinterfacevariable{force}{forceer} @@ -360,6 +361,7 @@ \setinterfacevariable{positive}{positief} \setinterfacevariable{postponing}{uitstellen} \setinterfacevariable{postscript}{postscript} +\setinterfacevariable{precedingpage}{voorafgaandepagina} \setinterfacevariable{preference}{voorkeur} \setinterfacevariable{preview}{preview} \setinterfacevariable{previous}{vorige} diff --git a/tex/context/base/mult-pe.mkii b/tex/context/base/mult-pe.mkii index a81d9d024..076342282 100644 --- a/tex/context/base/mult-pe.mkii +++ b/tex/context/base/mult-pe.mkii @@ -180,6 +180,7 @@ \setinterfacevariable{flushleft}{پمپچپ} \setinterfacevariable{flushouter}{پمپخارجی} \setinterfacevariable{flushright}{پمپراست} +\setinterfacevariable{followingpage}{followingpage} \setinterfacevariable{footer}{تهبرگ} \setinterfacevariable{footnote}{پانوشت} \setinterfacevariable{force}{اجبار} @@ -360,6 +361,7 @@ \setinterfacevariable{positive}{مثبت} \setinterfacevariable{postponing}{تاخیر} \setinterfacevariable{postscript}{پستاسکریپت} +\setinterfacevariable{precedingpage}{followingpage} \setinterfacevariable{preference}{ترجیح} \setinterfacevariable{preview}{پیشدید} \setinterfacevariable{previous}{قبلی} diff --git a/tex/context/base/mult-ro.mkii b/tex/context/base/mult-ro.mkii index b6a070c59..ec372c6ba 100644 --- a/tex/context/base/mult-ro.mkii +++ b/tex/context/base/mult-ro.mkii @@ -180,6 +180,7 @@ \setinterfacevariable{flushleft}{flushleft} \setinterfacevariable{flushouter}{flushouter} \setinterfacevariable{flushright}{flushright} +\setinterfacevariable{followingpage}{followingpage} \setinterfacevariable{footer}{subsol} \setinterfacevariable{footnote}{notasubsol} \setinterfacevariable{force}{fortat} @@ -360,6 +361,7 @@ \setinterfacevariable{positive}{positiv} \setinterfacevariable{postponing}{postponing} \setinterfacevariable{postscript}{postscript} +\setinterfacevariable{precedingpage}{followingpage} \setinterfacevariable{preference}{preferinta} \setinterfacevariable{preview}{previzualizare} \setinterfacevariable{previous}{precedent} diff --git a/tex/context/base/node-tra.lua b/tex/context/base/node-tra.lua index 081107277..ea17c5738 100644 --- a/tex/context/base/node-tra.lua +++ b/tex/context/base/node-tra.lua @@ -171,6 +171,7 @@ local function tosequence(start,stop,compact) end nodes.tosequence = tosequence +nuts .tosequence = tosequence function nodes.report(t,done) report_nodes("output %a, %changed %a, %s nodes",status.output_active,done,count_nodes(tonut(t))) diff --git a/tex/context/base/pack-rul.mkiv b/tex/context/base/pack-rul.mkiv index 5aa633207..4bc606d9a 100644 --- a/tex/context/base/pack-rul.mkiv +++ b/tex/context/base/pack-rul.mkiv @@ -831,11 +831,14 @@ \edef\currentframed{>\the\c_pack_framed_nesting}% \pack_framed_initialize \pack_framed_process_framed[#1]% can be inlined - \bgroup} + \bgroup + \ignorespaces} % till here -\let\stopframed\egroup +\unexpanded\def\stopframed + {\removeunwantedspaces + \egroup} \unexpanded\def\normalframedwithsettings[#1]% {\bgroup diff --git a/tex/context/base/page-txt.mkvi b/tex/context/base/page-txt.mkvi index c38b2fd4c..93e893eef 100644 --- a/tex/context/base/page-txt.mkvi +++ b/tex/context/base/page-txt.mkvi @@ -756,10 +756,12 @@ \page_layouts_reset_page_number_location \ifx\p_strc_pagenumbers_location\empty % set otherwise + \else\ifx\p_strc_pagenumbers_location\v!none + % set otherwise \else \page_layouts_identify_page_number_location \page_layouts_set_page_number_location - \fi + \fi\fi \fi} \def\page_layouts_place_page_number_left % historic diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua index 85362a80f..7a7912fed 100644 --- a/tex/context/base/publ-ini.lua +++ b/tex/context/base/publ-ini.lua @@ -503,7 +503,7 @@ function commands.flushmarked() nofcitations = nofcitations + 1 marknocite(marked_dataset,tag,nofcitations) if trace_cite then - report_cite("mark, dataset: %s, tag: %s, number: %s, state: %s",dataset,tag,nofcitations,"unset") + report_cite("mark, dataset: %s, tag: %s, number: %s, state: %s",marked_dataset,tag,nofcitations,"unset") end else end @@ -689,7 +689,7 @@ function commands.setbtxdataset(name,default) context(default) else context(v_standard) - report("unknown dataset %a",name) + report("unknown dataset %a, forcing %a",name,standard) end end @@ -900,6 +900,7 @@ setmetatableindex(renderings,function(t,k) ordered = { }, shorts = { }, method = v_none, + texts = setmetatableindex("table"), currentindex = 0, } t[k] = v @@ -1017,13 +1018,16 @@ end -- global : if tag and not alldone[tag] and done[tag] ~= section then ... methods[v_local] = function(dataset,rendering,keyword) - local result = structures.lists.filter(rendering.specification) or { } - local section = sections.currentid() - local list = rendering.list - local done = rendering.done - local alldone = rendering.alldone - local doglobal = rendering.method == v_global - local traced = { } -- todo: only if interactive (backlinks) or when tracing + local result = structures.lists.filter(rendering.specification) or { } + local section = sections.currentid() + local list = rendering.list + local repeated = rendering.repeated == v_yes + local r_done = rendering.done + local r_alldone = rendering.alldone + local done = repeated and { } or r_done + local alldone = repeated and { } or r_alldone + local doglobal = rendering.method == v_global + local traced = { } -- todo: only if interactive (backlinks) or when tracing for listindex=1,#result do local r = result[listindex] local u = r.userdata @@ -1031,7 +1035,7 @@ methods[v_local] = function(dataset,rendering,keyword) local tag = u.btxref if not tag then -- problem - elseif done[tag] == section then + elseif done[tag] == section then -- a bit messy for global and all and so -- skip elseif doglobal and alldone[tag] then -- skip @@ -1102,7 +1106,7 @@ local splitter = sorters.splitters.utf local strip = sorters.strip local function newsplitter(splitter) - return table.setmetatableindex({},function(t,k) -- could be done in the sorter but seldom that many shared + return setmetatableindex({},function(t,k) -- could be done in the sorter but seldom that many shared local v = splitter(k,true) -- in other cases t[k] = v return v @@ -1275,7 +1279,7 @@ function lists.flushentries(dataset,sorttype) local used = rendering.used local forceall = rendering.criterium == v_all local repeated = rendering.repeated == v_yes - local luadata = datasets[dataset].luadata + local luadata = datasets[dataset].luadata if type(sorter) == "function" then list = sorter(dataset,rendering,list,sorttype) or list end @@ -1586,6 +1590,7 @@ local function processcite(dataset,reference,mark,compress,setup,internal,getter end if tobemarked then flushmarked(dataset,list) + commands.flushmarked() -- here (could also be done in caller) end end diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv index 18dabc8ec..96b5eb422 100644 --- a/tex/context/base/publ-ini.mkiv +++ b/tex/context/base/publ-ini.mkiv @@ -533,8 +533,13 @@ \def\publ_place_list_complete[#1][#2]% title might become obsolete, just headtext {\begingroup - \edef\currentbtxrendering{#1}% - \setupcurrentbtxrendering[#2]% + \ifsecondargument + \edef\currentbtxrendering{#1}% + \setupcurrentbtxrendering[#2]% + \else\iffirstargument + \let\currentbtxrendering\currentbtxdataset + \setupcurrentbtxrendering[#1]% + \fi\fi \the\everybtxlistrendering \edef\currentbtxrenderingtitle{\btxrenderingparameter\c!title}% \ifx\currentbtxrenderingtitle\empty @@ -548,8 +553,13 @@ \def\publ_place_list_standard[#1][#2]% {\begingroup - \edef\currentbtxrendering{#1}% - \setupcurrentbtxrendering[#2]% + \ifsecondargument + \edef\currentbtxrendering{#1}% + \setupcurrentbtxrendering[#2]% + \else\iffirstargument + \let\currentbtxrendering\currentbtxdataset + \setupcurrentbtxrendering[#1]% + \fi\fi \the\everybtxlistrendering \publ_place_list_indeed \endgroup} diff --git a/tex/context/base/s-figures-names.mkiv b/tex/context/base/s-figures-names.mkiv new file mode 100644 index 000000000..913fcafdb --- /dev/null +++ b/tex/context/base/s-figures-names.mkiv @@ -0,0 +1,96 @@ +%D \module +%D [ file=s-figures-names.mkiv, +%D version=2017.07.17, +%D title=\CONTEXT\ Style File, +%D subtitle=Show Figure Names, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D Normally this module will be run someplace at the end of a document in some kind of tracing +%D mode. We could hook it into \type {\stoptext} but better leave it up to the user. Loading +%D this module upfront will not show anything useful. The main reason for making this module +%D was that we wanted to report weird figurenames: spaces, multiple hyphens in a row, mixed +%D hyphens and underscores, inconsistently mixed upper and lowercase, etc. +%D +%D If you only want info in the logfile, you can use: +%D +%D \starttyping +%D \enabletrackers[graphics.lognames] +%D \stoptyping +%D +%D This directive is persistent and can be issued any time before the end of the run. + +\startmodule[figures-names] + +\startluacode + +local context = context +local ctx_NC = context.NC +local ctx_NR = context.NR +local ctx_red = context.red +local ctx_starttabulate = context.starttabulate +local ctx_stoptabulate = context.stoptabulate + +trackers.enable("graphics.lognames") + +context.start() + + context.switchtobodyfont { "tt,small" } + + local template = { "|Bl|l|" } + + for _, data in table.sortedhash(figures.found) do + ctx_starttabulate(template) + local badname = data.badname + local found = data.found + ctx_NC() + context("asked name") + ctx_NC() + if badname then + ctx_red() + end + context(data.askedname) + ctx_NC() ctx_NR() + if found then + ctx_NC() + context("format") + ctx_NC() + context(data.format) + ctx_NC() ctx_NR() + ctx_NC() + context("found file") + ctx_NC() + context(data.foundname) + ctx_NC() ctx_NR() + ctx_NC() + context("used file") + ctx_NC() + context(data.fullname) + ctx_NC() ctx_NR() + if badname then + ctx_NC() + context("comment") + ctx_NC() + context("bad name") + ctx_NC() ctx_NR() + end + else + ctx_NC() + context("comment") + ctx_NC() + context(data.comment or "not found") + ctx_NC() ctx_NR() + end + ctx_stoptabulate() + end + +context.stop() + +\stopluacode + +\stopmodule diff --git a/tex/context/base/s-math-repertoire.mkiv b/tex/context/base/s-math-repertoire.mkiv index 314d23868..eeda5f66c 100644 --- a/tex/context/base/s-math-repertoire.mkiv +++ b/tex/context/base/s-math-repertoire.mkiv @@ -169,7 +169,10 @@ \startgot [U+02200] operators \stopgot \quad \startgot [U+02701] symbols a \stopgot \quad \startgot [U+02901] symbols b \stopgot \quad - \startgot [U+02A00] supplemental \stopgot + \startgot [U+02A00] supplemental \stopgot \quad + \startgot [U+027F0] arrows a \stopgot \quad + \startgot [U+02900] arrows b \stopgot \quad + \startgot [U+1F800] arrows c \stopgot \stopinteractionmenu \defineframed @@ -418,7 +421,7 @@ \continueifinputfile{s-math-repertoire.mkiv} -\showmathcharacterssetbodyfonts{lucidanova,cambria,xits,modern,pagella,termes,bonum,schola} +\showmathcharacterssetbodyfonts{lucidaot,cambria,xits,modern,pagella,termes,bonum,schola} \starttext @@ -434,10 +437,10 @@ % \setupbodyfont[stix, 12pt] % \setupbodyfont[xits, 12pt] % \setupbodyfont[lucida, 12pt] - % \setupbodyfont[lucidanova,12pt] + \setupbodyfont[lucidaot, 12pt] % \setupbodyfont[pagella, 12pt] % \setupbodyfont[bonum, 12pt] - \setupbodyfont[schola, 12pt] + % \setupbodyfont[schola, 12pt] } { diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex f06bb14b3..0241ba073 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex 7b3ebf9f2..e54405486 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/strc-lst.lua b/tex/context/base/strc-lst.lua index 16160e273..6a2c07249 100644 --- a/tex/context/base/strc-lst.lua +++ b/tex/context/base/strc-lst.lua @@ -221,6 +221,8 @@ end local enhanced = { } +local synchronizepage = function(r) synchronizepage = references.synchronizepage return synchronizepage(r) end -- bah ... will move + function lists.enhance(n) local l = cached[n] if not l then @@ -237,7 +239,7 @@ function lists.enhance(n) -- save in the right order (happens at shipout) lists.tobesaved[#lists.tobesaved+1] = l -- default enhancer (cross referencing) - references.realpage = texgetcount("realpageno") + synchronizepage(references) -- tags local kind = metadata.kind local name = metadata.name diff --git a/tex/context/base/strc-ref.lua b/tex/context/base/strc-ref.lua index 3f2c0608d..8a2a668c0 100644 --- a/tex/context/base/strc-ref.lua +++ b/tex/context/base/strc-ref.lua @@ -76,6 +76,8 @@ local references = structures.references local lists = structures.lists local counters = structures.counters +local jobpositions = job.positions + -- some might become local references.defined = references.defined or allocate() @@ -387,10 +389,28 @@ function references.set(kind,prefix,tag,data) return n > 0 end +-- function references.enhance(prefix,tag) +-- local l = tobesaved[prefix][tag] +-- if l then +-- l.references.realpage = texgetcount("realpageno") +-- end +-- end + +local getpos = function() getpos = backends.codeinjections.getpos return getpos () end + +local function synchronizepage(reference) -- non public helper + reference.realpage = texgetcount("realpageno") + if jobpositions.used then + reference.x, reference.y = getpos() + end +end + +references.synchronizepage = synchronizepage + function references.enhance(prefix,tag) local l = tobesaved[prefix][tag] if l then - l.references.realpage = texgetcount("realpageno") + synchronizepage(l.references) end end @@ -2056,12 +2076,71 @@ local specials = references.testspecials -- pretty slow (progressively). In the pagebody one can best check the reference -- real page to determine if we need contrastlocation as that is more lightweight. -local function checkedpagestate(n,page) - local r = referredpage(n) +local function checkedpagestate(n,page,actions,position,spread) local p = tonumber(page) if not p then return 0 - elseif p > r then + end + if position and #actions > 0 then + local i = actions[1].i -- brrr + if i then + local a = i.references + if a then + local x = a.x + local y = a.y + if x and y then + local jp = jobpositions.collected[position] + if jp then + local px = jp.x + local py = jp.y + local pp = jp.p + if p == pp then + -- same page + if py > y then + return 5 -- above + elseif py < y then + return 4 -- below + elseif px > x then + return 4 -- below + elseif px < x then + return 5 -- above + else + return 1 -- same + end + elseif spread then + if pp % 2 == 0 then + -- left page + if pp > p then + return 2 -- before + elseif pp + 1 == p then +-- return 4 -- below (on right page) + return 5 -- above (on left page) + else + return 3 -- after + end + else + -- right page + if pp < p then + return 3 -- after + elseif pp - 1 == p then +-- return 5 -- above (on left page) + return 4 -- below (on right page) + else + return 2 -- before + end + end + elseif pp > p then + return 2 -- before + else + return 3 -- after + end + end + end + end + end + end + local r = referredpage(n) -- sort of obsolete + if p > r then return 3 -- after elseif p < r then return 2 -- before @@ -2104,7 +2183,7 @@ end -- at this moment only the real reference page is analyzed -- normally such an analysis happens in the backend code -function references.analyze(actions) +function references.analyze(actions,position,spread) if not actions then actions = references.currentset end @@ -2119,24 +2198,44 @@ function references.analyze(actions) elseif actions.external then actions.pagestate = 0 else - actions.pagestate = checkedpagestate(actions.n,realpage) + actions.pagestate = checkedpagestate(actions.n,realpage,actions,position,spread) end end return actions end -function commands.referencepagestate(actions) - if not actions then - actions = references.currentset - end +-- function commands.referencepagestate(actions) +-- if not actions then +-- actions = references.currentset +-- end +-- if not actions then +-- context(0) +-- else +-- if not actions.pagestate then +-- references.analyze(actions) -- delayed unless explicitly asked for +-- end +-- context(actions.pagestate) +-- end +-- end + +function commands.referencepagestate(position,detail,spread) + local actions = references.currentset if not actions then context(0) else if not actions.pagestate then - references.analyze(actions) -- delayed unless explicitly asked for --- print("NO STATE",actions.reference,actions.pagestate) + references.analyze(actions,position,spread) -- delayed unless explicitly asked for + end + local pagestate = actions.pagestate + if detail then + context(pagestate) + elseif pagestate == 4 then + context(2) -- compatible + elseif pagestate == 5 then + context(3) -- compatible + else + context(pagestate) end - context(actions.pagestate) end end diff --git a/tex/context/base/strc-ref.mkvi b/tex/context/base/strc-ref.mkvi index 87a3ee478..715459172 100644 --- a/tex/context/base/strc-ref.mkvi +++ b/tex/context/base/strc-ref.mkvi @@ -984,41 +984,198 @@ %D ... \atpage[someref] ... %D \stoptyping -% 0 = unknown -% 1 = same -% 2 = before -% 3 = after +% % 0 = unknown +% % 1 = same +% % 2 = before +% % 3 = after +% +% \def\strc_references_by_reference_page_state#unknown#before#current#after% +% {\ifcase\referencepagestate\space#unknown\or#current\or#before\or#after\fi} +% +% % \unexpanded\def\somewhere#backward#foreward#dummy[#label]% #dummy gobbles space around #foreward +% % {\doifreferencefoundelse{#label}% usage needs checking (useless) +% % {\goto{\strc_references_by_reference_page_state{#label}{#backward}{}{#foreward}}[#label]} +% % {[#label]}} +% % +% % better: +% +% \unexpanded\def\somewhere#backward#foreward#dummy[#label]% #dummy gobbles space around #foreward +% {\doifreferencefoundelse{#label}% +% {\strc_references_by_reference_page_state{#label}{\goto{#backward}[#label]}{}{\goto{#foreward}[#label]}} +% {[#label]}} +% +% \unexpanded\def\atpage[#label]% todo +% {\doifreferencefoundelse{#label}% kind of inefficient as \goto also analyzes +% {\goto +% {\strc_references_by_reference_page_state +% {\labeltexts\v!page\dummyreference}% +% {\labeltext\v!hencefore}% +% {\labeltexts\v!atpage\currentreferencepage}% +% {\labeltext\v!hereafter}}% +% [#label]} +% {[#label]}} +% +% \unexpanded\def\referencesymbol +% {\hbox{\strut\high +% {\setupsymbolset[\interactionparameter\c!symbolset]% +% \symbol[\strc_references_by_reference_page_state\v!somewhere\v!nowhere\v!previous\v!next]}}} + +% standard detail +% +% 0 = unknown unknown +% 1 = same on same page +% 2 = before preceding page +% 3 = after following page +% +% 4 = above above on same page +% 5 = below below on same page + +% todo: optimize for use in pagebody +% todo: maybe make it optional + +% \setuppagenumbering[alternative=doublesided] +% \setupreferencing [doublesided=no] % yes is default +% +% \somewhere{backward}{foreward}[label] +% \someplace{preceding}{backward}{current}{foreward}{following}[label] +% \atpage[#label] +% \doifcheckedpagestate{label}{preceding}{backward}{current}{foreward}{following}{otherwise} +% +% \dorecurse {20} { +% \placefigure[here][fig:#1]{}{\externalfigure[dummy]} +% \dorecurse {20} { +% ##1: \atpage[fig:##1] / +% \doifcheckedpagestate +% {fig:##1} +% {preceding}{backward}{current}{foreward}{following} +% {otherwise} +% } +% } + +\newcount \nofreferencestates +\newconditional\pagestatespread + +\appendtoks + \doifelse{\referencingparameter\c!doublesided}\v!yes\settrue\setfalse\pagestatespread +\to \everysetupreferencing + +\setupreferencing + [\c!doublesided=\v!yes] -\def\strc_references_by_reference_page_state#unknown#before#current#after% - {\ifcase\referencepagestate\space#unknown\or#current\or#before\or#after\fi} +\def\referencepagestate {\numexpr\ctxcommand{referencepagestate("rst::\number\nofreferencestates")}\relax} +\def\referencepagedetail{\numexpr\ctxcommand{referencepagestate("rst::\number\nofreferencestates",true\ifconditional\pagestatespread\ifdoublesided,\s!true\fi\fi)}\relax} + +\unexpanded\def\tracedpagestate + {{\blue\tttf(\ifcase\referencepagedetail unknown\or same\or previous\or next\or above\or below\else unknown\fi)}} + +\unexpanded\def\markreferencepage + {\dontleavehmode\begingroup + \iftrialtypesetting + % issue warning that not stable + \else + % needs checking ... but probably never in trialmode + \global\advance\nofreferencestates\plusone + \xypos{rst::\number\nofreferencestates}% + % \tracedpagestate + \fi + \endgroup} + +% \def\strc_references_by_reference_page_state#unknown#before#current#after% obsolete +% {\ifcase\referencepagestate#unknown\or#current\or#before\or#after\or#before\or#after\else#unknown\fi} +% +% \def\strc_references_by_reference_page_state#unknown#same#previous#next#above#below% not needed +% {\ifcase\referencepagestate#unknown\or#same\or#previous\or#next\or#above\or#below\else#unknown\fi} + +\unexpanded\def\doifcheckedpagestate#label% #preceding#backward#current#foreward#following#otherwise% + {\doifreferencefoundelse{#label}\strc_references_handle_page_state_yes\strc_references_handle_page_state_nop} + +\let\strc_references_handle_page_state_nop\sixthofsixarguments + +\def\strc_references_handle_page_state_yes + {\markreferencepage + \ifcase\referencepagedetail + \expandafter\sixthofsixarguments \or + \expandafter\thirdofsixarguments \or + \expandafter\firstofsixarguments \or + \expandafter\fifthofsixarguments \or + \expandafter\secondofsixarguments\or + \expandafter\fourthofsixarguments\else + \expandafter\sixthofsixarguments \fi} + +\unexpanded\def\referencesymbol + {\hbox\bgroup + \strut + \markreferencepage + \high + {\setupsymbolset[\interactionparameter\c!symbolset]% + \symbol[\ifcase\referencepagedetail\v!somewhere\or\v!nowhere\or\v!previous\or\v!next\or\v!previous\or\v!next\else\v!somewhere\fi]}% + \egroup} % \unexpanded\def\somewhere#backward#foreward#dummy[#label]% #dummy gobbles space around #foreward -% {\doifreferencefoundelse{#label}% usage needs checking (useless) -% {\goto{\strc_references_by_reference_page_state{#label}{#backward}{}{#foreward}}[#label]} +% {\doifreferencefoundelse{#label}% +% {\markreferencepage +% \ifcase\referencepagedetail +% #label\or % unknown +% \or % same +% \goto{#backward}[#label]\or % previous +% \goto{#foreward}[#label]\or % next +% \goto{#backward}[#label]\or % above +% \goto{#foreward}[#label]\else % below +% #label\fi}% % {[#label]}} -% -% better: \unexpanded\def\somewhere#backward#foreward#dummy[#label]% #dummy gobbles space around #foreward - {\doifreferencefoundelse{#label}% - {\strc_references_by_reference_page_state{#label}{\goto{#backward}[#label]}{}{\goto{#foreward}[#label]}} - {[#label]}} + {\doifcheckedpagestate{#label}% + {\goto{#backward}[#label]}% + {\goto{#backward}[#label]}% + {}% + {\goto{#foreward}[#label]}% + {\goto{#foreward}[#label]}% + {#label}}% + +% \unexpanded\def\someplace#preceding#backward#current#foreward#following#dummy[#label]% #dummy gobbles space around #foreward +% {\doifreferencefoundelse{#label}% +% {\markreferencepage +% \ifcase\referencepagedetail +% #label\or % unknown +% \doifsomething {#current}{\goto {#current}[#label]}\or % same +% \doifsomething{#preceding}{\goto{#preceding}[#label]}\or % previous +% \doifsomething{#following}{\goto{#following}[#label]}\or % next +% \doifsomething {#backward}{\goto {#backward}[#label]}\or % above +% \doifsomething {#foreward}{\goto {#foreward}[#label]}\else % below +% #label\fi}% +% {[#label]}} -\unexpanded\def\atpage[#label]% todo - {\doifreferencefoundelse{#label}% kind of inefficient as \goto also analyzes - {\goto - {\strc_references_by_reference_page_state - {\labeltexts\v!page\dummyreference}% - {\labeltext\v!hencefore}% - {\labeltexts\v!atpage\currentreferencepage}% - {\labeltext\v!hereafter}}% - [#label]} - {[#label]}} +\unexpanded\def\someplace#preceding#backward#current#foreward#following#dummy[#label]% #dummy gobbles space around #foreward + {\doifcheckedpagestate{#label}% + {\doifsomething{#preceding}{\goto{#preceding}[#label]}}% + {\doifsomething {#backward}{\goto {#backward}[#label]}}% + {\doifsomething {#current}{\goto {#current}[#label]}}% + {\doifsomething {#foreward}{\goto {#foreward}[#label]}}% + {\doifsomething{#following}{\goto{#following}[#label]}}% + {#label}} + +% \unexpanded\def\atpage[#label]% todo +% {\doifreferencefoundelse{#label}% kind of inefficient as \goto also analyzes +% {\markreferencepage +% \ifcase\referencepagedetail +% \goto{\labeltexts\v!page\dummyreference}[#label]\or % unknown +% \or % same +% \goto{\labeltext \v!precedingpage }[#label]\or % previous +% \goto{\labeltext \v!followingpage }[#label]\or % next +% \goto{\labeltext \v!hencefore }[#label]\or % above +% \goto{\labeltext \v!hereafter }[#label]\else % below +% \goto{\labeltexts\v!page\dummyreference}[#label]\fi}% +% {[#label]}} -\unexpanded\def\referencesymbol - {\hbox{\strut\high - {\setupsymbolset[\interactionparameter\c!symbolset]% - \symbol[\strc_references_by_reference_page_state\v!somewhere\v!nowhere\v!previous\v!next]}}} +\unexpanded\def\atpage[#label]% todo + {\doifcheckedpagestate{#label}% + {\goto{\labeltext \v!precedingpage }[#label]}% + {\goto{\labeltext \v!hencefore }[#label]}% + {}% + {\goto{\labeltext \v!hereafter }[#label]}% + {\goto{\labeltext \v!followingpage }[#label]}% + {\goto{\labeltexts\v!page\dummyreference}[#label]}} %D The other alternatives just conform their names: only the %D label, only the text, or the label and the text. diff --git a/tex/context/interface/keys-cs.xml b/tex/context/interface/keys-cs.xml index cdfdf016f..e32918566 100644 --- a/tex/context/interface/keys-cs.xml +++ b/tex/context/interface/keys-cs.xml @@ -183,6 +183,7 @@ <cd:variable name='flushleft' value='flushleft'/> <cd:variable name='flushouter' value='flushouter'/> <cd:variable name='flushright' value='flushright'/> + <cd:variable name='followingpage' value='followingpage'/> <cd:variable name='footer' value='upati'/> <cd:variable name='footnote' value='poznamkapodcarou'/> <cd:variable name='force' value='sila'/> @@ -363,6 +364,7 @@ <cd:variable name='positive' value='positiv'/> <cd:variable name='postponing' value='odlozit'/> <cd:variable name='postscript' value='postscript'/> + <cd:variable name='precedingpage' value='followingpage'/> <cd:variable name='preference' value='nastaveni'/> <cd:variable name='preview' value='nahled'/> <cd:variable name='previous' value='predchozi'/> diff --git a/tex/context/interface/keys-de.xml b/tex/context/interface/keys-de.xml index ea4067288..48329fabf 100644 --- a/tex/context/interface/keys-de.xml +++ b/tex/context/interface/keys-de.xml @@ -183,6 +183,7 @@ <cd:variable name='flushleft' value='flushleft'/> <cd:variable name='flushouter' value='flushouter'/> <cd:variable name='flushright' value='flushright'/> + <cd:variable name='followingpage' value='followingpage'/> <cd:variable name='footer' value='fusszeile'/> <cd:variable name='footnote' value='fussnote'/> <cd:variable name='force' value='zwinge'/> @@ -363,6 +364,7 @@ <cd:variable name='positive' value='positiv'/> <cd:variable name='postponing' value='verschieben'/> <cd:variable name='postscript' value='postscript'/> + <cd:variable name='precedingpage' value='followingpage'/> <cd:variable name='preference' value='einstellung'/> <cd:variable name='preview' value='vorschau'/> <cd:variable name='previous' value='vorig'/> diff --git a/tex/context/interface/keys-en.xml b/tex/context/interface/keys-en.xml index 736198166..dd8de7312 100644 --- a/tex/context/interface/keys-en.xml +++ b/tex/context/interface/keys-en.xml @@ -183,6 +183,7 @@ <cd:variable name='flushleft' value='flushleft'/> <cd:variable name='flushouter' value='flushouter'/> <cd:variable name='flushright' value='flushright'/> + <cd:variable name='followingpage' value='followingpage'/> <cd:variable name='footer' value='footer'/> <cd:variable name='footnote' value='footnote'/> <cd:variable name='force' value='force'/> @@ -363,6 +364,7 @@ <cd:variable name='positive' value='positive'/> <cd:variable name='postponing' value='postponing'/> <cd:variable name='postscript' value='postscript'/> + <cd:variable name='precedingpage' value='followingpage'/> <cd:variable name='preference' value='preference'/> <cd:variable name='preview' value='preview'/> <cd:variable name='previous' value='previous'/> diff --git a/tex/context/interface/keys-fr.xml b/tex/context/interface/keys-fr.xml index 314e1b87f..4a9f2b78b 100644 --- a/tex/context/interface/keys-fr.xml +++ b/tex/context/interface/keys-fr.xml @@ -183,6 +183,7 @@ <cd:variable name='flushleft' value='flushleft'/> <cd:variable name='flushouter' value='flushouter'/> <cd:variable name='flushright' value='flushright'/> + <cd:variable name='followingpage' value='followingpage'/> <cd:variable name='footer' value='pdp'/> <cd:variable name='footnote' value='notepdp'/> <cd:variable name='force' value='force'/> @@ -363,6 +364,7 @@ <cd:variable name='positive' value='positif'/> <cd:variable name='postponing' value='postponing'/> <cd:variable name='postscript' value='postscript'/> + <cd:variable name='precedingpage' value='followingpage'/> <cd:variable name='preference' value='preference'/> <cd:variable name='preview' value='previsualisation'/> <cd:variable name='previous' value='precedent'/> diff --git a/tex/context/interface/keys-it.xml b/tex/context/interface/keys-it.xml index 9af423467..ce1be9a61 100644 --- a/tex/context/interface/keys-it.xml +++ b/tex/context/interface/keys-it.xml @@ -183,6 +183,7 @@ <cd:variable name='flushleft' value='flushleft'/> <cd:variable name='flushouter' value='flushouter'/> <cd:variable name='flushright' value='flushright'/> + <cd:variable name='followingpage' value='followingpage'/> <cd:variable name='footer' value='piedipagina'/> <cd:variable name='footnote' value='notapdp'/> <cd:variable name='force' value='forza'/> @@ -363,6 +364,7 @@ <cd:variable name='positive' value='positivo'/> <cd:variable name='postponing' value='posporre'/> <cd:variable name='postscript' value='postscript'/> + <cd:variable name='precedingpage' value='followingpage'/> <cd:variable name='preference' value='preferenza'/> <cd:variable name='preview' value='anteprima'/> <cd:variable name='previous' value='precedente'/> diff --git a/tex/context/interface/keys-nl.xml b/tex/context/interface/keys-nl.xml index efe7814ed..bdcf2a96a 100644 --- a/tex/context/interface/keys-nl.xml +++ b/tex/context/interface/keys-nl.xml @@ -183,6 +183,7 @@ <cd:variable name='flushleft' value='lijnlinks'/> <cd:variable name='flushouter' value='lijnbuiten'/> <cd:variable name='flushright' value='lijnrechts'/> + <cd:variable name='followingpage' value='opvolgendepagina'/> <cd:variable name='footer' value='voet'/> <cd:variable name='footnote' value='voetnoot'/> <cd:variable name='force' value='forceer'/> @@ -363,6 +364,7 @@ <cd:variable name='positive' value='positief'/> <cd:variable name='postponing' value='uitstellen'/> <cd:variable name='postscript' value='postscript'/> + <cd:variable name='precedingpage' value='voorafgaandepagina'/> <cd:variable name='preference' value='voorkeur'/> <cd:variable name='preview' value='preview'/> <cd:variable name='previous' value='vorige'/> diff --git a/tex/context/interface/keys-pe.xml b/tex/context/interface/keys-pe.xml index 5eeaedcfe..77b137293 100644 --- a/tex/context/interface/keys-pe.xml +++ b/tex/context/interface/keys-pe.xml @@ -183,6 +183,7 @@ <cd:variable name='flushleft' value='پمپچپ'/> <cd:variable name='flushouter' value='پمپخارجی'/> <cd:variable name='flushright' value='پمپراست'/> + <cd:variable name='followingpage' value='followingpage'/> <cd:variable name='footer' value='تهبرگ'/> <cd:variable name='footnote' value='پانوشت'/> <cd:variable name='force' value='اجبار'/> @@ -363,6 +364,7 @@ <cd:variable name='positive' value='مثبت'/> <cd:variable name='postponing' value='تاخیر'/> <cd:variable name='postscript' value='پستاسکریپت'/> + <cd:variable name='precedingpage' value='followingpage'/> <cd:variable name='preference' value='ترجیح'/> <cd:variable name='preview' value='پیشدید'/> <cd:variable name='previous' value='قبلی'/> diff --git a/tex/context/interface/keys-ro.xml b/tex/context/interface/keys-ro.xml index 5f707884f..ad07ea880 100644 --- a/tex/context/interface/keys-ro.xml +++ b/tex/context/interface/keys-ro.xml @@ -183,6 +183,7 @@ <cd:variable name='flushleft' value='flushleft'/> <cd:variable name='flushouter' value='flushouter'/> <cd:variable name='flushright' value='flushright'/> + <cd:variable name='followingpage' value='followingpage'/> <cd:variable name='footer' value='subsol'/> <cd:variable name='footnote' value='notasubsol'/> <cd:variable name='force' value='fortat'/> @@ -363,6 +364,7 @@ <cd:variable name='positive' value='positiv'/> <cd:variable name='postponing' value='postponing'/> <cd:variable name='postscript' value='postscript'/> + <cd:variable name='precedingpage' value='followingpage'/> <cd:variable name='preference' value='preferinta'/> <cd:variable name='preview' value='previzualizare'/> <cd:variable name='previous' value='precedent'/> diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 293a31996..9eab657a1 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 : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 07/18/14 14:12:32 +-- merge date : 07/25/14 12:57:26 do -- begin closure to overcome local limits and interference @@ -2460,6 +2460,18 @@ function file.collapsepath(str,anchor) end end end +local tricky=S("/\\")*P(-1) +local attributes=lfs.attributes +function lfs.isdir(name) + if lpegmatch(tricky,name) then + return attributes(name,"mode")=="directory" + else + return attributes(name.."/.","mode")=="directory" + end +end +function lfs.isfile(name) + return attributes(name,"mode")=="file" +end local validchars=R("az","09","AZ","--","..") local pattern_a=lpeg.replacer(1-validchars) local pattern_a=Cs((validchars+P(1)/"-")^1) |