From 2ba8e37a1ceb163a08a50fb996fc138ff98a7eba Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Tue, 29 Jul 2014 01:15:04 +0200 Subject: 2014-07-29 00:32:00 --- doc/context/manuals/allkind/mkiv-publications.tex | 28 ++ doc/context/scripts/mkii/texmfstart.html | 1 + doc/context/scripts/mkii/texmfstart.man | 3 + doc/context/scripts/mkii/texmfstart.xml | 1 + doc/context/scripts/mkiv/mtxrun.html | 1 + doc/context/scripts/mkiv/mtxrun.man | 3 + doc/context/scripts/mkiv/mtxrun.xml | 1 + scripts/context/lua/mtx-convert.lua | 2 +- scripts/context/lua/mtxrun.lua | 75 +++-- scripts/context/stubs/mswin/mtxrun.lua | 75 +++-- scripts/context/stubs/unix/mtxrun | 75 +++-- scripts/context/stubs/win64/mtxrun.lua | 75 +++-- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4441 -> 4431 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/data-pre.lua | 52 ++-- tex/context/base/font-otb.lua | 17 +- tex/context/base/font-ott.lua | 7 +- tex/context/base/font-sel.lua | 3 + tex/context/base/font-sel.mkvi | 89 +++++- tex/context/base/l-file.lua | 75 ++++- tex/context/base/publ-aut.lua | 4 +- tex/context/base/publ-imp-apa.mkvi | 16 + tex/context/base/publ-imp-cite.mkvi | 21 ++ tex/context/base/publ-ini.lua | 325 +++++++++++++-------- tex/context/base/publ-ini.mkiv | 3 +- tex/context/base/status-files.pdf | Bin 24895 -> 24949 bytes tex/context/base/status-lua.pdf | Bin 326886 -> 326999 bytes tex/generic/context/luatex/luatex-fonts-merged.lua | 37 +-- 29 files changed, 689 insertions(+), 304 deletions(-) diff --git a/doc/context/manuals/allkind/mkiv-publications.tex b/doc/context/manuals/allkind/mkiv-publications.tex index b9da53ba6..23bf1e1b5 100644 --- a/doc/context/manuals/allkind/mkiv-publications.tex +++ b/doc/context/manuals/allkind/mkiv-publications.tex @@ -1,5 +1,33 @@ % language=uk +% \usebtxdataset[alan-1.bib] +% \setupbtxrendering[standard][repeat=yes,continue=yes,method=global] +% +% \starttext +% +% \startbodymatter +% \startchapter[title=First chapter] +% cite: \cite[Hagen] +% \blank +% \placelistofpublications[standard][criterium=chapter] +% \stopchapter +% \startchapter[title=Second chapter] +% cite: \cite[Scarso] +% \blank +% cite: \cite[Hagen] +% \blank +% \placelistofpublications[standard][criterium=chapter] +% \stopchapter +% \stopbodymatter +% +% \startbackmatter +% \startchapter[title=Bibliography,number=no] +% \placelistofpublications[standard][criterium=all] +% \stopchapter +% \stopbackmatter +% +% \stoptext + % \usebtxdataset % [example] % [t:/manuals/publications-mkiv/mkiv-publications.bib] diff --git a/doc/context/scripts/mkii/texmfstart.html b/doc/context/scripts/mkii/texmfstart.html index 8d44012bf..70de410df 100644 --- a/doc/context/scripts/mkii/texmfstart.html +++ b/doc/context/scripts/mkii/texmfstart.html @@ -62,6 +62,7 @@ --verbosegive a bit more info --trackerslistenable given trackers --prognamestrformat or backend + --systeminfostrshow current operating system, processor, etc --editlaunch editor with found file --launchlaunch files like manuals, assumes os support (--all) diff --git a/doc/context/scripts/mkii/texmfstart.man b/doc/context/scripts/mkii/texmfstart.man index 77dc02dc5..5bb88c47f 100644 --- a/doc/context/scripts/mkii/texmfstart.man +++ b/doc/context/scripts/mkii/texmfstart.man @@ -71,6 +71,9 @@ enable given trackers .B --progname=str format or backend .TP +.B --systeminfo=str +show current operating system, processor, etc +.TP .B --edit launch editor with found file .TP diff --git a/doc/context/scripts/mkii/texmfstart.xml b/doc/context/scripts/mkii/texmfstart.xml index 249a9bb54..c19484d9d 100644 --- a/doc/context/scripts/mkii/texmfstart.xml +++ b/doc/context/scripts/mkii/texmfstart.xml @@ -33,6 +33,7 @@ give a bit more info enable given trackers format or backend + show current operating system, processor, etc launch editor with found file diff --git a/doc/context/scripts/mkiv/mtxrun.html b/doc/context/scripts/mkiv/mtxrun.html index f2c0e69fa..f1ec9a29d 100644 --- a/doc/context/scripts/mkiv/mtxrun.html +++ b/doc/context/scripts/mkiv/mtxrun.html @@ -62,6 +62,7 @@ --verbosegive a bit more info --trackerslistenable given trackers --prognamestrformat or backend + --systeminfostrshow current operating system, processor, etc --editlaunch editor with found file --launchlaunch files like manuals, assumes os support (--all) diff --git a/doc/context/scripts/mkiv/mtxrun.man b/doc/context/scripts/mkiv/mtxrun.man index 77dc02dc5..5bb88c47f 100644 --- a/doc/context/scripts/mkiv/mtxrun.man +++ b/doc/context/scripts/mkiv/mtxrun.man @@ -71,6 +71,9 @@ enable given trackers .B --progname=str format or backend .TP +.B --systeminfo=str +show current operating system, processor, etc +.TP .B --edit launch editor with found file .TP diff --git a/doc/context/scripts/mkiv/mtxrun.xml b/doc/context/scripts/mkiv/mtxrun.xml index f1b1e01f4..01f2d1263 100644 --- a/doc/context/scripts/mkiv/mtxrun.xml +++ b/doc/context/scripts/mkiv/mtxrun.xml @@ -34,6 +34,7 @@ give a bit more info enable given trackers format or backend + show current operating system, processor, etc launch editor with found file diff --git a/scripts/context/lua/mtx-convert.lua b/scripts/context/lua/mtx-convert.lua index b76b3baaf..d5dba075a 100644 --- a/scripts/context/lua/mtx-convert.lua +++ b/scripts/context/lua/mtx-convert.lua @@ -48,7 +48,7 @@ local convert = scripts.convert convert.converters = convert.converters or { } local converters = convert.converters -local gsprogram = os.type == "windows" and "gswin32c" or "gs" +local gsprogram = (os.type == "windows" and (os.which("gswin64c.exe") or os.which("gswin32c.exe"))) or "gs" local gstemplate_eps = "%s -q -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -dEPSCrop -dNOPAUSE -dSAFER -dNOCACHE -dBATCH -dAutoRotatePages=/None -dProcessColorModel=/DeviceCMYK -sOutputFile=%s %s -c quit" local gstemplate_ps = "%s -q -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -dNOPAUSE -dSAFER -dNOCACHE -dBATCH -dAutoRotatePages=/None -dProcessColorModel=/DeviceCMYK -sOutputFile=%s %s -c quit" diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 06db6c54e..d61d95d56 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: 18672, stripped down to: 10256 +-- original size: 20687, stripped down to: 10417 if not modules then modules={} end modules ['l-file']={ version=1.001, @@ -3353,28 +3353,30 @@ local isroot=fwslash^1*-1 local hasroot=fwslash^1 local reslasher=lpeg.replacer(S("\\/"),"/") local deslasher=lpeg.replacer(S("\\/")^1,"/") -function file.join(...) - local lst={... } - local one=lst[1] +function file.join(one,two,three,...) + if not two then + return one=="" and one or lpegmatch(stripper,one) + end + if one=="" then + return lpegmatch(stripper,three and concat({ two,three,... },"/") or two) + end if lpegmatch(isnetwork,one) then local one=lpegmatch(reslasher,one) - local two=lpegmatch(deslasher,concat(lst,"/",2)) + local two=lpegmatch(deslasher,three and concat({ two,three,... },"/") or two) if lpegmatch(hasroot,two) then return one..two else return one.."/"..two end elseif lpegmatch(isroot,one) then - local two=lpegmatch(deslasher,concat(lst,"/",2)) + local two=lpegmatch(deslasher,three and concat({ two,three,... },"/") or two) if lpegmatch(hasroot,two) then return two else return "/"..two end - elseif one=="" then - return lpegmatch(stripper,concat(lst,"/",2)) else - return lpegmatch(deslasher,concat(lst,"/")) + return lpegmatch(deslasher,concat({ one,two,three,... },"/")) end end local drivespec=R("az","AZ")^1*colon @@ -15538,7 +15540,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-pre"] = package.loaded["data-pre"] or true --- original size: 3346, stripped down to: 2779 +-- original size: 3950, stripped down to: 2935 if not modules then modules={} end modules ['data-pre']={ version=1.001, @@ -15613,6 +15615,13 @@ end prefixes.home=function(str) return cleanpath(joinpath(getenv('HOME'),str)) end +prefixes.env=prefixes.environment +prefixes.rel=prefixes.relative +prefixes.loc=prefixes.locate +prefixes.kpse=prefixes.locate +prefixes.full=prefixes.locate +prefixes.file=prefixes.filename +prefixes.path=prefixes.pathname local function toppath() local inputstack=resolvers.inputstack if not inputstack then @@ -15625,25 +15634,21 @@ local function toppath() return pathname end end -resolvers.toppath=toppath -prefixes.toppath=function(str) - return cleanpath(joinpath(toppath(),str)) -end -prefixes.env=prefixes.environment -prefixes.rel=prefixes.relative -prefixes.loc=prefixes.locate -prefixes.kpse=prefixes.locate -prefixes.full=prefixes.locate -prefixes.file=prefixes.filename -prefixes.path=prefixes.pathname -prefixes.jobfile=function(str) - local path=resolvers.stackpath() or "." - if str and str~="" then - return cleanpath(joinpath(path,str)) +local function jobpath() + local path=resolvers.stackpath() + if not path or path=="" then + return "." else - return cleanpath(path) + return path end end +resolvers.toppath=toppath +resolvers.jobpath=jobpath +prefixes.toppath=function(str) return cleanpath(joinpath(toppath(),str)) end +prefixes.jobpath=function(str) return cleanpath(joinpath(jobpath(),str)) end +resolvers.setdynamic("toppath") +resolvers.setdynamic("jobpath") +prefixes.jobfile=prefixes.jobpath resolvers.setdynamic("jobfile") @@ -17361,8 +17366,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 : 714341 --- stripped bytes : 253350 +-- original bytes : 716960 +-- stripped bytes : 255652 -- end library merge @@ -17613,6 +17618,7 @@ local helpinfo = [[ give a bit more info enable given trackers format or backend + show current operating system, processor, etc launch editor with found file @@ -18253,6 +18259,15 @@ function runners.gethelp(filename) end end +function runners.systeminfo() + report("architecture : %s",os.platform or "") + report("operating system : %s",os.name or "") + report("file architecture : %s",os.type or "") + report("binary path : %s",os.selfdir or "") + report("binary suffix : %s",os.binsuffix or "") + report("library suffix : %s",os.libsuffix or "") +end + -- this is a bit dirty ... first we store the first filename and next we -- split the arguments so that we only see the ones meant for this script -- ... later we will use the second half @@ -18694,6 +18709,10 @@ elseif e_argument("exporthelp") then runners.loadbase() application.export(e_argument("exporthelp"),filename) +elseif e_argument("systeminfo") then + + runners.systeminfo() + elseif e_argument("help") or filename=='help' or filename == "" then application.help() diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 06db6c54e..d61d95d56 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: 18672, stripped down to: 10256 +-- original size: 20687, stripped down to: 10417 if not modules then modules={} end modules ['l-file']={ version=1.001, @@ -3353,28 +3353,30 @@ local isroot=fwslash^1*-1 local hasroot=fwslash^1 local reslasher=lpeg.replacer(S("\\/"),"/") local deslasher=lpeg.replacer(S("\\/")^1,"/") -function file.join(...) - local lst={... } - local one=lst[1] +function file.join(one,two,three,...) + if not two then + return one=="" and one or lpegmatch(stripper,one) + end + if one=="" then + return lpegmatch(stripper,three and concat({ two,three,... },"/") or two) + end if lpegmatch(isnetwork,one) then local one=lpegmatch(reslasher,one) - local two=lpegmatch(deslasher,concat(lst,"/",2)) + local two=lpegmatch(deslasher,three and concat({ two,three,... },"/") or two) if lpegmatch(hasroot,two) then return one..two else return one.."/"..two end elseif lpegmatch(isroot,one) then - local two=lpegmatch(deslasher,concat(lst,"/",2)) + local two=lpegmatch(deslasher,three and concat({ two,three,... },"/") or two) if lpegmatch(hasroot,two) then return two else return "/"..two end - elseif one=="" then - return lpegmatch(stripper,concat(lst,"/",2)) else - return lpegmatch(deslasher,concat(lst,"/")) + return lpegmatch(deslasher,concat({ one,two,three,... },"/")) end end local drivespec=R("az","AZ")^1*colon @@ -15538,7 +15540,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-pre"] = package.loaded["data-pre"] or true --- original size: 3346, stripped down to: 2779 +-- original size: 3950, stripped down to: 2935 if not modules then modules={} end modules ['data-pre']={ version=1.001, @@ -15613,6 +15615,13 @@ end prefixes.home=function(str) return cleanpath(joinpath(getenv('HOME'),str)) end +prefixes.env=prefixes.environment +prefixes.rel=prefixes.relative +prefixes.loc=prefixes.locate +prefixes.kpse=prefixes.locate +prefixes.full=prefixes.locate +prefixes.file=prefixes.filename +prefixes.path=prefixes.pathname local function toppath() local inputstack=resolvers.inputstack if not inputstack then @@ -15625,25 +15634,21 @@ local function toppath() return pathname end end -resolvers.toppath=toppath -prefixes.toppath=function(str) - return cleanpath(joinpath(toppath(),str)) -end -prefixes.env=prefixes.environment -prefixes.rel=prefixes.relative -prefixes.loc=prefixes.locate -prefixes.kpse=prefixes.locate -prefixes.full=prefixes.locate -prefixes.file=prefixes.filename -prefixes.path=prefixes.pathname -prefixes.jobfile=function(str) - local path=resolvers.stackpath() or "." - if str and str~="" then - return cleanpath(joinpath(path,str)) +local function jobpath() + local path=resolvers.stackpath() + if not path or path=="" then + return "." else - return cleanpath(path) + return path end end +resolvers.toppath=toppath +resolvers.jobpath=jobpath +prefixes.toppath=function(str) return cleanpath(joinpath(toppath(),str)) end +prefixes.jobpath=function(str) return cleanpath(joinpath(jobpath(),str)) end +resolvers.setdynamic("toppath") +resolvers.setdynamic("jobpath") +prefixes.jobfile=prefixes.jobpath resolvers.setdynamic("jobfile") @@ -17361,8 +17366,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 : 714341 --- stripped bytes : 253350 +-- original bytes : 716960 +-- stripped bytes : 255652 -- end library merge @@ -17613,6 +17618,7 @@ local helpinfo = [[ give a bit more info enable given trackers format or backend + show current operating system, processor, etc launch editor with found file @@ -18253,6 +18259,15 @@ function runners.gethelp(filename) end end +function runners.systeminfo() + report("architecture : %s",os.platform or "") + report("operating system : %s",os.name or "") + report("file architecture : %s",os.type or "") + report("binary path : %s",os.selfdir or "") + report("binary suffix : %s",os.binsuffix or "") + report("library suffix : %s",os.libsuffix or "") +end + -- this is a bit dirty ... first we store the first filename and next we -- split the arguments so that we only see the ones meant for this script -- ... later we will use the second half @@ -18694,6 +18709,10 @@ elseif e_argument("exporthelp") then runners.loadbase() application.export(e_argument("exporthelp"),filename) +elseif e_argument("systeminfo") then + + runners.systeminfo() + elseif e_argument("help") or filename=='help' or filename == "" then application.help() diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 06db6c54e..d61d95d56 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: 18672, stripped down to: 10256 +-- original size: 20687, stripped down to: 10417 if not modules then modules={} end modules ['l-file']={ version=1.001, @@ -3353,28 +3353,30 @@ local isroot=fwslash^1*-1 local hasroot=fwslash^1 local reslasher=lpeg.replacer(S("\\/"),"/") local deslasher=lpeg.replacer(S("\\/")^1,"/") -function file.join(...) - local lst={... } - local one=lst[1] +function file.join(one,two,three,...) + if not two then + return one=="" and one or lpegmatch(stripper,one) + end + if one=="" then + return lpegmatch(stripper,three and concat({ two,three,... },"/") or two) + end if lpegmatch(isnetwork,one) then local one=lpegmatch(reslasher,one) - local two=lpegmatch(deslasher,concat(lst,"/",2)) + local two=lpegmatch(deslasher,three and concat({ two,three,... },"/") or two) if lpegmatch(hasroot,two) then return one..two else return one.."/"..two end elseif lpegmatch(isroot,one) then - local two=lpegmatch(deslasher,concat(lst,"/",2)) + local two=lpegmatch(deslasher,three and concat({ two,three,... },"/") or two) if lpegmatch(hasroot,two) then return two else return "/"..two end - elseif one=="" then - return lpegmatch(stripper,concat(lst,"/",2)) else - return lpegmatch(deslasher,concat(lst,"/")) + return lpegmatch(deslasher,concat({ one,two,three,... },"/")) end end local drivespec=R("az","AZ")^1*colon @@ -15538,7 +15540,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-pre"] = package.loaded["data-pre"] or true --- original size: 3346, stripped down to: 2779 +-- original size: 3950, stripped down to: 2935 if not modules then modules={} end modules ['data-pre']={ version=1.001, @@ -15613,6 +15615,13 @@ end prefixes.home=function(str) return cleanpath(joinpath(getenv('HOME'),str)) end +prefixes.env=prefixes.environment +prefixes.rel=prefixes.relative +prefixes.loc=prefixes.locate +prefixes.kpse=prefixes.locate +prefixes.full=prefixes.locate +prefixes.file=prefixes.filename +prefixes.path=prefixes.pathname local function toppath() local inputstack=resolvers.inputstack if not inputstack then @@ -15625,25 +15634,21 @@ local function toppath() return pathname end end -resolvers.toppath=toppath -prefixes.toppath=function(str) - return cleanpath(joinpath(toppath(),str)) -end -prefixes.env=prefixes.environment -prefixes.rel=prefixes.relative -prefixes.loc=prefixes.locate -prefixes.kpse=prefixes.locate -prefixes.full=prefixes.locate -prefixes.file=prefixes.filename -prefixes.path=prefixes.pathname -prefixes.jobfile=function(str) - local path=resolvers.stackpath() or "." - if str and str~="" then - return cleanpath(joinpath(path,str)) +local function jobpath() + local path=resolvers.stackpath() + if not path or path=="" then + return "." else - return cleanpath(path) + return path end end +resolvers.toppath=toppath +resolvers.jobpath=jobpath +prefixes.toppath=function(str) return cleanpath(joinpath(toppath(),str)) end +prefixes.jobpath=function(str) return cleanpath(joinpath(jobpath(),str)) end +resolvers.setdynamic("toppath") +resolvers.setdynamic("jobpath") +prefixes.jobfile=prefixes.jobpath resolvers.setdynamic("jobfile") @@ -17361,8 +17366,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 : 714341 --- stripped bytes : 253350 +-- original bytes : 716960 +-- stripped bytes : 255652 -- end library merge @@ -17613,6 +17618,7 @@ local helpinfo = [[ give a bit more info enable given trackers format or backend + show current operating system, processor, etc launch editor with found file @@ -18253,6 +18259,15 @@ function runners.gethelp(filename) end end +function runners.systeminfo() + report("architecture : %s",os.platform or "") + report("operating system : %s",os.name or "") + report("file architecture : %s",os.type or "") + report("binary path : %s",os.selfdir or "") + report("binary suffix : %s",os.binsuffix or "") + report("library suffix : %s",os.libsuffix or "") +end + -- this is a bit dirty ... first we store the first filename and next we -- split the arguments so that we only see the ones meant for this script -- ... later we will use the second half @@ -18694,6 +18709,10 @@ elseif e_argument("exporthelp") then runners.loadbase() application.export(e_argument("exporthelp"),filename) +elseif e_argument("systeminfo") then + + runners.systeminfo() + elseif e_argument("help") or filename=='help' or filename == "" then application.help() diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index 06db6c54e..d61d95d56 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: 18672, stripped down to: 10256 +-- original size: 20687, stripped down to: 10417 if not modules then modules={} end modules ['l-file']={ version=1.001, @@ -3353,28 +3353,30 @@ local isroot=fwslash^1*-1 local hasroot=fwslash^1 local reslasher=lpeg.replacer(S("\\/"),"/") local deslasher=lpeg.replacer(S("\\/")^1,"/") -function file.join(...) - local lst={... } - local one=lst[1] +function file.join(one,two,three,...) + if not two then + return one=="" and one or lpegmatch(stripper,one) + end + if one=="" then + return lpegmatch(stripper,three and concat({ two,three,... },"/") or two) + end if lpegmatch(isnetwork,one) then local one=lpegmatch(reslasher,one) - local two=lpegmatch(deslasher,concat(lst,"/",2)) + local two=lpegmatch(deslasher,three and concat({ two,three,... },"/") or two) if lpegmatch(hasroot,two) then return one..two else return one.."/"..two end elseif lpegmatch(isroot,one) then - local two=lpegmatch(deslasher,concat(lst,"/",2)) + local two=lpegmatch(deslasher,three and concat({ two,three,... },"/") or two) if lpegmatch(hasroot,two) then return two else return "/"..two end - elseif one=="" then - return lpegmatch(stripper,concat(lst,"/",2)) else - return lpegmatch(deslasher,concat(lst,"/")) + return lpegmatch(deslasher,concat({ one,two,three,... },"/")) end end local drivespec=R("az","AZ")^1*colon @@ -15538,7 +15540,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-pre"] = package.loaded["data-pre"] or true --- original size: 3346, stripped down to: 2779 +-- original size: 3950, stripped down to: 2935 if not modules then modules={} end modules ['data-pre']={ version=1.001, @@ -15613,6 +15615,13 @@ end prefixes.home=function(str) return cleanpath(joinpath(getenv('HOME'),str)) end +prefixes.env=prefixes.environment +prefixes.rel=prefixes.relative +prefixes.loc=prefixes.locate +prefixes.kpse=prefixes.locate +prefixes.full=prefixes.locate +prefixes.file=prefixes.filename +prefixes.path=prefixes.pathname local function toppath() local inputstack=resolvers.inputstack if not inputstack then @@ -15625,25 +15634,21 @@ local function toppath() return pathname end end -resolvers.toppath=toppath -prefixes.toppath=function(str) - return cleanpath(joinpath(toppath(),str)) -end -prefixes.env=prefixes.environment -prefixes.rel=prefixes.relative -prefixes.loc=prefixes.locate -prefixes.kpse=prefixes.locate -prefixes.full=prefixes.locate -prefixes.file=prefixes.filename -prefixes.path=prefixes.pathname -prefixes.jobfile=function(str) - local path=resolvers.stackpath() or "." - if str and str~="" then - return cleanpath(joinpath(path,str)) +local function jobpath() + local path=resolvers.stackpath() + if not path or path=="" then + return "." else - return cleanpath(path) + return path end end +resolvers.toppath=toppath +resolvers.jobpath=jobpath +prefixes.toppath=function(str) return cleanpath(joinpath(toppath(),str)) end +prefixes.jobpath=function(str) return cleanpath(joinpath(jobpath(),str)) end +resolvers.setdynamic("toppath") +resolvers.setdynamic("jobpath") +prefixes.jobfile=prefixes.jobpath resolvers.setdynamic("jobfile") @@ -17361,8 +17366,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 : 714341 --- stripped bytes : 253350 +-- original bytes : 716960 +-- stripped bytes : 255652 -- end library merge @@ -17613,6 +17618,7 @@ local helpinfo = [[ give a bit more info enable given trackers format or backend + show current operating system, processor, etc launch editor with found file @@ -18253,6 +18259,15 @@ function runners.gethelp(filename) end end +function runners.systeminfo() + report("architecture : %s",os.platform or "") + report("operating system : %s",os.name or "") + report("file architecture : %s",os.type or "") + report("binary path : %s",os.selfdir or "") + report("binary suffix : %s",os.binsuffix or "") + report("library suffix : %s",os.libsuffix or "") +end + -- this is a bit dirty ... first we store the first filename and next we -- split the arguments so that we only see the ones meant for this script -- ... later we will use the second half @@ -18694,6 +18709,10 @@ elseif e_argument("exporthelp") then runners.loadbase() application.export(e_argument("exporthelp"),filename) +elseif e_argument("systeminfo") then + + runners.systeminfo() + elseif e_argument("help") or filename=='help' or filename == "" then application.help() diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 98218ba55..f8ce269bc 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.26 14:38} +\newcontextversion{2014.07.29 00:30} %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 index 1afdca0d3..ea6da3b1c 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index d4f5bec86..ce5b6db10 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.26 14:38} +\edef\contextversion{2014.07.29 00:30} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/data-pre.lua b/tex/context/base/data-pre.lua index ae4477ac6..1c5016f86 100644 --- a/tex/context/base/data-pre.lua +++ b/tex/context/base/data-pre.lua @@ -87,6 +87,17 @@ prefixes.home = function(str) return cleanpath(joinpath(getenv('HOME'),str)) end +prefixes.env = prefixes.environment +prefixes.rel = prefixes.relative +prefixes.loc = prefixes.locate +prefixes.kpse = prefixes.locate +prefixes.full = prefixes.locate +prefixes.file = prefixes.filename +prefixes.path = prefixes.pathname + +-- This one assumes that inputstack is set (used in the tex loader). It is a momentary resolve +-- as the top of the input stack changes. + local function toppath() local inputstack = resolvers.inputstack -- dependency, actually the code should move but it's if not inputstack then -- more convenient to keep it here @@ -100,27 +111,32 @@ local function toppath() end end -resolvers.toppath = toppath - -prefixes.toppath = function(str) - return cleanpath(joinpath(toppath(),str)) -end - -prefixes.env = prefixes.environment -prefixes.rel = prefixes.relative -prefixes.loc = prefixes.locate -prefixes.kpse = prefixes.locate -prefixes.full = prefixes.locate -prefixes.file = prefixes.filename -prefixes.path = prefixes.pathname +-- The next variant is similar but bound to explicitly registered paths. Practice should +-- show if that gives the same results as the previous one. It is meant for a project +-- stucture. -prefixes.jobfile = function(str) - local path = resolvers.stackpath() or "." - if str and str ~= "" then - return cleanpath(joinpath(path,str)) +local function jobpath() + local path = resolvers.stackpath() + if not path or path == "" then + return "." else - return cleanpath(path) + return path end end +resolvers.toppath = toppath +resolvers.jobpath = jobpath + +-- This hook sit into the resolver: + +prefixes.toppath = function(str) return cleanpath(joinpath(toppath(),str)) end -- str can be nil or empty +prefixes.jobpath = function(str) return cleanpath(joinpath(jobpath(),str)) end -- str can be nil or empty + +resolvers.setdynamic("toppath") +resolvers.setdynamic("jobpath") + +-- for a while (obsolete): + +prefixes.jobfile = prefixes.jobpath + resolvers.setdynamic("jobfile") diff --git a/tex/context/base/font-otb.lua b/tex/context/base/font-otb.lua index 2e98d3ecb..a68b57c8a 100644 --- a/tex/context/base/font-otb.lua +++ b/tex/context/base/font-otb.lua @@ -271,7 +271,7 @@ local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplis local lookuptypes = resources.lookuptypes local ligatures = { } - local alternate = tonumber(value) + local alternate = tonumber(value) or true and 1 local defaultalt = otf.defaultbasealternate local trace_singles = trace_baseinit and trace_singles @@ -475,7 +475,7 @@ local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplis local lookuptypes = resources.lookuptypes local ligatures = { } - local alternate = tonumber(value) + local alternate = tonumber(value) or true and 1 local defaultalt = otf.defaultbasealternate local trace_singles = trace_baseinit and trace_singles @@ -493,7 +493,7 @@ local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplis end changed[unicode] = data elseif lookuptype == "alternate" then - local replacement = data[alternate] + local replacement = data[alternate] if replacement then changed[unicode] = replacement if trace_alternatives then @@ -602,7 +602,7 @@ local function featuresinitializer(tfmdata,value) if true then -- value then local starttime = trace_preparing and os.clock() local features = tfmdata.shared.features - local fullname = trace_preparing and tfmdata.properties.fullname + local fullname = tfmdata.properties.fullname or "?" if features then applybasemethod("initializehashes",tfmdata) local collectlookups = otf.collectlookups @@ -648,21 +648,22 @@ local function featuresinitializer(tfmdata,value) if order then for i=1,#order do -- local feature = order[i] - if features[feature] then + local value = features[feature] + if value then local validlookups, lookuplist = collectlookups(rawdata,feature,script,language) if not validlookups then -- skip elseif basesubstitutions and basesubstitutions[feature] then if trace_preparing then - report_prepare("filtering base feature %a for %a",feature,fullname) + report_prepare("filtering base %s feature %a for %a with value %a","sub",feature,fullname,value) end applybasemethod("preparesubstitutions",tfmdata,feature,value,validlookups,lookuplist) registerbasefeature(feature,value) elseif basepositionings and basepositionings[feature] then if trace_preparing then - report_prepare("filtering base feature %a for %a",feature,fullname) + report_prepare("filtering base %a feature %a for %a with value %a","pos",feature,fullname,value) end - applybasemethod("preparepositionings",tfmdata,feature,features[feature],validlookups,lookuplist) + applybasemethod("preparepositionings",tfmdata,feature,value,validlookups,lookuplist) registerbasefeature(feature,value) end end diff --git a/tex/context/base/font-ott.lua b/tex/context/base/font-ott.lua index 1e2309056..348672491 100644 --- a/tex/context/base/font-ott.lua +++ b/tex/context/base/font-ott.lua @@ -858,10 +858,13 @@ function otf.features.normalize(features) if uv then -- report_checks("feature value %a first seen at %a",value,key) else - if type(value) == "string" then + uv = tonumber(value) -- before boolean as there we also handle 0/1 + if uv then + -- we're okay + elseif type(value) == "string" then local b = is_boolean(value) if type(b) == "nil" then - uv = tonumber(value) or lower(value) + uv = lower(value) else uv = b end diff --git a/tex/context/base/font-sel.lua b/tex/context/base/font-sel.lua index 86300c2db..aef528c53 100644 --- a/tex/context/base/font-sel.lua +++ b/tex/context/base/font-sel.lua @@ -526,6 +526,9 @@ local function definefontsynonym(data,alternative,index,fallback) local designsize = entry["designsize"] or 100 if designsize == 100 or designsize == 110 or designsize == 120 or designsize == 0 or #fontdata == 1 then local filepath, filename = splitbase(entry["filename"]) + if entry["format"] == "ttc" or entry["format"] == "dfont" then + filename = formatters["%s(%s)"](filename, entry["rawname"]) + end registerdesignsizes( fontfile, "default", filename ) break end diff --git a/tex/context/base/font-sel.mkvi b/tex/context/base/font-sel.mkvi index 0b9a4bda9..933afa466 100644 --- a/tex/context/base/font-sel.mkvi +++ b/tex/context/base/font-sel.mkvi @@ -1,6 +1,6 @@ %D \module %D [ file=font-sel, -%D version=2014.03.10, +%D version=2014.07.27, %D title=\CONTEXT\ User Module, %D subtitle=Selectfont, %D author=Wolfgang Schuster, @@ -115,18 +115,74 @@ % unknown preset \fi} -%definefontfamilypreset [range:chinese] [\c!range={cjkcompatibilityforms,cjkcompatibilityideographs,cjkcompatibilityideographssupplement,cjkradicalssupplement,cjkstrokes,cjksymbolsandpunctuation,cjkunifiedideographs,cjkunifiedideographsextensiona,cjkunifiedideographsextensionb,halfwidthandfullwidthforms,verticalforms,bopomofo,bopomofoextended}] -%definefontfamilypreset [range:japanese] [\c!range={cjkcompatibilityforms,cjkcompatibilityideographs,cjkcompatibilityideographssupplement,cjkradicalssupplement,cjkstrokes,cjksymbolsandpunctuation,cjkunifiedideographs,cjkunifiedideographsextensiona,cjkunifiedideographsextensionb,halfwidthandfullwidthforms,verticalforms,hiragana,katakana}] -%definefontfamilypreset [range:korean] [\c!range={cjkcompatibilityforms,cjkcompatibilityideographs,cjkcompatibilityideographssupplement,cjkradicalssupplement,cjkstrokes,cjksymbolsandpunctuation,cjkunifiedideographs,cjkunifiedideographsextensiona,cjkunifiedideographsextensionb,halfwidthandfullwidthforms,verticalforms,hangulcompatibilityjamo,hanguljamo,hanguljamoextendeda,hanguljamoextendedb,hangulsyllables}] -%definefontfamilypreset [range:cyrillic] [\c!range={cyrillic,cyrillicextendeda,cyrillicextendedb,cyrillicsupplement}] -%definefontfamilypreset [range:greek] [\c!range={greekandcoptic,greekextended,ancientgreeknumbers}] - -\definefontfamilypreset [range:chinese] [\c!range={0x02E80-0x02EFF,0x03000-0x031EF,0x03300-0x09FFF,0x0F900-0x0FFEF,0x20000-0x2A6DF,0x2F800-0x2FA1F,0x03100-0x0312F,0x031A0-0x031BF}] -\definefontfamilypreset [range:japanese] [\c!range={0x02E80-0x02EFF,0x03000-0x031EF,0x03300-0x09FFF,0x0F900-0x0FFEF,0x20000-0x2A6DF,0x2F800-0x2FA1F,0x03040-0x0309F,0x030A0-0x030FF}] -\definefontfamilypreset [range:korean] [\c!range={0x02E80-0x02EFF,0x03000-0x031EF,0x03300-0x09FFF,0x0F900-0x0FFEF,0x20000-0x2A6DF,0x2F800-0x2FA1F,0x01100-0x011FF,0x03130-0x0318F,0x0A960-0x0D7FF}] -\definefontfamilypreset [range:cyrillic] [\c!range={0x00400-0x0052F,0x02DE0-0x02DFF,0x0A640-0x0A69F}] -\definefontfamilypreset [range:greek] [\c!range={0x00370-0x003FF,0x01F00-0x01FFF,0x10140-0x1018F}] -\definefontfamilypreset [range:hebrew] [\c!range={0x00590-0x005FF,0x0FB00-0x0FB4F}] +\definefontfamilypreset + [range:chinese] + [\c!range={cjkcompatibilityforms, + cjkcompatibilityideographs, + cjkcompatibilityideographssupplement, + cjkradicalssupplement, + cjkstrokes, + cjksymbolsandpunctuation, + cjkunifiedideographs, + cjkunifiedideographsextensiona, + cjkunifiedideographsextensionb, + halfwidthandfullwidthforms, + verticalforms, + bopomofo, + bopomofoextended}] + +\definefontfamilypreset + [range:japanese] + [\crange={cjkcompatibilityforms, + cjkcompatibilityideographs, + cjkcompatibilityideographssupplement, + cjkradicalssupplement, + cjkstrokes, + cjksymbolsandpunctuation, + cjkunifiedideographs, + cjkunifiedideographsextensiona, + cjkunifiedideographsextensionb, + halfwidthandfullwidthforms, + verticalforms, + hiragana, + katakana}] + +\definefontfamilypreset + [range:korean] + [\c!range={cjkcompatibilityforms, + cjkcompatibilityideographs, + cjkcompatibilityideographssupplement, + cjkradicalssupplement, + cjkstrokes, + cjksymbolsandpunctuation, + cjkunifiedideographs, + cjkunifiedideographsextensiona, + cjkunifiedideographsextensionb, + halfwidthandfullwidthforms, + verticalforms, + hangulcompatibilityjamo, + hanguljamo, + hanguljamoextendeda, + hanguljamoextendedb, + hangulsyllables}] + +\definefontfamilypreset + [range:cyrillic] + [\c!range={cyrillic, + cyrillicextendeda, + cyrillicextendedb, + cyrillicsupplement}] + +\definefontfamilypreset + [range:greek] + [\c!range={greekandcoptic, + greekextended, + ancientgreeknumbers}] + +\definefontfamilypreset + [range:hebrew] + [\c!range={hebrew, + alphabeticpresentationforms}] \definefontfamilypreset [math:digitsnormal] [\c!range=digitsnormal] \definefontfamilypreset [math:digitsbold] [\c!range=digitsnormal,\c!offset=digitsbold,\s!tf=style:bold] @@ -226,7 +282,7 @@ %D \stoptyping %D %D When a document contains different languages and the global font lacks some characters -%D for one language, one could set a different font where these characters are taken from. +%D for one language, one could set a different font where these charcters are taken from. %D This fallback font (there can be more than one for a certain style) could be set with %D the \tex{definefallbackfamily} command which takes the same argument as %D the \tex{definefontfamily} command. @@ -332,7 +388,8 @@ \unexpanded\def\selectfont_set_default {\selectfont_set_font_family[\v!serif][Latin Modern Roman][\c!opticalsize=\v!yes]% \selectfont_set_font_family[\v!sans] [Latin Modern Sans] [\c!opticalsize=\v!yes]% - \selectfont_set_font_family[\v!mono] [Latin Modern Mono] [\c!opticalsize=\v!yes,\c!features=\s!none]} + \selectfont_set_font_family[\v!mono] [Latin Modern Mono] [\c!opticalsize=\v!yes,\c!features=\s!none]% + \selectfont_set_font_family[\v!math] [Latin Modern Math] [\c!opticalsize=\v!yes]} \unexpanded\def\setupfallbackfamily {\dotripleempty\selectfont_fallback_setup} @@ -371,4 +428,4 @@ \c!smallcapsfeatures=\s!smallcaps, \c!style=\s!rm] -\protect +\protect \ No newline at end of file diff --git a/tex/context/base/l-file.lua b/tex/context/base/l-file.lua index c05372a05..2742e99b3 100644 --- a/tex/context/base/l-file.lua +++ b/tex/context/base/l-file.lua @@ -385,31 +385,90 @@ local deslasher = lpeg.replacer(S("\\/")^1,"/") -- then we still have to deal with urls ... anyhow, multiple // are never a real -- problem but just ugly. -function file.join(...) - local lst = { ... } - local one = lst[1] +-- function file.join(...) +-- local lst = { ... } +-- local one = lst[1] +-- if lpegmatch(isnetwork,one) then +-- local one = lpegmatch(reslasher,one) +-- local two = lpegmatch(deslasher,concat(lst,"/",2)) +-- if lpegmatch(hasroot,two) then +-- return one .. two +-- else +-- return one .. "/" .. two +-- end +-- elseif lpegmatch(isroot,one) then +-- local two = lpegmatch(deslasher,concat(lst,"/",2)) +-- if lpegmatch(hasroot,two) then +-- return two +-- else +-- return "/" .. two +-- end +-- elseif one == "" then +-- return lpegmatch(stripper,concat(lst,"/",2)) +-- else +-- return lpegmatch(deslasher,concat(lst,"/")) +-- end +-- end + +function file.join(one, two, three, ...) + if not two then + return one == "" and one or lpegmatch(stripper,one) + end + if one == "" then + return lpegmatch(stripper,three and concat({ two, three, ... },"/") or two) + end if lpegmatch(isnetwork,one) then local one = lpegmatch(reslasher,one) - local two = lpegmatch(deslasher,concat(lst,"/",2)) + local two = lpegmatch(deslasher,three and concat({ two, three, ... },"/") or two) if lpegmatch(hasroot,two) then return one .. two else return one .. "/" .. two end elseif lpegmatch(isroot,one) then - local two = lpegmatch(deslasher,concat(lst,"/",2)) + local two = lpegmatch(deslasher,three and concat({ two, three, ... },"/") or two) if lpegmatch(hasroot,two) then return two else return "/" .. two end - elseif one == "" then - return lpegmatch(stripper,concat(lst,"/",2)) else - return lpegmatch(deslasher,concat(lst,"/")) + return lpegmatch(deslasher,concat({ one, two, three, ... },"/")) end end +-- or we can use this: +-- +-- function file.join(...) +-- local n = select("#",...) +-- local one = select(1,...) +-- if n == 1 then +-- return one == "" and one or lpegmatch(stripper,one) +-- end +-- if one == "" then +-- return lpegmatch(stripper,n > 2 and concat({ ... },"/",2) or select(2,...)) +-- end +-- if lpegmatch(isnetwork,one) then +-- local one = lpegmatch(reslasher,one) +-- local two = lpegmatch(deslasher,n > 2 and concat({ ... },"/",2) or select(2,...)) +-- if lpegmatch(hasroot,two) then +-- return one .. two +-- else +-- return one .. "/" .. two +-- end +-- elseif lpegmatch(isroot,one) then +-- local two = lpegmatch(deslasher,n > 2 and concat({ ... },"/",2) or select(2,...)) +-- if lpegmatch(hasroot,two) then +-- return two +-- else +-- return "/" .. two +-- end +-- else +-- return lpegmatch(deslasher,concat({ ... },"/")) +-- end +-- end + +-- print(file.join("c:/whatever")) -- print(file.join("c:/whatever","name")) -- print(file.join("//","/y")) -- print(file.join("/","/y")) diff --git a/tex/context/base/publ-aut.lua b/tex/context/base/publ-aut.lua index 73d50f614..90bb4b3df 100644 --- a/tex/context/base/publ-aut.lua +++ b/tex/context/base/publ-aut.lua @@ -423,7 +423,7 @@ local function newsplitter(splitter) end) end -local function byauthor(dataset,list,method) -- todo: yearsuffix +local function byauthor(dataset,list,method) local luadata = datasets[dataset].luadata local details = datasets[dataset].details local result = { } @@ -441,6 +441,7 @@ local function byauthor(dataset,list,method) -- todo: yearsuffix split = { splitted[strip(writer(detail.author or detail.editor or "",snippets))], splitted[entry.year or "9998"], + splitted[detail.suffix or " "], splitted[strip(entry.journal or "")], splitted[strip(entry.title or "")], splitted[entry.pages or ""], @@ -453,6 +454,7 @@ local function byauthor(dataset,list,method) -- todo: yearsuffix split = { splitted[""], splitted["9999"], + splitted[" "], splitted[""], splitted[""], splitted[""], diff --git a/tex/context/base/publ-imp-apa.mkvi b/tex/context/base/publ-imp-apa.mkvi index 08724a5f9..5aa2c80ca 100644 --- a/tex/context/base/publ-imp-apa.mkvi +++ b/tex/context/base/publ-imp-apa.mkvi @@ -195,7 +195,11 @@ } \btxdoif {year} { \btxlparent + % \btxflush{suffixedyear} \btxflush{year} + \btxdoif {suffix} { + \btxflush{suffix} + } \btxrparent } \btxperiod @@ -213,7 +217,11 @@ } \btxdoif {year} { \btxlparent + % \btxflush{suffixedyear} \btxflush{year} + \btxdoif {suffix} { + \btxflush{suffix} + } \btxrparent } \btxperiod @@ -244,7 +252,11 @@ } \btxdoif {year} { \btxlparent + % \btxflush{suffixedyear} \btxflush{year} + \btxdoif {suffix} { + \btxflush{suffix} + } \btxrparent } \btxperiod @@ -270,7 +282,11 @@ \btxspace \btxdoif {year} { \btxlparent + % \btxflush{suffixedyear} \btxflush{year} + \btxdoif {suffix} { + \btxflush{suffix} + } \btxrparent } \btxperiod diff --git a/tex/context/base/publ-imp-cite.mkvi b/tex/context/base/publ-imp-cite.mkvi index 6ef584699..64a244def 100644 --- a/tex/context/base/publ-imp-cite.mkvi +++ b/tex/context/base/publ-imp-cite.mkvi @@ -63,11 +63,17 @@ \else\ifx\currentbtxsecond\empty \btxcitereference \currentbtxfirst + \ifx\currentbtxthird\empty \else + \currentbtxthird + \fi \else \btxcitereference \currentbtxfirst \btxcitevariantparameter\v!inbetween \currentbtxsecond + \ifx\currentbtxthird\empty \else + \currentbtxthird + \fi \fi\fi \stopsetups @@ -77,11 +83,17 @@ \else\ifx\currentbtxsecond\empty \btxcitereference \currentbtxfirst + \ifx\currentbtxthird\empty \else + \currentbtxthird + \fi \else \btxcitereference \currentbtxfirst \btxcitevariantparameter\c!range \currentbtxsecond + \ifx\currentbtxthird\empty \else + \currentbtxthird + \fi \fi\fi \stopsetups @@ -107,6 +119,9 @@ \btxcitevariantparameter\v!inbetween \currentbtxsecond \fi + \ifx\currentbtxthird\empty \else + \currentbtxthird + \fi } \fi \stopsetups @@ -123,6 +138,9 @@ \btxcitevariantparameter\c!range \currentbtxsecond \fi + \ifx\currentbtxthird\empty \else + \currentbtxthird + \fi } \fi \stopsetups @@ -146,6 +164,9 @@ \btxcitevariantparameter\v!inbetween \currentbtxsecond \fi + \ifx\currentbtxthird\empty \else + \currentbtxthird + \fi \stopsetups % one level will be removed diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua index ed50af9d3..d2600d8a0 100644 --- a/tex/context/base/publ-ini.lua +++ b/tex/context/base/publ-ini.lua @@ -112,6 +112,7 @@ local ctx_btxsetcategory = context.btxsetcategory local ctx_btxcitesetup = context.btxcitesetup local ctx_btxsetfirst = context.btxsetfirst local ctx_btxsetsecond = context.btxsetsecond +local ctx_btxsetthird = context.btxsetthird local ctx_btxsetinternal = context.btxsetinternal local ctx_btxsetbacklink = context.btxsetbacklink local ctx_btxsetbacktrace = context.btxsetbacktrace @@ -582,10 +583,22 @@ local pagessplitter = lpeg.splitat(P("-")^1) -- maybe not redo when already done +local function shortsorter(a,b) + local ay, by = a[2], b[2] + if ay == by then + return a[3] < b[3] + else + return ay < by + end +end + function publications.enhance(dataset) -- for the moment split runs (maybe publications.enhancers) statistics.starttiming(publications) + local used = usedentries[dataset] if type(dataset) == "string" then dataset = datasets[dataset] + else + -- message end local luadata = dataset.luadata local details = dataset.details @@ -628,12 +641,11 @@ function publications.enhance(dataset) -- for the moment split runs (maybe publi local year = tonumber(entry.year) or 0 local short = formatters["%t%02i"](t,mod(year,100)) local s = shorts[short] + -- we could also sort on reference i.e. entries.text if not s then - shorts[short] = tag - elseif type(s) == "string" then - shorts[short] = { s, tag } + shorts[short] = { { tag, year, i } } else - s[#s+1] = tag + s[#s+1] = { tag, year, i } end else -- @@ -660,16 +672,47 @@ function publications.enhance(dataset) -- for the moment split runs (maybe publi end end for short, tags in next, shorts do -- ordered ? - if type(tags) == "table" then - sort(tags) + if #tags > 1 then + sort(tags,shortsorter) + local n = 0 for i=1,#tags do - -- details[tags[i]].short = short .. numbertochar(i) - local detail = details[tags[i]] - detail.short = short - detail.suffix = numbertochar(i) + local tag = tags[i][1] + local detail = details[tag] + detail.short = short + if used[tag] then + n = n + 1 + local suffix = numbertochar(n) + detail.suffix = suffix + local entry = luadata[tag] + local year = entry.year + if year then + detail.suffixedyear = year .. suffix + end + end + end + for i=1,#tags do + local tag = tags[i][1] + local detail = details[tag] + if not detail.suffix then + n = n + 1 + local suffix = numbertochar(n) + detail.suffix = suffix + local entry = luadata[tag] + local year = entry.year + if year then + detail.suffixedyear = year .. suffix + end + end end else - details[tags].short = short + local tag = tags[i][1] + local detail = details[tag] + detail.short = short + local entry = luadata[tag] + local year = entry.year + if year then + detail.suffixedyear = year + end end end statistics.stoptiming(publications) @@ -717,13 +760,13 @@ function commands.btxflush(name,tag,field) local manipulator, field = splitmanipulation(field) local value = fields[field] if type(value) == "string" then - local suffixes = dataset.suffixes[tag] - if suffixes then - local suffix = suffixes[field] - if suffix then - value = value .. converters.characters(suffix) - end - end +-- local suffixes = dataset.suffixes[tag] +-- if suffixes then +-- local suffix = suffixes[field] +-- if suffix then +-- value = value .. converters.characters(suffix) +-- end +-- end context(manipulator and applymanipulation(manipulator,value) or value) return end @@ -731,13 +774,13 @@ function commands.btxflush(name,tag,field) if details then local value = details[field] if type(value) == "string" then - local suffixes = dataset.suffixes[tag] - if suffixes then - local suffix = suffixes[field] - if suffix then - value = value .. converters.characters(suffix) - end - end +-- local suffixes = dataset.suffixes[tag] +-- if suffixes then +-- local suffix = suffixes[field] +-- if suffix then +-- value = value .. converters.characters(suffix) +-- end +-- end context(manipulator and applymanipulation(manipulator,value) or value) return end @@ -759,13 +802,13 @@ function commands.btxdetail(name,tag,field) local manipulator, field = splitmanipulation(field) local value = details[field] if type(value) == "string" then - local suffixes = dataset.suffixes[tag] - if suffixes then - local suffix = suffixes[field] - if suffix then - value = value .. converters.characters(suffix) - end - end +-- local suffixes = dataset.suffixes[tag] +-- if suffixes then +-- local suffix = suffixes[field] +-- if suffix then +-- value = value .. converters.characters(suffix) +-- end +-- end context(manipulator and applymanipulation(manipulator,value) or value) else report("unknown detail %a of tag %a in dataset %a",field,tag,name) @@ -786,13 +829,13 @@ function commands.btxfield(name,tag,field) local manipulator, field = splitmanipulation(field) local value = fields[field] if type(value) == "string" then - local suffixes = dataset.suffixes[tag] - if suffixes then - local suffix = suffixes[field] - if suffix then - value = value .. converters.characters(suffix) - end - end +-- local suffixes = dataset.suffixes[tag] +-- if suffixes then +-- local suffix = suffixes[field] +-- if suffix then +-- value = value .. converters.characters(suffix) +-- end +-- end context(manipulator and applymanipulation(manipulator,value) or value) else report("unknown field %a of tag %a in dataset %a",field,tag,name) @@ -807,43 +850,54 @@ end -- testing: to be speed up with testcase -function commands.btxdoifelse(name,tag,field) +local function found(name,tag,field,yes) local dataset = rawget(datasets,name) if dataset then local data = dataset.luadata[tag] - local value = data and data[field] - if value and value ~= "" then - ctx_firstoftwoarguments() - return + if data then + local value = data[field] + if value then + if value ~= "" then + return true + end + else + local data = dataset.details[tag] + if data then + local value = data[field] + if value then + if value ~= "" then + return true + end + end + end + end end end - ctx_secondoftwoarguments() + return false +end + +function commands.btxdoifelse(name,tag,field) + if found(name,tag,field) then + ctx_firstoftwoarguments() + else + ctx_secondoftwoarguments() + end end function commands.btxdoif(name,tag,field) - local dataset = rawget(datasets,name) - if dataset then - local data = dataset.luadata[tag] - local value = data and data[field] - if value and value ~= "" then - ctx_firstofoneargument() - return - end + if found(name,tag,field) then + ctx_firstofoneargument() + else + ctx_gobbleoneargument() end - ctx_gobbleoneargument() end function commands.btxdoifnot(name,tag,field) - local dataset = rawget(datasets,name) - if dataset then - local data = dataset.luadata[tag] - local value = data and data[field] - if value and value ~= "" then - ctx_gobbleoneargument() - return - end + if found(name,tag,field) then + ctx_gobbleoneargument() + else + ctx_firstofoneargument() end - ctx_firstofoneargument() end -- -- alternative approach: keep data at the tex end @@ -1451,40 +1505,40 @@ local function compresslist(source) sort(source,keysorter) -- suffixes local oldvalue = nil - local suffix = 0 - local function setsuffix(entry,suffix,sortfld) - entry.suffix = suffix - local dataset = datasets[entry.dataset] - if dataset then - local suffixes = dataset.suffixes[entry.tag] - if suffixes then - suffixes[sortfld] = suffix - else - dataset.suffixes[entry.tag] = { [sortfld] = suffix } - end - end - end - for i=1,#source do - local entry = source[i] - local sortfld = entry.sortfld - if sortfld then - local value = entry.sortkey - if value == oldvalue then - if suffix == 0 then - suffix = 1 - local entry = source[i-1] - setsuffix(entry,suffix,sortfld) - end - suffix = suffix + 1 - setsuffix(entry,suffix,sortfld) - else - oldvalue = value - suffix = 0 - end - else - break - end - end +-- local suffix = 0 +-- local function setsuffix(entry,suffix,sortfld) +-- entry.suffix = suffix +-- local dataset = datasets[entry.dataset] +-- if dataset then +-- local suffixes = dataset.suffixes[entry.tag] +-- if suffixes then +-- suffixes[sortfld] = suffix +-- else +-- dataset.suffixes[entry.tag] = { [sortfld] = suffix } +-- end +-- end +-- end +-- for i=1,#source do +-- local entry = source[i] +-- local sortfld = entry.sortfld +-- if sortfld then +-- local value = entry.sortkey +-- if value == oldvalue then +-- if suffix == 0 then +-- suffix = 1 +-- local entry = source[i-1] +-- setsuffix(entry,suffix,sortfld) +-- end +-- suffix = suffix + 1 +-- setsuffix(entry,suffix,sortfld) +-- else +-- oldvalue = value +-- suffix = 0 +-- end +-- else +-- break +-- end +-- end -- local function flushrange() noftarget = noftarget + 1 @@ -1659,6 +1713,8 @@ local getters = setmetatableindex({},function(t,k) return v end) +-- todo: just a sort key and then fetch normal by fieldname + -- default setmetatableindex(citevariants,function(t,k) @@ -1677,8 +1733,8 @@ local function setter(dataset,tag,entry,internal) return { tag = tag, internal = internal, - short = getfield(dataset,tag,"short"), - suffix = getfield(dataset,tag,"suffix"), + short = getdetail(dataset,tag,"short"), + suffix = getdetail(dataset,tag,"suffix"), } end @@ -1751,15 +1807,26 @@ end -- year +-- local function setter(dataset,tag,entry,internal) +-- local year = getfield(dataset,tag,"year") +-- return { +-- dataset = dataset, +-- tag = tag, +-- internal = internal, +-- year = year, +-- sortkey = year, +-- sortfld = "year", +-- } +-- end + local function setter(dataset,tag,entry,internal) - local year = getfield(dataset,tag,"year") return { dataset = dataset, tag = tag, internal = internal, - year = year, - sortkey = year, - sortfld = "year", + year = getfield(dataset,tag,"year"), + suffix = getdetail(dataset,tag,"suffix"), + sortkey = getdetail(dataset,tag,"suffixedyear"), } end @@ -1906,21 +1973,30 @@ local function authorconcat(target,key,setup) ctx_btxsetinternal(bl and bl.references.internal or "") if first then ctx_btxsetfirst(first[key] or f_missing(first.tag)) +-- third ? of gewoon getfield? local suffix = entry.suffix local value = entry.last[key] - if suffix then - ctx_btxsetsecond(value .. converters.characters(suffix)) - else - ctx_btxsetsecond(value) - end +-- if suffix then +-- ctx_btxsetsecond(value .. converters.characters(suffix)) +-- else +-- ctx_btxsetsecond(value) +-- end +ctx_btxsetsecond(value) +if suffix then + ctx_btxsetthird(suffix) +end else local suffix = entry.suffix local value = entry[key] or f_missing(tag) - if suffix then - ctx_btxsetfirst(value .. converters.characters(suffix)) - else - ctx_btxsetfirst(value) - end +-- if suffix then +-- ctx_btxsetfirst(value .. converters.characters(suffix)) +-- else +-- ctx_btxsetfirst(value) +-- end +ctx_btxsetfirst(value) +if suffix then + ctx_btxsetthird(suffix) +end end ctx_btxsetconcat(concatstate(i,nofcollected)) ctx_btxcitesetup(setup) @@ -1940,6 +2016,7 @@ local function authorsingle(entry,key,setup) -- local bl = listtocite[currentcitation] -- ctx_btxsetinternal(bl and bl.references.internal or "") ctx_btxsetfirst(entry[key] or f_missing(tag)) + ctx_btxsetthird(entry.suffix) ctx_btxcitesetup(setup) ctx_btxstopciteauthor() ctx_btxstopsubcite() @@ -2019,16 +2096,28 @@ end -- authoryear | authoryears +-- local function setter(dataset,tag,entry,internal) +-- local year = getfield(dataset,tag,"year") +-- return { +-- dataset = dataset, +-- tag = tag, +-- internal = internal, +-- author = getfield(dataset,tag,"author"), +-- year = year, +-- sortkey = year and lpegmatch(numberonly,year), +-- sortfld = "year", +-- } +-- end + local function setter(dataset,tag,entry,internal) - local year = getfield(dataset,tag,"year") return { dataset = dataset, tag = tag, internal = internal, author = getfield(dataset,tag,"author"), - year = year, - sortkey = year and lpegmatch(numberonly,year), - sortfld = "year", + year = getfield(dataset,tag,"year"), + suffix = getdetail(dataset,tag,"suffix"), + sortkey = getdetail(dataset,tag,"suffixedyear"), } end @@ -2086,7 +2175,7 @@ function listvariants.short(dataset,block,tag,variant,listindex) ctx_btxsetfirst(short) end if suffix then - ctx_btxsetsecond(suffix) + ctx_btxsetthird(suffix) end ctx_btxlistsetup(variant) end diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv index 5d64af19c..0ef8f39cc 100644 --- a/tex/context/base/publ-ini.mkiv +++ b/tex/context/base/publ-ini.mkiv @@ -353,9 +353,10 @@ \let\currentbtxcombis \empty \unexpanded\def\btxsetcombis {\def\currentbtxcombis} \let\currentbtxdataset \empty \unexpanded\def\btxsetdataset {\def\currentbtxdataset} \let\currentbtxfirst \empty \unexpanded\def\btxsetfirst {\def\currentbtxfirst} +\let\currentbtxsecond \empty \unexpanded\def\btxsetsecond {\def\currentbtxsecond} +\let\currentbtxthird \empty \unexpanded\def\btxsetthird {\def\currentbtxthird} \let\currentbtxinternal \empty \unexpanded\def\btxsetinternal {\def\currentbtxinternal} \let\currentbtxlanguage \empty \unexpanded\def\btxsetlanguage {\def\currentbtxlanguage} -\let\currentbtxsecond \empty \unexpanded\def\btxsetsecond {\def\currentbtxsecond} \let\currentbtxtag \empty \unexpanded\def\btxsettag {\def\currentbtxtag} \let\currentbtxnumber \empty \unexpanded\def\btxsetnumber {\def\currentbtxnumber} \let\currentbtxauthorvariant\v!normal \unexpanded\def\btxsetauthorvariant{\def\currentbtxauthorvariant} diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index cf1c7dfe1..a9107b947 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index b96ea1dba..39eb99248 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 881e8d951..660524e6f 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/26/14 14:38:45 +-- merge date : 07/29/14 00:30:11 do -- begin closure to overcome local limits and interference @@ -2377,28 +2377,30 @@ local isroot=fwslash^1*-1 local hasroot=fwslash^1 local reslasher=lpeg.replacer(S("\\/"),"/") local deslasher=lpeg.replacer(S("\\/")^1,"/") -function file.join(...) - local lst={... } - local one=lst[1] +function file.join(one,two,three,...) + if not two then + return one=="" and one or lpegmatch(stripper,one) + end + if one=="" then + return lpegmatch(stripper,three and concat({ two,three,... },"/") or two) + end if lpegmatch(isnetwork,one) then local one=lpegmatch(reslasher,one) - local two=lpegmatch(deslasher,concat(lst,"/",2)) + local two=lpegmatch(deslasher,three and concat({ two,three,... },"/") or two) if lpegmatch(hasroot,two) then return one..two else return one.."/"..two end elseif lpegmatch(isroot,one) then - local two=lpegmatch(deslasher,concat(lst,"/",2)) + local two=lpegmatch(deslasher,three and concat({ two,three,... },"/") or two) if lpegmatch(hasroot,two) then return two else return "/"..two end - elseif one=="" then - return lpegmatch(stripper,concat(lst,"/",2)) else - return lpegmatch(deslasher,concat(lst,"/")) + return lpegmatch(deslasher,concat({ one,two,three,... },"/")) end end local drivespec=R("az","AZ")^1*colon @@ -8854,7 +8856,7 @@ local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplis local lookuphash=resources.lookuphash local lookuptypes=resources.lookuptypes local ligatures={} - local alternate=tonumber(value) + local alternate=tonumber(value) or true and 1 local defaultalt=otf.defaultbasealternate local trace_singles=trace_baseinit and trace_singles local trace_alternatives=trace_baseinit and trace_alternatives @@ -9045,7 +9047,7 @@ local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplis local lookuphash=resources.lookuphash local lookuptypes=resources.lookuptypes local ligatures={} - local alternate=tonumber(value) + local alternate=tonumber(value) or true and 1 local defaultalt=otf.defaultbasealternate local trace_singles=trace_baseinit and trace_singles local trace_alternatives=trace_baseinit and trace_alternatives @@ -9061,7 +9063,7 @@ local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplis end changed[unicode]=data elseif lookuptype=="alternate" then - local replacement=data[alternate] + local replacement=data[alternate] if replacement then changed[unicode]=replacement if trace_alternatives then @@ -9154,7 +9156,7 @@ local function featuresinitializer(tfmdata,value) if true then local starttime=trace_preparing and os.clock() local features=tfmdata.shared.features - local fullname=trace_preparing and tfmdata.properties.fullname + local fullname=tfmdata.properties.fullname or "?" if features then applybasemethod("initializehashes",tfmdata) local collectlookups=otf.collectlookups @@ -9174,20 +9176,21 @@ local function featuresinitializer(tfmdata,value) if order then for i=1,#order do local feature=order[i] - if features[feature] then + local value=features[feature] + if value then local validlookups,lookuplist=collectlookups(rawdata,feature,script,language) if not validlookups then elseif basesubstitutions and basesubstitutions[feature] then if trace_preparing then - report_prepare("filtering base feature %a for %a",feature,fullname) + report_prepare("filtering base %s feature %a for %a with value %a","sub",feature,fullname,value) end applybasemethod("preparesubstitutions",tfmdata,feature,value,validlookups,lookuplist) registerbasefeature(feature,value) elseif basepositionings and basepositionings[feature] then if trace_preparing then - report_prepare("filtering base feature %a for %a",feature,fullname) + report_prepare("filtering base %a feature %a for %a with value %a","pos",feature,fullname,value) end - applybasemethod("preparepositionings",tfmdata,feature,features[feature],validlookups,lookuplist) + applybasemethod("preparepositionings",tfmdata,feature,value,validlookups,lookuplist) registerbasefeature(feature,value) end end -- cgit v1.2.3