From 2a50db46043ea7113c18e87887c371552efd1af9 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Tue, 5 Jun 2012 21:45:00 +0200 Subject: beta 2012.06.05 21:45 --- scripts/context/lua/mtx-context.lua | 8 +-- scripts/context/lua/mtxrun.lua | 13 ++++- scripts/context/stubs/mswin/mtxrun.lua | 13 ++++- scripts/context/stubs/unix/mtxrun | 13 ++++- tex/context/base/buff-ini.lua | 6 +- tex/context/base/cldf-ini.lua | 6 +- tex/context/base/cont-new.mkii | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4142 -> 4140 bytes tex/context/base/context-version.png | Bin 105663 -> 105875 bytes tex/context/base/context.mkii | 2 +- tex/context/base/context.mkiv | 2 +- tex/context/base/data-tex.lua | 7 +++ tex/context/base/data-vir.lua | 8 ++- tex/context/base/file-job.lua | 27 ++++----- tex/context/base/grph-fig.mkiv | 65 +++++++++------------ tex/context/base/l-string.lua | 5 ++ tex/context/base/l-url.lua | 8 ++- tex/context/base/page-mis.lua | 3 +- tex/context/base/s-map-10.mkiv | 8 +-- tex/context/base/status-files.pdf | Bin 24371 -> 24400 bytes tex/context/base/status-lua.pdf | Bin 181182 -> 181183 bytes tex/context/base/strc-blk.lua | 7 +-- tex/context/base/trac-deb.lua | 13 ++++- tex/generic/context/luatex/luatex-fonts-merged.lua | 7 ++- 25 files changed, 133 insertions(+), 92 deletions(-) diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua index fdca3c89a..be492f5b9 100644 --- a/scripts/context/lua/mtx-context.lua +++ b/scripts/context/lua/mtx-context.lua @@ -10,7 +10,7 @@ if not modules then modules = { } end modules ['mtx-context'] = { -- todo: pass jobticket/ctxdata table around local format, gmatch, match, gsub, find = string.format, string.gmatch, string.match, string.gsub, string.find -local quote = string.quote +local quote, validstring = string.quote, string.valid local concat = table.concat local settings_to_array = utilities.parsers.settings_to_array local appendtable = table.append @@ -464,10 +464,6 @@ end -- -local function validstring(s) - return type(s) == "string" and s ~= "" and s or nil -end - function scripts.context.run(ctxdata,filename) -- local a_nofile = getargument("nofile") @@ -616,7 +612,7 @@ function scripts.context.run(ctxdata,filename) ["synctex"] = a_synctex and 1 or nil, ["no-parse-first-line"] = true, -- ["no-mktex"] = true, - -- ["file-line-error"] = true, + -- ["file-line-error-style"] = true, ["fmt"] = formatfile, ["lua"] = scriptfile, ["jobname"] = jobname, diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index cc29845b5..8bd243b54 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -150,6 +150,11 @@ function string.topattern(str,lowercase,strict) end end + +function string.valid(str,default) + return (type(str) == "string" and str ~= "" and str) or default or nil +end + -- obsolete names: string.quote = string.quoted @@ -3266,8 +3271,12 @@ end local isscheme = schemestr * colon * slash * slash -- this test also assumes authority local function hasscheme(str) - local scheme = lpegmatch(isscheme,str) -- at least one character - return scheme ~= "" and scheme or false + if str then + local scheme = lpegmatch(isscheme,str) -- at least one character + return scheme ~= "" and scheme or false + else + return false + end end diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index cc29845b5..8bd243b54 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -150,6 +150,11 @@ function string.topattern(str,lowercase,strict) end end + +function string.valid(str,default) + return (type(str) == "string" and str ~= "" and str) or default or nil +end + -- obsolete names: string.quote = string.quoted @@ -3266,8 +3271,12 @@ end local isscheme = schemestr * colon * slash * slash -- this test also assumes authority local function hasscheme(str) - local scheme = lpegmatch(isscheme,str) -- at least one character - return scheme ~= "" and scheme or false + if str then + local scheme = lpegmatch(isscheme,str) -- at least one character + return scheme ~= "" and scheme or false + else + return false + end end diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index cc29845b5..8bd243b54 100755 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -150,6 +150,11 @@ function string.topattern(str,lowercase,strict) end end + +function string.valid(str,default) + return (type(str) == "string" and str ~= "" and str) or default or nil +end + -- obsolete names: string.quote = string.quoted @@ -3266,8 +3271,12 @@ end local isscheme = schemestr * colon * slash * slash -- this test also assumes authority local function hasscheme(str) - local scheme = lpegmatch(isscheme,str) -- at least one character - return scheme ~= "" and scheme or false + if str then + local scheme = lpegmatch(isscheme,str) -- at least one character + return scheme ~= "" and scheme or false + else + return false + end end diff --git a/tex/context/base/buff-ini.lua b/tex/context/base/buff-ini.lua index 7098679ca..ab386a950 100644 --- a/tex/context/base/buff-ini.lua +++ b/tex/context/base/buff-ini.lua @@ -16,7 +16,7 @@ local report_grabbing = logs.reporter("buffers","grabbing") local concat = table.concat local type, next = type, next local sub, format, match, find = string.sub, string.format, string.match, string.find -local count, splitlines = string.count, string.splitlines +local count, splitlines, validstring = string.count, string.splitlines, string.valid local variables = interfaces.variables local settings_to_array = utilities.parsers.settings_to_array @@ -232,12 +232,12 @@ end function commands.getbuffer(name) local str = getcontent(name) if str ~= "" then - context.viafile(str) + context.viafile(str,format("buffer.%s",validstring(name,"noname"))) end end function commands.getbuffermkvi(name) -- rather direct ! - context.viafile(resolvers.macros.preprocessed(getcontent(name))) + context.viafile(resolvers.macros.preprocessed(getcontent(name)),format("buffer.%s.mkiv",validstring(name,"noname"))) end function commands.gettexbuffer(name) diff --git a/tex/context/base/cldf-ini.lua b/tex/context/base/cldf-ini.lua index c35ca4b4a..4d693ab91 100644 --- a/tex/context/base/cldf-ini.lua +++ b/tex/context/base/cldf-ini.lua @@ -25,7 +25,7 @@ local tex = tex context = context or { } local context = context -local format, find, gmatch, gsub = string.format, string.find, string.gmatch, string.gsub +local format, find, gmatch, gsub, validstring = string.format, string.find, string.gmatch, string.gsub, string.valid local next, type, tostring, tonumber, setmetatable = next, type, tostring, tonumber, setmetatable local insert, remove, concat = table.insert, table.remove, table.concat local lpegmatch, lpegC, lpegS, lpegP, lpegCc = lpeg.match, lpeg.C, lpeg.S, lpeg.P, lpeg.Cc @@ -344,9 +344,9 @@ end local methodhandler = resolvers.methodhandler -function context.viafile(data) +function context.viafile(data,tag) if data and data ~= "" then - local filename = resolvers.savers.byscheme("virtual","viafile",data) + local filename = resolvers.savers.byscheme("virtual",validstring(tag,"viafile"),data) -- context.startregime { "utf" } context.input(filename) -- context.stopregime() diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 396bd5d57..d32abd77b 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2012.06.05 17:36} +\newcontextversion{2012.06.05 21:45} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index fb9ded80e..6fb6e57f0 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{2012.06.05 17:36} +\newcontextversion{2012.06.05 21:45} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index 125e89677..4c102355b 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-version.png b/tex/context/base/context-version.png index 0ce53dc16..3bf4eaab6 100644 Binary files a/tex/context/base/context-version.png and b/tex/context/base/context-version.png differ diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index ac5b0c0ba..885983754 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2012.06.05 17:36} +\edef\contextversion{2012.06.05 21:45} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 222722c92..f717384e8 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -23,7 +23,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2012.06.05 17:36} +\edef\contextversion{2012.06.05 21:45} %D For those who want to use this: diff --git a/tex/context/base/data-tex.lua b/tex/context/base/data-tex.lua index 6cb361699..2105f29f4 100644 --- a/tex/context/base/data-tex.lua +++ b/tex/context/base/data-tex.lua @@ -7,6 +7,7 @@ if not modules then modules = { } end modules ['data-tex'] = { } local char = string.char +local insert, remove = table.insert, table.remove local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) @@ -51,6 +52,10 @@ appendgroup(textlineactions,"after" ) -- user local ctrl_d = char( 4) -- unix local ctrl_z = char(26) -- windows +resolvers.inputstack = resolvers.inputstack or { } + +local inputstack = resolvers.inputstack + function helpers.textopener(tag,filename,filehandle,coding) local lines local t_filehandle = type(filehandle) @@ -92,6 +97,7 @@ function helpers.textopener(tag,filename,filehandle,coding) lines[noflines] = nil end logs.show_open(filename) + insert(inputstack,filename) return { filename = filename, noflines = noflines, @@ -101,6 +107,7 @@ function helpers.textopener(tag,filename,filehandle,coding) report_tex("%s closer, '%s' closed",tag,filename) end logs.show_close(filename) + remove(inputstack) t = nil end, reader = function(self) diff --git a/tex/context/base/data-vir.lua b/tex/context/base/data-vir.lua index 89359c19a..dff780fc7 100644 --- a/tex/context/base/data-vir.lua +++ b/tex/context/base/data-vir.lua @@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['data-vir'] = { license = "see context related readme files" } -local format = string.format +local format, validstrings = string.format, string.valid local trace_virtual = false local report_virtual = logs.reporter("resolvers","virtual") @@ -18,7 +18,9 @@ local resolvers = resolvers local finders, openers, loaders, savers = resolvers.finders, resolvers.openers, resolvers.loaders, resolvers.savers -local data, n, template = { }, 0, "virtual://%s.%s" -- hm, number can be query +local data = { } +local n = 0 -- hm, number can be query +local template = "virtual://%s.%s" function savers.virtual(specification,content) n = n + 1 -- one number for all namespaces @@ -54,7 +56,7 @@ function openers.virtual(specification) if trace_virtual then report_virtual("opener, file '%s' opened",original) end - data[original] = nil + data[original] = nil -- when we comment this we can have error messages -- With utf-8 we signal that no regime is to be applied! return openers.helpers.textopener("virtual",original,d,"utf-8") else diff --git a/tex/context/base/file-job.lua b/tex/context/base/file-job.lua index f210f444d..dc51138f3 100644 --- a/tex/context/base/file-job.lua +++ b/tex/context/base/file-job.lua @@ -11,25 +11,24 @@ if not modules then modules = { } end modules ['file-job'] = { local format, gsub, match, find = string.format, string.gsub, string.match, string.find local insert, remove, concat = table.insert, table.remove, table.concat +local validstring = string.valid local commands, resolvers, context = commands, resolvers, context -local settings_to_array = utilities.parsers.settings_to_array -local write_nl = texio.write_nl - local trace_jobfiles = false trackers.register("system.jobfiles", function(v) trace_jobfiles = v end) local report_jobfiles = logs.reporter("system","jobfiles") -local texsetcount = tex.setcount -local elements = interfaces.elements -local constants = interfaces.constants -local variables = interfaces.variables -local logsnewline = logs.newline -local logspushtarget = logs.pushtarget -local logspoptarget = logs.poptarget - -local allocate = utilities.storage.allocate +local texsetcount = tex.setcount +local elements = interfaces.elements +local constants = interfaces.constants +local variables = interfaces.variables +local logsnewline = logs.newline +local logspushtarget = logs.pushtarget +local logspoptarget = logs.poptarget +local settings_to_array = utilities.parsers.settings_to_array +local write_nl = texio.write_nl +local allocate = utilities.storage.allocate local v_outer = variables.outer local v_text = variables.text @@ -744,10 +743,6 @@ function document.getfilename(i) -- commands context(document.files[i] or "") end -local function validstring(s) - return type(s) == "string" and s ~= "" and s or nil -end - function commands.getcommandline() -- has to happen at the tex end in order to expand -- the document[arguments|files] tables are copies diff --git a/tex/context/base/grph-fig.mkiv b/tex/context/base/grph-fig.mkiv index 2e661bdb1..72fb91d4b 100644 --- a/tex/context/base/grph-fig.mkiv +++ b/tex/context/base/grph-fig.mkiv @@ -17,6 +17,9 @@ \unprotect +\installcorenamespace{externalfigureinstance} +\installcorenamespace{externalfigurecollection} + \newtoks\everysetupexternalfigures % todo: command handler \unexpanded\def\setupexternalfigures @@ -43,14 +46,12 @@ \setfalse\externalfigurelevel \settrue \externalfigureflush -\installcorenamespace{externalfigures} - \def\doplaceexternalfigure[#1][#2][#3][#4][#5]% {\doifsomething{#2}% catches \defineexternalfigure dummies - {\ifcsname\??externalfigures#2\endcsname + {\ifcsname\??externalfigureinstance#2\endcsname \doifelse{#1}{#2} {\dodoplaceexternalfigure[#1][#2][#3][#4][#5]} - {\getvalue{\??externalfigures#2}[#5]}% + {\getvalue{\??externalfigureinstance#2}[#5]}% \else \dodoplaceexternalfigure[#1][#2][#3][#4][#5]% \fi}} @@ -108,7 +109,7 @@ {\dodoubleargument\dodefineexternalfigure} \def\dodefineexternalfigure[#1][#2]% - {\setvalue{\??externalfigures#1}{\doplaceexternalfigure[#1][][][#2]}} + {\setvalue{\??externalfigureinstance#1}{\doplaceexternalfigure[#1][][][#2]}} % \useexternalfigure[alpha][koe] % \useexternalfigure[beta] [koe] [breedte=1cm] @@ -132,10 +133,7 @@ % \useexternalfigure[x][cow][width=10cm,height=1cm] % \externalfigure[x] % \externalfigure[x][width=3cm] - -\def\useexternalfigure - {\doquadrupleempty\douseexternalfigure} - +% % [label] [filename] % [label] [filename] [parent] % [label] [filename] [parent] [settings] @@ -159,7 +157,7 @@ {\dodouseexternalfigure{#1}{#2}{#3}{#4}}}}} \def\dodouseexternalfigure#1#2#3#4% - {\setvalue{\??externalfigures#1}{\doplaceexternalfigure[#1][#2][#3][#4]}% + {\setvalue{\??externalfigureinstance#1}{\doplaceexternalfigure[#1][#2][#3][#4]}% \doanalyzeexternalfigurecollection[#2][#4]} \newconditional\inexternalfigurecollection @@ -191,14 +189,20 @@ \xexternalfigurecollectionmaxheight\zeropoint} \unexpanded\def\stopexternalfigurecollection - {\setxvalue{\??ef:c:\currentexternalfigurecollection:\c!minwidth }{\the\xexternalfigurecollectionminwidth }% - \setxvalue{\??ef:c:\currentexternalfigurecollection:\c!maxwidth }{\the\xexternalfigurecollectionmaxwidth }% - \setxvalue{\??ef:c:\currentexternalfigurecollection:\c!minheight}{\the\xexternalfigurecollectionminheight}% - \setxvalue{\??ef:c:\currentexternalfigurecollection:\c!maxheight}{\the\xexternalfigurecollectionmaxheight}% + {\setxvalue{\??externalfigurecollection\currentexternalfigurecollection:\c!minwidth }{\the\xexternalfigurecollectionminwidth }% + \setxvalue{\??externalfigurecollection\currentexternalfigurecollection:\c!maxwidth }{\the\xexternalfigurecollectionmaxwidth }% + \setxvalue{\??externalfigurecollection\currentexternalfigurecollection:\c!minheight}{\the\xexternalfigurecollectionminheight}% + \setxvalue{\??externalfigurecollection\currentexternalfigurecollection:\c!maxheight}{\the\xexternalfigurecollectionmaxheight}% \endgroup} \def\externalfigurecollectionparameter#1#2% - {\csname\ifcsname\??ef:c:#1:#2\endcsname\??ef:c:#1:#2\else\s!empty\fi\endcsname} + {\csname + \ifcsname\??externalfigurecollection#1:#2\endcsname + \??externalfigurecollection#1:#2% + \else + \s!empty + \fi + \endcsname} \def\externalfigurecollectionminwidth #1{\externalfigurecollectionparameter{#1}\c!minwidth } \def\externalfigurecollectionmaxwidth #1{\externalfigurecollectionparameter{#1}\c!maxwidth } @@ -227,10 +231,10 @@ \def\dosetefparameters#1#2#3% parent_id use_settings current_settings {\doifelsenothing{#1} % inherit from parent {\getparameters[\??ef][#2,#3]} - {\ifcsname\??externalfigures#1\endcsname + {\ifcsname\??externalfigureinstance#1\endcsname \pushmacro\doplaceexternalfigure \def\doplaceexternalfigure[##1][##2][##3][##4]{\getparameters[\??ef][##4,#2,#3]}% - \getvalue{\??externalfigures#1}% + \getvalue{\??externalfigureinstance#1}% \popmacro\doplaceexternalfigure \else \getparameters[\??ef][#2,#3]% @@ -239,30 +243,15 @@ \unexpanded\def\externalfigure {\dotripleempty\doexternalfigure} -% \def\doexternalfigure[#1][#2][#3]% [label][file][settings] | [file][settings] | [file][parent][settings] -% {\bgroup -% \doifelsenothing{#1} -% {\framed[\c!width=\defaultfigurewidth,\c!height=\defaultfigureheight]{external\\figure\\no name}} -% {\ifcsname\??externalfigures#1\endcsname -% \doifassignmentelse{#2} -% {\getvalue{\??externalfigures#1}[#2]}% -% {\getvalue{\??externalfigures#1}[#3]}% -% \else -% \useexternalfigure[\s!dummy][#1][#2][#3]% -% \getvalue{\??externalfigures\s!dummy}[]% [] is dummy arg 5 -% \fi}% -% \globallet\currentresourcecomment\empty -% \egroup} - \def\doexternalfigure[#1][#2][#3]% [label][file][settings] | [file][settings] | [file][parent][settings] {\bgroup % also catched #1 == empty ... scales nicer now - \ifcsname\??externalfigures#1\endcsname + \ifcsname\??externalfigureinstance#1\endcsname \doifassignmentelse{#2} - {\getvalue{\??externalfigures#1}[#2]}% - {\getvalue{\??externalfigures#1}[#3]}% + {\getvalue{\??externalfigureinstance#1}[#2]}% + {\getvalue{\??externalfigureinstance#1}[#3]}% \else \useexternalfigure[\s!dummy][#1][#2][#3]% - \getvalue{\??externalfigures\s!dummy}[]% [] is dummy arg 5 + \getvalue{\??externalfigureinstance\s!dummy}[]% [] is dummy arg 5 \fi \globallet\currentresourcecomment\empty \egroup} @@ -337,7 +326,7 @@ {\teststartfigure[#1][#2][#3]#4\teststopfigure \let\@@exframes\v!on} {\let\@@exframes\v!off}% - \setvalue{\??externalfigures#1}% + \setvalue{\??externalfigureinstance#1}% {\dosingleempty{\placestartfigure[#1][#2][#3]#4\placestopfigure}}% }% no longer \doifundefined{#1}{\setvalue{#1}{\getexternalfigure{#1}}}} @@ -406,7 +395,7 @@ {\teststartfigure[#1][#2][#3]#4\teststopfigure \let\@@exframe\v!on} {\let\@@exframe\v!off}% - \setvalue{\??externalfigures#1}% + \setvalue{\??externalfigureinstance#1}% {\def\next{\placestartfigure[#1][#2][#3]#4\placestopfigure}% \dosingleempty\next}% }% no longer: \doifundefined{#1}{\setvalue{#1}{\getexternalfigure{#1}}}} diff --git a/tex/context/base/l-string.lua b/tex/context/base/l-string.lua index 989e57f75..e36ee0b4b 100644 --- a/tex/context/base/l-string.lua +++ b/tex/context/base/l-string.lua @@ -112,6 +112,11 @@ function string.topattern(str,lowercase,strict) end end + +function string.valid(str,default) + return (type(str) == "string" and str ~= "" and str) or default or nil +end + -- obsolete names: string.quote = string.quoted diff --git a/tex/context/base/l-url.lua b/tex/context/base/l-url.lua index 69f32cc39..fd19efc73 100644 --- a/tex/context/base/l-url.lua +++ b/tex/context/base/l-url.lua @@ -81,8 +81,12 @@ end local isscheme = schemestr * colon * slash * slash -- this test also assumes authority local function hasscheme(str) - local scheme = lpegmatch(isscheme,str) -- at least one character - return scheme ~= "" and scheme or false + if str then + local scheme = lpegmatch(isscheme,str) -- at least one character + return scheme ~= "" and scheme or false + else + return false + end end --~ print(hasscheme("home:")) diff --git a/tex/context/base/page-mis.lua b/tex/context/base/page-mis.lua index 4f9d3c3e2..20ed23b50 100644 --- a/tex/context/base/page-mis.lua +++ b/tex/context/base/page-mis.lua @@ -8,6 +8,7 @@ if not modules then modules = { } end modules ['page-mis'] = { -- todo: adapt message +local format, validstring = string.format, string.valid local sortedkeys = table.sortedkeys local cache = { } @@ -16,7 +17,7 @@ local function flush(page) local c = cache[page] if c then for i=1,#c do - context.viafile(c[i]) + context.viafile(c[i],format("page.%s",validstring(page,"nopage"))) end cache[page] = nil end diff --git a/tex/context/base/s-map-10.mkiv b/tex/context/base/s-map-10.mkiv index e9ef436f9..17e65b225 100644 --- a/tex/context/base/s-map-10.mkiv +++ b/tex/context/base/s-map-10.mkiv @@ -315,12 +315,12 @@ \setupfootnotes [location=none, width=\textwidth, - before={\blank}, - numbercommand=, + before=\blank, command=\footnum] -\setupfootnotedefinition - [location=serried, +\setupnotations + [alternative=serried, + numbercommand=, before=, after=, distance=0.5em] diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index a9ea6ced5..bf8e1debb 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 4141cf299..8eca647c1 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/strc-blk.lua b/tex/context/base/strc-blk.lua index d2f25dfb3..791f8f99b 100644 --- a/tex/context/base/strc-blk.lua +++ b/tex/context/base/strc-blk.lua @@ -9,10 +9,9 @@ if not modules then modules = { } end modules ['strc-blk'] = { -- this one runs on top of buffers and structure local type = type -local gmatch, find = string.gmatch, string.find -local lpegmatch = lpeg.match +local find, format, validstring = string.find, string.format, string.valid local settings_to_set, settings_to_array = utilities.parsers.settings_to_set, utilities.parsers.settings_to_array -local allocate, mark = utilities.storage.allocate, utilities.storage.mark +local allocate = utilities.storage.allocate local structures, context = structures, context @@ -45,7 +44,7 @@ function blocks.print(name,data,hide) else context.dostartnormalblock(name) end - context.viafile(data) + context.viafile(data,format("block.%s",validstring(name,"noname"))) if hide then context.dostophiddenblock() else diff --git a/tex/context/base/trac-deb.lua b/tex/context/base/trac-deb.lua index 87434a13d..9e724f9fa 100644 --- a/tex/context/base/trac-deb.lua +++ b/tex/context/base/trac-deb.lua @@ -94,6 +94,15 @@ end function tracers.showlines(filename,linenumber,offset,errorstr) local data = io.loaddata(filename) + if not data or data == "" then + local hash = url.hashed(filename) + if not hash.noscheme then + local ok, d, n = resolvers.loaders.byscheme(hash.scheme,filename) + if ok and n > 0 then + data = d + end + end + end local lines = data and string.splitlines(data) if lines and #lines > 0 then -- this does not work yet as we cannot access the last lua error @@ -134,7 +143,9 @@ function tracers.showlines(filename,linenumber,offset,errorstr) end function tracers.printerror(offset) - local filename, linenumber = status.filename, tonumber(status.linenumber) or 0 + local inputstack = resolvers.inputstack + local filename = inputstack[#inputstack] or status.filename + local linenumber = tonumber(status.linenumber) or 0 if not filename then report_system("error not related to input file: %s ...",status.lasterrorstring) elseif type(filename) == "number" then diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 46ff6c4c2..c77cd4626 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 : 06/05/12 17:36:46 +-- merge date : 06/05/12 21:45:24 do -- begin closure to overcome local limits and interference @@ -118,6 +118,11 @@ function string.topattern(str,lowercase,strict) end end + +function string.valid(str,default) + return (type(str) == "string" and str ~= "" and str) or default or nil +end + -- obsolete names: string.quote = string.quoted -- cgit v1.2.3