summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tex/context/base/buff-ini.lua123
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4108 -> 4104 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/grph-fig.mkiv10
-rw-r--r--tex/context/base/status-files.pdfbin24685 -> 24695 bytes
-rw-r--r--tex/context/base/status-lua.log2
-rw-r--r--tex/context/base/util-soc.lua16
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
9 files changed, 98 insertions, 59 deletions
diff --git a/tex/context/base/buff-ini.lua b/tex/context/base/buff-ini.lua
index f76494c43..45288d18b 100644
--- a/tex/context/base/buff-ini.lua
+++ b/tex/context/base/buff-ini.lua
@@ -17,6 +17,7 @@ local trace_grab = false trackers.register("buffers.grab", function
local trace_visualize = false trackers.register("buffers.visualize", function(v) trace_visualize = v end)
local report_buffers = logs.reporter("buffers","usage")
+local report_typeset = logs.reporter("buffers","typeset")
local report_grabbing = logs.reporter("buffers","grabbing")
local context = context
@@ -25,6 +26,7 @@ local commands = commands
local variables = interfaces.variables
local settings_to_array = utilities.parsers.settings_to_array
local formatters = string.formatters
+local addsuffix = file.addsuffix
local v_yes = variables.yes
@@ -43,15 +45,23 @@ local function erase(name)
end
local function assign(name,str,catcodes)
- cache[name] = { data = str, catcodes = catcodes }
+ cache[name] = {
+ data = str,
+ catcodes = catcodes,
+ typeset = false,
+ }
end
local function append(name,str)
local buffer = cache[name]
if buffer then
- buffer.data = buffer.data .. str
+ buffer.data = buffer.data .. str
+ buffer.typeset = false
else
- cache[name] = { data = str }
+ cache[name] = {
+ data = str,
+ typeset = false,
+ }
end
end
@@ -69,10 +79,40 @@ local function getlines(name)
return buffer and splitlines(buffer.data)
end
-local function collectcontent(names,separator) -- no print
- if type(names) == "string" then
- names = settings_to_array(names)
+local function getnames(name)
+ if type(name) == "string" then
+ return settings_to_array(name)
+ else
+ return name
+ end
+end
+
+local function istypeset(name)
+ local names = getnames(name)
+ if #names == 0 then
+ return false
+ end
+ for i=1,#names do
+ local c = cache[names[i]]
+ if c and not c.typeset then
+ return false
+ end
end
+ return true
+end
+
+local function markastypeset(name)
+ local names = getnames(name)
+ for i=1,#names do
+ local c = cache[names[i]]
+ if c then
+ c.typeset = true
+ end
+ end
+end
+
+local function collectcontent(name,separator) -- no print
+ local names = getnames(name)
local nnames = #names
if nnames == 0 then
return getcontent("") -- default buffer
@@ -91,12 +131,10 @@ local function collectcontent(names,separator) -- no print
end
end
-local function loadcontent(names) -- no print
- if type(names) == "string" then
- names = settings_to_array(names)
- end
+local function loadcontent(name) -- no print
+ local names = getnames(name)
local nnames = #names
- local ok = false
+ local ok = false
if nnames == 0 then
ok = load(getcontent("")) -- default buffer
elseif nnames == 1 then
@@ -128,7 +166,6 @@ local function loadcontent(names) -- no print
end
end
-
buffers.raw = getcontent
buffers.erase = erase
buffers.assign = assign
@@ -234,7 +271,7 @@ end
function commands.grabbuffer(name,begintag,endtag,bufferdata,catcodes) -- maybe move \\ to call
local dn = getcontent(name)
if dn == "" then
- nesting = 0
+ nesting = 0
continue = false
end
if trace_grab then
@@ -252,8 +289,8 @@ function commands.grabbuffer(name,begintag,endtag,bufferdata,catcodes) -- maybe
nesting = nesting + lpegmatch(counter,bufferdata)
local more = nesting > 0
if more then
- dn = dn .. sub(bufferdata,2,-1) .. endtag
- nesting = nesting - 1
+ dn = dn .. sub(bufferdata,2,-1) .. endtag
+ nesting = nesting - 1
continue = true
else
if continue then
@@ -275,10 +312,7 @@ function commands.grabbuffer(name,begintag,endtag,bufferdata,catcodes) -- maybe
commands.doifelse(more)
end
--- The optional prefix hack is there for the typesetbuffer feature and
--- in mkii we needed that (this hidden feature is used in a manual).
-
-local function prepared(name,list,prefix) -- list is optional
+function commands.savebuffer(list,name,prefix) -- name is optional
if not list or list == "" then
list = name
end
@@ -289,37 +323,44 @@ local function prepared(name,list,prefix) -- list is optional
if content == "" then
content = "empty buffer"
end
- if prefix then
- local name = file.addsuffix(name,"tmp")
- return tex.jobname .. "-" .. name, content
- else
- return name, content
+ if prefix == v_yes then
+ name = addsuffix(tex.jobname .. "-" .. name,"tmp")
end
+ io.savedata(name,content)
end
-local capsule = "\\starttext\n%s\n\\stoptext\n"
-local command = "context %s"
+local files = { }
+local last = 0
-function commands.runbuffer(name,list,encapsulate)
- local name, content = prepared(name,list)
- if encapsulate then
- content = format(capsule,content)
+function commands.runbuffer(name,encapsulate) -- we used to compare the saved file with content
+ local names = getnames(name)
+ local filename = files[name]
+ if not filename then
+ last = last + 1
+ filename = formatters["%s-typeset-buffer-%03i"](tex.jobname,last)
+ files[name] = filename
end
- local data = io.loaddata(name)
- if data ~= content then
+ if not istypeset(names) then
if trace_run then
- report_buffers("changes in %a, processing forced",name)
+ report_typeset("changes in %a, processing forced",name)
end
- io.savedata(name,content)
- os.execute(format(command,name))
+ local filename = addsuffix(filename,"tmp")
+ local content = collectcontent(names,nil) or ""
+ if content == "" then
+ content = "empty buffer"
+ end
+ if encapsulate then
+ content = formatters["\\starttext\n%s\n\\stoptext\n"](content)
+ end
+ report_typeset("\n")
+ io.savedata(filename,content)
+ os.execute(formatters["context %s"](filename))
+ report_typeset("\n")
+ markastypeset(names)
elseif trace_run then
- report_buffers("no changes in %a, not processed",name)
+ report_typeset("no changes in %a, not processed",name)
end
-end
-
-function commands.savebuffer(list,name,prefix) -- name is optional
- local name, content = prepared(name,list,prefix==v_yes)
- io.savedata(name,content)
+ context(addsuffix(filename,"pdf"))
end
function commands.getbuffer(name)
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index fd1cd3a9a..960ebaac7 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{2013.08.09 02:59}
+\newcontextversion{2013.08.09 23:39}
%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 64590a05a..562f9c5c4 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.mkiv b/tex/context/base/context.mkiv
index 632b91cc6..b563aba2c 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{2013.08.09 02:59}
+\edef\contextversion{2013.08.09 23:39}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/grph-fig.mkiv b/tex/context/base/grph-fig.mkiv
index d74f257f5..f11c481e3 100644
--- a/tex/context/base/grph-fig.mkiv
+++ b/tex/context/base/grph-fig.mkiv
@@ -27,11 +27,9 @@
% we could use \typesetbuffer[*] to access the last one
-\newcount \c_grph_buffers_n
\newconstant\c_grph_buffers_mode
-\let\m_grph_buffers_filename\empty
-\let\lasttypesetbuffer \empty
+\let\lasttypesetbuffer\empty
\unexpanded\def\typesetbuffer
{\bgroup
@@ -55,11 +53,7 @@
\fi\fi}
\def\grph_buffers_typeset_indeed[#1][#2]% we could use the via files
- {\doifnot{#1}{*}
- {\global\advance\c_grph_buffers_n\plusone
- \edef\m_grph_buffers_filename{\jobname-buffer-\the\c_grph_buffers_n}%
- \ctxcommand{runbuffer("\m_grph_buffers_filename.tmp","#1",true)}%
- \xdef\lasttypesetbuffer{\m_grph_buffers_filename.pdf}}%
+ {\doifnot{#1}{*}{\xdef\lasttypesetbuffer{\ctxcommand{runbuffer("#1")}}}%
\ifcase\c_grph_buffers_mode
% typesetonly
\or
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index c2980374c..3ad04b484 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.log b/tex/context/base/status-lua.log
index 38c914c35..fbf7f46a4 100644
--- a/tex/context/base/status-lua.log
+++ b/tex/context/base/status-lua.log
@@ -1,6 +1,6 @@
(cont-yes.mkiv
-ConTeXt ver: 2013.08.09 02:59 MKIV beta fmt: 2013.8.9 int: english/english
+ConTeXt ver: 2013.08.09 23:39 MKIV beta fmt: 2013.8.9 int: english/english
system > 'cont-new.mkiv' loaded
(cont-new.mkiv)
diff --git a/tex/context/base/util-soc.lua b/tex/context/base/util-soc.lua
index 30301c510..3a52ee86d 100644
--- a/tex/context/base/util-soc.lua
+++ b/tex/context/base/util-soc.lua
@@ -25,17 +25,17 @@ function mail.send(specification)
local server = specification.server or ""
if not server then
report_mail("no server specified")
- return false
+ return false, "invalid server"
end
local to = specification.to or specification.recepient or ""
if to == "" then
- report_mail("no recepient specified")
- return false
+ report_mail("no recipient specified")
+ return false, "invalid recipient"
end
local from = specification.from or specification.sender or ""
if from == "" then
report_mail("no sender specified")
- return false
+ return false, "invalid sender"
end
local message = { }
local body = specification.body
@@ -68,11 +68,13 @@ function mail.send(specification)
end
end
end
+ local user = specification.user
+ local password = specification.password
local result, detail = smtp.send {
server = specification.server,
port = specification.port,
- user = specification.user,
- password = specification.password,
+ user = user ~= "" and user or nil,
+ password = password ~= "" and password or nil,
from = from,
rcpt = to,
source = smtp.message {
@@ -87,7 +89,9 @@ function mail.send(specification)
}
if detail then
report_mail("error: %s",detail)
+ return false, detail
else
report_mail("message sent")
+ return true
end
end
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index f43b8512b..8f726ab54 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 : 08/09/13 02:59:50
+-- merge date : 08/09/13 23:39:49
do -- begin closure to overcome local limits and interference