summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-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.pdfbin4139 -> 4141 bytes
-rw-r--r--tex/context/base/context-version.pngbin104713 -> 106045 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.lua53
-rw-r--r--tex/context/base/m-spreadsheet.lua7
-rw-r--r--tex/context/base/s-mod.ctx1
-rw-r--r--tex/context/base/status-files.pdfbin24389 -> 24388 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin181135 -> 181164 bytes
12 files changed, 49 insertions, 22 deletions
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index b07d590ba..2aabcc1b2 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.09 01:22}
+\newcontextversion{2012.06.11 00:21}
%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 4d313564c..7e3dd671f 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.09 01:22}
+\newcontextversion{2012.06.11 00:21}
%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-yes.mkiv b/tex/context/base/cont-yes.mkiv
index 51be3a569..01ba88d49 100644
--- a/tex/context/base/cont-yes.mkiv
+++ b/tex/context/base/cont-yes.mkiv
@@ -24,6 +24,8 @@
local filename = arguments.input or tex.jobname
local suffix = file.suffix(filename)
+ local filename = ctxrunner.resolve(filename) -- in case we're prepped
+
if suffix == "xml" or arguments.forcexml then
-- Maybe we should move the preamble parsing here as it
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index 160d6435b..0e42029c0 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-version.png b/tex/context/base/context-version.png
index 56ad3270f..5352a41ab 100644
--- a/tex/context/base/context-version.png
+++ b/tex/context/base/context-version.png
Binary files differ
diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii
index a88a133f3..f2c39eef0 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.09 01:22}
+\edef\contextversion{2012.06.11 00:21}
%D For those who want to use this:
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index b6d0f54eb..32ea1b198 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.09 01:22}
+\edef\contextversion{2012.06.11 00:21}
%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 616f82a58..1f673d17e 100644
--- a/tex/context/base/core-ctx.lua
+++ b/tex/context/base/core-ctx.lua
@@ -33,7 +33,9 @@ millisecond it's not that much of a burden.
local trace_prepfiles = false trackers.register("system.prepfiles", function(v) trace_prepfiles = v end)
-local gsub, find = string.gsub, string.find
+local gsub, find, match, validstring = string.gsub, string.find, string.match, string.valid
+local concat = table.concat
+local xmltext = xml.text
local report_prepfiles = logs.reporter("system","prepfiles")
@@ -106,6 +108,7 @@ function ctxrunner.load(ctxname)
xml.include(xmldata,'ctx:include','name', {'.', file.dirname(ctxname), "..", "../.." })
for e in xml.collected(xmldata,"/ctx:job/ctx:flags/ctx:flag") do
+ local flag = xmltext(e)
local key, value = match(flag,"^(.-)=(.+)$")
if key and value then
environment.setargument(key,value)
@@ -123,22 +126,22 @@ function ctxrunner.load(ctxname)
local environments = ctxfile.environments
for e in xml.collected(xmldata,"/ctx:job/ctx:process/ctx:resources/ctx:mode") do
- modes[#modes+1] = xml.text(e)
- -- context.enablemode { xml.text(e) }
+ 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] = xml.text(e)
- -- context.module { xml.text(e) }
+ 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] = xml.text(e)
- -- context.environment { xml.text(e) }
+ environments[#environments+1] = xmltext(e)
+ -- context.environment { xmltext(e) }
end
for e in xml.collected(xmldata,"ctx:message") do
- report_prepfiles("ctx comment: %s", xml.text(e))
+ report_prepfiles("ctx comment: %s", xmltext(e))
end
for r, d, k in xml.elements(xmldata,"ctx:value[@name='job']") do
@@ -156,20 +159,33 @@ function ctxrunner.load(ctxname)
-- todo: only collect, then plug into file handler
+ local inputfile = validstring(environment.arguments.input) or jobname
+
+ variables.old = inputfile
+
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 ""
- if preprocessor ~= "" then
- treatments[#treatments+1] = {
- pattern = string.topattern(justtext(xml.tostring(pattern))),
- preprocessors = utilities.parsers.settings_to_array(preprocessor),
+ for r, d, k in xml.elements(pattern,"/ctx:old") do
+ d[k] = jobname
+ end
+ for r, d, k in xml.elements(pattern,"/ctx:value[@name='old'") do
+ d[k] = jobname
+ end
+ pattern =justtext(xml.tostring(pattern))
+ if preprocessor and preprocessor ~= "" and pattern and pattern ~= "" then
+ local noftreatments = #treatments + 1
+ local findpattern = string.topattern(pattern)
+ local preprocessors = utilities.parsers.settings_to_array(preprocessor)
+ treatments[noftreatments] = {
+ pattern = findpattern,
+ preprocessors = preprocessors,
}
+ report_prepfiles("step: %s, pattern: %q, preprocessor: %q",noftreatments,findpattern,concat(preprocessors," "))
end
end
end
- variables.old = jobname
-
local function needstreatment(oldfile)
for i=1,#treatments do
local treatment = treatments[i]
@@ -185,7 +201,8 @@ function ctxrunner.load(ctxname)
local treatment = needstreatment(filename)
if treatment then
local oldfile = filename
- newfile = oldfile .. "." .. suffix
+ -- newfile = oldfile .. "." .. suffix
+ newfile = oldfile .. ".prep"
if runlocal then
newfile = file.basename(newfile)
end
@@ -265,6 +282,8 @@ function ctxrunner.load(ctxname)
table.setmetatableindex(ctxrunner.prepfiles,preparefile or dontpreparefile)
+ -- we need to deal with the input filename as it has already be resolved
+
end
local function resolve(name) -- used a few times later on
@@ -301,6 +320,10 @@ function commands.getctxfile()
end
end
+function ctxrunner.resolve(name) -- used a few times later on
+ return ctxrunner.prepfiles[file.collapsepath(name)] or name
+end
+
-- ctxrunner.load("t:/sources/core-ctx.ctx")
--
-- context(ctxrunner.prepfiles["one-a.xml"]) context.par()
diff --git a/tex/context/base/m-spreadsheet.lua b/tex/context/base/m-spreadsheet.lua
index 25bf6be87..34bbdf433 100644
--- a/tex/context/base/m-spreadsheet.lua
+++ b/tex/context/base/m-spreadsheet.lua
@@ -9,9 +9,12 @@ if not modules then modules = { } end modules ['m-spreadsheet'] = {
local byte, format, gsub = string.byte, string.format, string.gsub
local R, P, C, V, Cs, Cc, Carg, lpegmatch = lpeg.R, lpeg.P, lpeg.C, lpeg.V, lpeg.Cs, lpeg.Cc, lpeg.Carg, lpeg.match
+local context = context
+
local splitthousands = utilities.parsers.splitthousands
+local variables = interfaces.variables
-local context = context
+local v_yes = variables.yes
moduledata = moduledata or { }
@@ -180,7 +183,7 @@ function spreadsheets.get(name,r,c,str)
local split = settings.split
local period = settings.period
local comma = settings.comma
- if split then
+ if split == v_yes then
result = splitthousands(result)
end
if period == "" then period = nil end
diff --git a/tex/context/base/s-mod.ctx b/tex/context/base/s-mod.ctx
index 5059c77d4..09ecf714c 100644
--- a/tex/context/base/s-mod.ctx
+++ b/tex/context/base/s-mod.ctx
@@ -11,7 +11,6 @@
</ctx:files>
</ctx:preprocess>
<ctx:flags>
- <!-- ctx:flag>purge</ctx:flag -->
<ctx:flag>global</ctx:flag>
<ctx:flag>prep</ctx:flag>
<ctx:flag>purge</ctx:flag>
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index b04ca9be3..6210d8e2f 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 12862163c..90f84ece6 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ