summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2012-11-06 09:56:00 +0100
committerHans Hagen <pragma@wxs.nl>2012-11-06 09:56:00 +0100
commit1fcc520803951a61b5a08baf6c1cdac8f7111e75 (patch)
tree0cb81b90a968e75bbbc51cfdd0136f985e0db9b9
parent3a71aec28c8adaf192eb574fde7735895195fad4 (diff)
downloadcontext-1fcc520803951a61b5a08baf6c1cdac8f7111e75.tar.gz
beta 2012.11.06 09:56
-rw-r--r--tex/context/base/cont-new.mkii2
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/cont-yes.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4149 -> 4145 bytes
-rw-r--r--tex/context/base/context.mkii2
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/core-ctx.lua133
-rw-r--r--tex/context/base/status-files.pdfbin24610 -> 24613 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin196235 -> 196234 bytes
-rw-r--r--tex/context/base/strc-flt.mkvi6
-rw-r--r--tex/context/base/x-ldx.ctx4
-rw-r--r--tex/context/base/x-ldx.lua10
-rw-r--r--tex/context/base/x-ldx.mkiv11
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
14 files changed, 92 insertions, 84 deletions
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index 44d183c73..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.10.30 21:13}
+\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 7f5a684bd..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.10.30 21:13}
+\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
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii
index 9e2f4c14b..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.10.30 21:13}
+\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 a97ce0cd8..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.10.30 21:13}
+\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
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index 3bf4f7ebe..f17102e40 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files 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 @@
<ctx:message>Lua Documentation Generator</ctx:message>
<ctx:preprocess>
<ctx:processors>
- <ctx:processor name='ldx'>mtxrun --internal x-ldx.lua <ctx:value name='old'/> <ctx:value name='new'/></ctx:processor>
+ <ctx:processor name='ldx'>mtxrun --script x-ldx.lua <ctx:value name='old'/> <ctx:value name='new'/></ctx:processor>
</ctx:processors>
<ctx:files>
<ctx:file processor='ldx'><ctx:value name='old'/></ctx:file>
@@ -16,7 +16,7 @@
</ctx:flags>
<ctx:process>
<ctx:resources>
- <ctx:module>ldx</ctx:module>
+ <ctx:environment>x-ldx.mkiv</ctx:environment>
</ctx:resources>
</ctx:process>
</ctx:job>
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 <logo label='context'/>
by running:
<typing>
-texexec --use=x-ldx --forcexml somefile.ldx
+context --use=x-ldx --forcexml somefile.ldx
</typing>
You can do this in one step by saying:
<typing>
-texmfstart texexec --ctx=x-ldx somefile.lua
+context --ctx=x-ldx somefile.lua
</typing>
-This will trigger <logo label='texexec'/> into loading the mentioned
+This will trigger <logo label='context'/> into loading the mentioned
<logo label='ctx'/> 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 09320d01c..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 : 10/30/12 21:13:14
+-- merge date : 11/06/12 09:56:45
do -- begin closure to overcome local limits and interference