From a348d7ad3b4077c1ce1cf65d7f2ab21487aad3b3 Mon Sep 17 00:00:00 2001 From: Marius Date: Tue, 6 Nov 2012 11:40:14 +0200 Subject: beta 2012.11.06 09:56 --- tex/context/base/cont-new.mkii | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/cont-yes.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4149 -> 4145 bytes tex/context/base/context.mkii | 2 +- tex/context/base/context.mkiv | 2 +- tex/context/base/core-ctx.lua | 133 +++++++++++---------- tex/context/base/status-files.pdf | Bin 24610 -> 24613 bytes tex/context/base/status-lua.pdf | Bin 196235 -> 196234 bytes tex/context/base/strc-flt.mkvi | 6 +- tex/context/base/x-ldx.ctx | 4 +- tex/context/base/x-ldx.lua | 10 +- tex/context/base/x-ldx.mkiv | 11 +- tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 14 files changed, 92 insertions(+), 84 deletions(-) (limited to 'tex') diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index edcdbb2f7..e2088670d 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.11.05 17:38} +\newcontextversion{2012.11.06 09:56} %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 17da5788a..6ada0a7b0 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.11.05 17:38} +\newcontextversion{2012.11.06 09:56} %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/cont-yes.mkiv b/tex/context/base/cont-yes.mkiv index 2a032fc0b..0b7fd621e 100644 --- a/tex/context/base/cont-yes.mkiv +++ b/tex/context/base/cont-yes.mkiv @@ -20,7 +20,7 @@ -- When a style is loaded there is a good change that we never enter -- this code. - environment.initializefilenames() + environment.initializefilenames() -- todo: check if we really need to pre-prep the filename local arguments = environment.arguments local suffix = environment.suffix diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index acc17624a..4959623fb 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.mkii b/tex/context/base/context.mkii index 5d0470170..0fc178651 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.11.05 17:38} +\edef\contextversion{2012.11.06 09:56} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 74cc8a829..8851f7369 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,7 +25,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2012.11.05 17:38} +\edef\contextversion{2012.11.06 09:56} %D For those who want to use this: diff --git a/tex/context/base/core-ctx.lua b/tex/context/base/core-ctx.lua index 0dfb21ce9..ba62d1e20 100644 --- a/tex/context/base/core-ctx.lua +++ b/tex/context/base/core-ctx.lua @@ -98,12 +98,12 @@ function ctxrunner.load(ctxname) local jobname = tex.jobname -- todo - local variables = { job = jobname } - local commands = { } - local flags = { } - local paths = { } -- todo - local treatments = { } - local suffix = "prep" + local variables = { job = jobname } + local commands = { } + local flags = { } + local paths = { } -- todo + local treatments = { } + local suffix = "prep" xml.include(xmldata,'ctx:include','name', {'.', file.dirname(ctxname), "..", "../.." }) @@ -127,17 +127,14 @@ function ctxrunner.load(ctxname) for e in xml.collected(xmldata,"/ctx:job/ctx:process/ctx:resources/ctx:mode") do modes[#modes+1] = xmltext(e) - -- context.enablemode { xmltext(e) } end for e in xml.collected(xmldata,"/ctx:job/ctx:process/ctx:resources/ctx:module") do modules[#modules+1] = xmltext(e) - -- context.module { xmltext(e) } end for e in xml.collected(xmldata,"/ctx:job/ctx:process/ctx:resources/ctx:environment") do environments[#environments+1] = xmltext(e) - -- context.environment { xmltext(e) } end for e in xml.collected(xmldata,"ctx:message") do @@ -149,10 +146,30 @@ function ctxrunner.load(ctxname) end for e in xml.collected(xmldata,"/ctx:job/ctx:preprocess/ctx:processors/ctx:processor") do - commands[e.at and e.at['name'] or "unknown"] = e + local name = e.at and e.at['name'] or "unknown" + local suffix = e.at and e.at['suffix'] or "prep" + for r, d, k in xml.elements(command,"ctx:old") do + d[k] = "%old%" + end + for r, d, k in xml.elements(e,"ctx:new") do + d[k] = "%new%" + end + for r, d, k in xml.elements(e,"ctx:value") do + local tag = d[k].at['name'] + if tag then + d[k] = "%" .. tag .. "%" + end + end + local runner = xml.textonly(e) + if runner and runner ~= "" then + commands[name] = { + suffix = suffix, + runner = runner, + } + end end - local suffix = xml.filter(xmldata,"xml:///ctx:job/ctx:preprocess/attribute('suffix')") -- or ... + local suffix = xml.filter(xmldata,"xml:///ctx:job/ctx:preprocess/attribute('suffix')") or suffix local runlocal = xml.filter(xmldata,"xml:///ctx:job/ctx:preprocess/ctx:processors/attribute('local')") runlocal = toboolean(runlocal) @@ -165,7 +182,7 @@ function ctxrunner.load(ctxname) for files in xml.collected(xmldata,"/ctx:job/ctx:preprocess/ctx:files") do for pattern in xml.collected(files,"ctx:file") do - local preprocessor = pattern.at['processor'] or "" + local preprocessor = pattern.at['processor'] or "" for r, d, k in xml.elements(pattern,"/ctx:old") do d[k] = jobname end @@ -181,7 +198,7 @@ function ctxrunner.load(ctxname) pattern = findpattern, preprocessors = preprocessors, } - report_prepfiles("step: %s, pattern: %q, preprocessor: %q",noftreatments,findpattern,concat(preprocessors," ")) + report_prepfiles("step %s, pattern: %q, preprocessor: %q",noftreatments,findpattern,concat(preprocessors," ")) end end end @@ -199,53 +216,37 @@ function ctxrunner.load(ctxname) local preparefile = #treatments > 0 and function(prepfiles,filename) local treatment = needstreatment(filename) + local oldfile = filename + local newfile = false if treatment then - local oldfile = filename - -- newfile = oldfile .. "." .. suffix - newfile = oldfile .. ".prep" - if runlocal then - newfile = file.basename(newfile) - end - - if file.needsupdating(oldfile,newfile) then - local preprocessors = treatment.preprocessors - local runners = { } - for i=1,#preprocessors do - local preprocessor = preprocessors[i] - local command = commands[preprocessor] - if command then - command = xml.copy(command) - local suf = command.at and command.at['suffix'] or suffix - if suf then - newfile = oldfile .. "." .. suf - end - if runlocal then - newfile = file.basename(newfile) - end - for r, d, k in xml.elements(command,"ctx:old") do - d[k] = substitute(oldfile) - end - for r, d, k in xml.elements(command,"ctx:new") do - d[k] = substitute(newfile) - end - variables.old = oldfile - variables.new = newfile - for r, d, k in xml.elements(command,"ctx:value") do - local ek = d[k] - local ekat = ek.at and ek.at['name'] - if ekat then - d[k] = substitute(variables[ekat] or "") - end - end - command = xml.content(command) - runners[#runners+1] = justtext(command) - oldfile = newfile + local preprocessors = treatment.preprocessors + local runners = { } + for i=1,#preprocessors do + local preprocessor = preprocessors[i] + local command = commands[preprocessor] + if command then + local runner = command.runner + local suffix = command.suffix + local result = filename .. "." .. suffix + if runlocal then + result = file.basename(result) + end + variables.old = oldfile + variables.new = result + runner = utilities.templates.replace(runner,variables) + if runner and runner ~= "" then + runners[#runners+1] = runner + oldfile = result if runlocal then oldfile = file.basename(oldfile) end + newfile = oldfile end end - -- for tracing we have collected commands first + end + if not newfile then + newfile = filename + elseif file.needsupdating(filename,newfile) then for i=1,#runners do report_prepfiles("step %i: %s",i,runners[i]) end @@ -267,17 +268,14 @@ function ctxrunner.load(ctxname) end elseif lfs.isfile(newfile) then report_prepfiles("%q is already converted to %q",filename,newfile) - else - -- report_prepfiles("%q is not converted to %q",filename,newfile) - newfile = filename end else newfile = filename end prepfiles[filename] = newfile - + -- in case we ask twice (with the prepped name) ... todo: avoid this mess + prepfiles[newfile] = newfile return newfile - end table.setmetatableindex(ctxrunner.prepfiles,preparefile or dontpreparefile) @@ -286,6 +284,19 @@ function ctxrunner.load(ctxname) end +-- print("\n") +-- document = { +-- options = { +-- ctxfile = { +-- modes = { }, +-- modules = { }, +-- environments = { }, +-- } +-- } +-- } +-- environment.arguments.input = "test.tex" +-- ctxrunner.load("x-ldx.ctx") + local function resolve(name) -- used a few times later on return ctxrunner.prepfiles[file.collapsepath(name)] or false end @@ -325,11 +336,11 @@ function ctxrunner.resolve(name) -- used a few times later on end -- ctxrunner.load("t:/sources/core-ctx.ctx") --- + -- context(ctxrunner.prepfiles["one-a.xml"]) context.par() -- context(ctxrunner.prepfiles["one-b.xml"]) context.par() -- context(ctxrunner.prepfiles["two-c.xml"]) context.par() -- context(ctxrunner.prepfiles["two-d.xml"]) context.par() -- context(ctxrunner.prepfiles["all-x.xml"]) context.par() --- + -- inspect(ctxrunner.prepfiles) diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 2dc5dcfce..d24c90a42 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 3bf4f7ebe..f17102e40 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-flt.mkvi b/tex/context/base/strc-flt.mkvi index 1f1d5c02c..2235cdecd 100644 --- a/tex/context/base/strc-flt.mkvi +++ b/tex/context/base/strc-flt.mkvi @@ -785,8 +785,8 @@ \globallet\currentfloatsynchronize\relax \else \ifnofloatnumber \else \ifnofloatcaption \else - \strc_counters_increment{\strc_counters_the\currentfloat}% - \fi \fi + \strc_counters_increment{\namedcounterparameter\currentfloat\s!name}% + \fi \fi \strc_counters_register_component {float}% \setupcurrentfloatcaption @@ -796,7 +796,7 @@ \relax \relax [\c!name=\currentfloat,% - \s!counter=\strc_counters_the\currentfloat,% + \s!counter=\namedcounterparameter\currentfloat\s!name,% \s!hascaption=\ifnofloatcaption \v!no\else\v!yes\fi,% \s!hasnumber=\ifnofloatnumber \v!no\else\v!yes\fi,% \s!hastitle=\ifemptyfloatcaption\v!no\else\v!yes\fi]% diff --git a/tex/context/base/x-ldx.ctx b/tex/context/base/x-ldx.ctx index 0dddc9734..edbffc285 100644 --- a/tex/context/base/x-ldx.ctx +++ b/tex/context/base/x-ldx.ctx @@ -4,7 +4,7 @@ Lua Documentation Generator - mtxrun --internal x-ldx.lua + mtxrun --script x-ldx.lua @@ -16,7 +16,7 @@ - ldx + x-ldx.mkiv diff --git a/tex/context/base/x-ldx.lua b/tex/context/base/x-ldx.lua index 2a04d6126..31cbebf13 100644 --- a/tex/context/base/x-ldx.lua +++ b/tex/context/base/x-ldx.lua @@ -316,16 +316,16 @@ will produce an ldx file that can be processed with by running: -texexec --use=x-ldx --forcexml somefile.ldx +context --use=x-ldx --forcexml somefile.ldx You can do this in one step by saying: -texmfstart texexec --ctx=x-ldx somefile.lua +context --ctx=x-ldx somefile.lua -This will trigger into loading the mentioned +This will trigger into loading the mentioned file. That file describes the conversion as well as the module to be used. @@ -334,8 +334,8 @@ The main conversion call is: -- todo: assume usage of "mtxrun --script x-ldx", maybe make it mtx-ldx -if arg and arg[1] then - ldx.convert(arg[1],arg[2]) +if environment.files and environment.files[1] then + ldx.convert(environment.files[1],environment.files[2]) end --~ exit(1) diff --git a/tex/context/base/x-ldx.mkiv b/tex/context/base/x-ldx.mkiv index 4f4da5acb..0156f2c55 100644 --- a/tex/context/base/x-ldx.mkiv +++ b/tex/context/base/x-ldx.mkiv @@ -11,18 +11,19 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +% this will become an extra + \setupxml[default=hidden] \usemodule[x][mathml] \usemodule[abr-02] -\xmlregisterdocumentsetup{ldx}{xml:mml:define} -\xmlregisterdocumentsetup{ldx}{xml:ldx:define} +\xmlregistersetup{xml:mml:define} +\xmlregistersetup{xml:ldx:define} \xmlregisterns{ldx}{ldx} \startxmlsetups xml:ldx:define -% \xmlgrab {\xmldocument} {ldx:*} {*} \xmlsetsetup {#1} {ldx:*} {ldx:*} \stopxmlsetups @@ -142,10 +143,6 @@ \dontleavehmode{\tt\xmlflush{#1}} \stopxmlsetups -% - -\def\xmldocument{ldx} - % key -> kw % dqs -> dq % sqs -> sq diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 0d1331781..2ddebbed7 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 : 11/05/12 17:38:22 +-- merge date : 11/06/12 09:56:45 do -- begin closure to overcome local limits and interference -- cgit v1.2.3