summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2013-03-20 23:00:13 +0200
committerMarius <mariausol@gmail.com>2013-03-20 23:00:13 +0200
commit41df6a896ad3ab1d8bb6286423e9540b2b34f576 (patch)
tree5b9f231d835f2ed9164de572e30f343feed6d7a9 /tex
parentec45850390b27ff82a3ef2ab406a801393fdf603 (diff)
downloadcontext-41df6a896ad3ab1d8bb6286423e9540b2b34f576.tar.gz
beta 2013.03.20 21:07
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/context-version.pdfbin4137 -> 4134 bytes
-rw-r--r--tex/context/base/context-version.pngbin40482 -> 40182 bytes
-rw-r--r--tex/context/base/context.mkii2
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/lxml-tab.lua37
-rw-r--r--tex/context/base/lxml-tex.lua62
-rw-r--r--tex/context/base/status-files.pdfbin24801 -> 24788 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin211429 -> 211561 bytes
-rw-r--r--tex/context/base/status-mkiv.lua12
-rw-r--r--tex/context/base/trac-exp.lua190
-rw-r--r--tex/context/base/trac-log.lua61
-rw-r--r--tex/context/base/trac-xml.lua92
-rw-r--r--tex/context/base/util-mrg.lua2
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
16 files changed, 400 insertions, 66 deletions
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index 4fceea3cb..4eaa92ddc 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{2013.03.20 10:34}
+\newcontextversion{2013.03.20 21:07}
%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 43c591c41..4a89abc96 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.03.20 10:34}
+\newcontextversion{2013.03.20 21:07}
%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 172657701..45ca003ab 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 029e973d8..71514b2c2 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 5158dbd76..b65181bbf 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{2013.03.20 10:34}
+\edef\contextversion{2013.03.20 21:07}
%D For those who want to use this:
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index a2f2280fa..980e650a6 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.03.20 10:34}
+\edef\contextversion{2013.03.20 21:07}
%D For those who want to use this:
diff --git a/tex/context/base/lxml-tab.lua b/tex/context/base/lxml-tab.lua
index 216dc16e8..2bb5844fc 100644
--- a/tex/context/base/lxml-tab.lua
+++ b/tex/context/base/lxml-tab.lua
@@ -16,7 +16,7 @@ if not modules then modules = { } end modules ['lxml-tab'] = {
local trace_entities = false trackers.register("xml.entities", function(v) trace_entities = v end)
-local report_xml = logs and logs.reporter("xml","core") or function(...) print(format(...)) end
+local report_xml = logs and logs.reporter("xml","core") or function(...) print(string.format(...)) end
--[[ldx--
<p>The parser used here is inspired by the variant discussed in the lua book, but
@@ -41,10 +41,11 @@ local xml = xml
local concat, remove, insert = table.concat, table.remove, table.insert
local type, next, setmetatable, getmetatable, tonumber = type, next, setmetatable, getmetatable, tonumber
-local format, lower, find, match, gsub = string.format, string.lower, string.find, string.match, string.gsub
+local lower, find, match, gsub = string.lower, string.find, string.match, string.gsub
local utfchar = utf.char
local lpegmatch = lpeg.match
local P, S, R, C, V, C, Cs = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.V, lpeg.C, lpeg.Cs
+local formatters = string.formatters
--[[ldx--
<p>First a hack to enable namespace resolving. A namespace is characterized by
@@ -208,7 +209,7 @@ local function add_empty(spacing, namespace, tag)
if #spacing > 0 then
dt[#dt+1] = spacing
end
- local resolved = (namespace == "" and xmlns[#xmlns]) or nsremap[namespace] or namespace
+ local resolved = namespace == "" and xmlns[#xmlns] or nsremap[namespace] or namespace
top = stack[#stack]
dt = top.dt
local t = { ns=namespace or "", rn=resolved, tg=tag, at=at, dt={}, __p__ = top }
@@ -224,7 +225,7 @@ local function add_begin(spacing, namespace, tag)
if #spacing > 0 then
dt[#dt+1] = spacing
end
- local resolved = (namespace == "" and xmlns[#xmlns]) or nsremap[namespace] or namespace
+ local resolved = namespace == "" and xmlns[#xmlns] or nsremap[namespace] or namespace
top = { ns=namespace or "", rn=resolved, tg=tag, at=at, dt={}, __p__ = stack[#stack] }
setmetatable(top, mt)
dt = top.dt
@@ -239,9 +240,9 @@ local function add_end(spacing, namespace, tag)
local toclose = remove(stack)
top = stack[#stack]
if #stack < 1 then
- errorstr = format("nothing to close with %s %s", tag, xml.checkerror(top,toclose) or "")
+ errorstr = formatters["unable to close %s %s"](tag,xml.checkerror(top,toclose) or "")
elseif toclose.tg ~= tag then -- no namespace check
- errorstr = format("unable to close %s with %s %s", toclose.tg, tag, xml.checkerror(top,toclose) or "")
+ errorstr = formatters["unable to close %s with %s %s"](toclose.tg,tag,xml.checkerror(top,toclose) or "")
end
dt = top.dt
dt[#dt+1] = toclose
@@ -295,9 +296,9 @@ local function attribute_specification_error(str)
end
xml.placeholders = {
- unknown_dec_entity = function(str) return (str == "" and "&error;") or format("&%s;",str) end,
- unknown_hex_entity = function(str) return format("&#x%s;",str) end,
- unknown_any_entity = function(str) return format("&#x%s;",str) end,
+ unknown_dec_entity = function(str) return str == "" and "&error;" or formatters["&%s;"](str) end,
+ unknown_hex_entity = function(str) return formatters["&#x%s;"](str) end,
+ unknown_any_entity = function(str) return formatters["&#x%s;"](str) end,
}
local placeholders = xml.placeholders
@@ -307,7 +308,7 @@ local function fromhex(s)
if n then
return utfchar(n)
else
- return format("h:%s",s), true
+ return formatters["h:%s"](s), true
end
end
@@ -316,7 +317,7 @@ local function fromdec(s)
if n then
return utfchar(n)
else
- return format("d:%s",s), true
+ return formatters["d:%s"](s), true
end
end
@@ -680,8 +681,6 @@ local function _xmlconvert_(data, settings)
resolve_predefined = true
end
--
---~ inspect(settings)
- --
stack, top, at, xmlns, errorstr = { }, { }, { }, { }, nil
acache, hcache, dcache = { }, { }, { } -- not stored
reported_attribute_errors = { }
@@ -722,9 +721,9 @@ local function _xmlconvert_(data, settings)
if errorhandler then
local currentresource = settings.currentresource
if currentresource and currentresource ~= "" then
- xml.errorhandler(format("load error in [%s]: %s",currentresource,errorstr))
+ xml.errorhandler(formatters["load error in [%s]: %s"](currentresource,errorstr))
else
- xml.errorhandler(format("load error: %s",errorstr))
+ xml.errorhandler(formatters["load error: %s"](errorstr))
end
end
end
@@ -923,7 +922,7 @@ local function verbose_element(e,handlers) -- options
local ats = eat and next(eat) and { }
if ats then
for k,v in next, eat do
- ats[#ats+1] = format('%s=%q',k,escaped(v))
+ ats[#ats+1] = formatters['%s=%q'](k,escaped(v))
end
end
if ern and trace_entities and ern ~= ens then
@@ -1053,7 +1052,7 @@ end
local handlers = { }
local function newhandlers(settings)
- local t = table.copy(handlers.verbose or { }) -- merge
+ local t = table.copy(handlers[settings and settings.parent or "verbose"] or { }) -- merge
if settings then
for k,v in next, settings do
if type(v) == "table" then
@@ -1177,7 +1176,7 @@ local xmlstringhandler = newhandlers {
local function xmltostring(root) -- 25% overhead due to collecting
if not root then
return ""
- elseif type(root) == 'string' then
+ elseif type(root) == "string" then
return root
else -- if next(root) then -- next is faster than type (and >0 test)
return serialize(root,xmlstringhandler) or ""
@@ -1315,7 +1314,7 @@ xml.tocdata(e,"error")
function xml.tocdata(e,wrapper) -- a few more in the aux module
local whatever = type(e) == "table" and xmltostring(e.dt) or e or ""
if wrapper then
- whatever = format("<%s>%s</%s>",wrapper,whatever,wrapper)
+ whatever = formatters["<%s>%s</%s>"](wrapper,whatever,wrapper)
end
local t = { special = true, ns = "", tg = "@cd@", at = { }, rn = "", dt = { whatever }, __p__ = e }
setmetatable(t,getmetatable(e))
diff --git a/tex/context/base/lxml-tex.lua b/tex/context/base/lxml-tex.lua
index f7de100b2..112f62751 100644
--- a/tex/context/base/lxml-tex.lua
+++ b/tex/context/base/lxml-tex.lua
@@ -750,37 +750,37 @@ function lxml.main(id)
xmlserialize(getid(id),xmltexhandler) -- the real root (@rt@)
end
---~ -- lines (untested)
---~
---~ local buffer = { }
---~
---~ local xmllinescapture = (
---~ newline^2 / function() buffer[#buffer+1] = "" end +
---~ newline / function() buffer[#buffer] = buffer[#buffer] .. " " end +
---~ content / function(s) buffer[#buffer] = buffer[#buffer] .. s end
---~ )^0
---~
---~ local xmllineshandler = table.copy(xmltexhandler)
---~
---~ xmllineshandler.handle = function(...) lpegmatch(xmllinescapture,concat{ ... }) end
---~
---~ function lines(root)
---~ if not root then
---~ -- rawroot = false
---~ -- quit
---~ elseif type(root) == 'string' then
---~ -- rawroot = false
---~ lpegmatch(xmllinescapture,root)
---~ elseif next(root) then -- tr == 'table'
---~ xmlserialize(root,xmllineshandler)
---~ end
---~ end
---~
---~ function xml.lines(root) -- used at all?
---~ buffer = { "" }
---~ lines(root)
---~ return result
---~ end
+-- -- lines (untested)
+--
+-- local buffer = { }
+--
+-- local xmllinescapture = (
+-- newline^2 / function() buffer[#buffer+1] = "" end +
+-- newline / function() buffer[#buffer] = buffer[#buffer] .. " " end +
+-- content / function(s) buffer[#buffer] = buffer[#buffer] .. s end
+-- )^0
+--
+-- local xmllineshandler = table.copy(xmltexhandler)
+--
+-- xmllineshandler.handle = function(...) lpegmatch(xmllinescapture,concat{ ... }) end
+--
+-- function lines(root)
+-- if not root then
+-- -- rawroot = false
+-- -- quit
+-- elseif type(root) == 'string' then
+-- -- rawroot = false
+-- lpegmatch(xmllinescapture,root)
+-- elseif next(root) then -- tr == 'table'
+-- xmlserialize(root,xmllineshandler)
+-- end
+-- end
+--
+-- function xml.lines(root) -- used at all?
+-- buffer = { "" }
+-- lines(root)
+-- return result
+-- end
local function to_text(e)
if e.command == nil then
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index aa7450545..d1d5c4328 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 44d672007..b97167234 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/status-mkiv.lua b/tex/context/base/status-mkiv.lua
index 32ae00cd3..cf41da58c 100644
--- a/tex/context/base/status-mkiv.lua
+++ b/tex/context/base/status-mkiv.lua
@@ -4541,6 +4541,18 @@ return {
},
{
category = "lua",
+ filename = "trac-xml",
+ loading = "mtxrun",
+ status = "okay",
+ },
+ {
+ category = "lua",
+ filename = "trac-exp",
+ loading = "mtxrun",
+ status = "okay",
+ },
+ {
+ category = "lua",
comment = "experimental code, will be redone when lua 5.2",
filename = "trac-pro",
loading = "luat-lib",
diff --git a/tex/context/base/trac-exp.lua b/tex/context/base/trac-exp.lua
new file mode 100644
index 000000000..d1ce3c458
--- /dev/null
+++ b/tex/context/base/trac-exp.lua
@@ -0,0 +1,190 @@
+if not modules then modules = { } end modules ['trac-exp'] = {
+ version = 1.001,
+ comment = "companion to trac-log.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local formatters = string.formatters
+local reporters = logs.reporters
+local xmlserialize = xml.serialize
+local xmlcollected = xml.collected
+local xmltext = xml.text
+local xmlfirst = xml.first
+local xmlfilter = xml.filter
+
+-- there is no need for a newhandlers { name = "help", parent = "string" }
+
+local function flagdata(flag)
+ local name = flag.at.name or ""
+ local value = flag.at.value or ""
+ -- local short = xmlfirst(s,"/short")
+ -- local short = xmlserialize(short,xs)
+ local short = xmltext(xmlfirst(flag,"/short")) or ""
+ return name, value, short
+end
+
+local function exampledata(example)
+ local command = xmltext(xmlfirst(example,"/command")) or ""
+ local comment = xmltext(xmlfirst(example,"/comment")) or ""
+ return command, comment
+end
+
+local function categorytitle(category)
+ return xmltext(xmlfirst(category,"/title")) or ""
+end
+
+local exporters = { }
+
+exporters.man = function(specification,...)
+ local root = xml.convert(specification.helpinfo or "")
+ if not root then
+ return
+ end
+ local xs = xml.gethandlers("string")
+ xml.sethandlersfunction(xs,"short",function(e,handler) xmlserialize(e.dt,handler) end)
+ xml.sethandlersfunction(xs,"ref", function(e,handler) handler.handle("--"..e.at.name) end)
+ local wantedcategories = select("#",...) == 0 and true or table.tohash { ... }
+ local nofcategories = xml.count(root,"/application/flags/category")
+ local name = xmlfilter(root,"/application/metadata/entry[@name='name']/text()")
+ local detail = xmlfilter(root,"/application/metadata/entry[@name='detail']/text()") or name
+ local version = xmlfilter(root,"/application/metadata/entry[@name='version']/text()") or "0.00"
+ local banner = specification.banner or detail or name
+ --
+ local result = { }
+ --
+ result[#result+1] = formatters['.TH %s\n.SH "NAME"\n%s.SH "SYNOPSIS"\n\\fB%s\\fP [ \\fIOPTIONS\\fP ... ]\n.SH "DESCRIPTION"\n%s\n'](
+ banner,name,name,detail
+ )
+ for category in xmlcollected(root,"/application/flags/category") do
+ if nofcategories > 1 then
+ result[#result+1] = formatters['.SH "OPTIONS: %s"'](string.upper(category.at.name or "all"))
+ else
+ result[#result+1] = '.SH "OPTIONS"'
+ end
+ for subcategory in xmlcollected(category,"/subcategory") do
+ for flag in xmlcollected(subcategory,"/flag") do
+ local name, value, short = flagdata(flag)
+ if value == "" then
+ result[#result+1] = formatters[".TP\n.B --%s\n%s"](name,short)
+ else
+ result[#result+1] = formatters[".TP\n.B --%s=%s\n%s"](name,value,short)
+ end
+ end
+ end
+ end
+ result[#result+1] = formatters['.SH "AUTHOR"\n%s'](specification.moreinfo)
+ return table.concat(result,"\n")
+end
+
+local craptemplate = [[
+<?xml version="1.0"?>
+<application>
+<metadata>
+<entry name="banner">%s</entry>
+</metadata>
+<verbose>
+%s
+</verbose>
+]]
+
+exporters.xml = function(specification,...)
+ local helpinfo = specification.helpinfo
+ if type(helpinfo) == "string" then
+ if string.find(helpinfo,"^<%?xml") then
+ return helpinfo
+ end
+ elseif type(helpinfo) == "table" then
+ helpinfo = table.concat(helpinfo,"\n\n")
+ else
+ helpinfo = "no help"
+ end
+ return formatters[craptemplate](specification.banner or "?",helpinfo)
+end
+
+local bodytemplate = [[
+<h1>Command line options</h1>
+<table>
+ <tr>
+ <th style="width: 10em">flag</th>
+ <th style="width: 8em">value</th>
+ <th>description</th>
+ </tr>
+ <?lua
+ for category in xml.collected(variables.root,"/application/flags/category") do
+ if variables.nofcategories > 1 then
+ ?><tr><th colspan="3"><?lua inject(category.at.name) ?></td></tr><?lua
+ end
+ for subcategory in xml.collected(category,"/subcategory") do
+ ?><tr><th/><td/><td/></tr><?lua
+ for flag in xml.collected(subcategory,"/flag") do
+ local name, value, short = variables.flagdata(flag)
+ ?>
+ <tr>
+ <th>--<?lua inject(name) ?></th>
+ <td><?lua inject(value) ?></td>
+ <td><?lua inject(short) ?></td>
+ </tr>
+ <?lua
+ end
+ end
+ end
+ ?>
+</table>
+<?lua
+ ?><br/><?lua
+ for category in xml.collected(variables.root,"/application/examples/category") do
+ local title = variables.categorytitle(category)
+ if title ~= "" then
+ ?><h1><?lua inject(title)?></h1><?lua
+ end
+ for subcategory in xml.collected(category,"/subcategory") do
+ for example in xml.collected(subcategory,"/example") do
+ local command, comment = variables.exampledata(example)
+ ?><tt><?lua inject(command) ?></tt><br/><?lua
+ end
+ ?><br/><?lua
+ end
+ end
+?>
+]]
+
+exporters.html = function(specification,...)
+ local root = xml.convert(specification.helpinfo or "")
+ if not root then
+ return
+ end
+ local xs = xml.gethandlers("string")
+ xml.sethandlersfunction(xs,"short",function(e,handler) xmlserialize(e.dt,handler) end)
+ xml.sethandlersfunction(xs,"ref", function(e,handler) handler.handle("--"..e.at.name) end)
+ local wantedcategories = select("#",...) == 0 and true or table.tohash { ... }
+ local nofcategories = xml.count(root,"/application/flags/category")
+ local name = xmlfilter(root,"/application/metadata/entry[@name='name']/text()")
+ local detail = xmlfilter(root,"/application/metadata/entry[@name='detail']/text()") or name
+ local version = xmlfilter(root,"/application/metadata/entry[@name='version']/text()") or "0.00"
+ local banner = specification.banner or detail or name
+ --
+ dofile(resolvers.findfile("trac-lmx.lua","tex"))
+ --
+ local htmltemplate = io.loaddata(resolvers.findfile("context-base.lmx","tex")) or "no template"
+ --
+ local body = lmx.convertstring(bodytemplate, {
+ nofcategories = nofcategories,
+ wantedcategories = wantedcategories,
+ root = root,
+ -- moreinfo = specification.moreinfo,
+ flagdata = flagdata,
+ exampledata = exampledata,
+ categorytitle = categorytitle,
+ })
+ local html = lmx.convertstring(htmltemplate, {
+ maintext = body,
+ title = banner,
+ bottomtext = "wiki: http://contextgarden.net | mail: ntg-context@ntg.nl | website: http://www.pragma-ade.nl",
+ })
+ --
+ return html
+end
+
+logs.exporters = exporters
diff --git a/tex/context/base/trac-log.lua b/tex/context/base/trac-log.lua
index 0b229c306..4f1d9ac01 100644
--- a/tex/context/base/trac-log.lua
+++ b/tex/context/base/trac-log.lua
@@ -84,7 +84,7 @@ local logs = logs
local moreinfo = [[
More information about ConTeXt and the tools that come with it can be found at:
-
+]] .. "\n" .. [[
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
wiki : http://contextgarden.net
@@ -633,11 +633,26 @@ function logs.help () end -- obsolete
-- applications
+-- local function reportlines(t,str)
+-- if str then
+-- for line in gmatch(str,"([^\n\r]*)[\n\r]") do
+-- t.report(line)
+-- end
+-- end
+-- end
+
+local Carg, C, lpegmatch = lpeg.Carg, lpeg.C, lpeg.match
+local p_newline = lpeg.patterns.newline
+
+local linewise = (
+ Carg(1) * C((1-p_newline)^1) / function(t,s) t.report(s) end
+ + Carg(1) * p_newline^2 / function(t) t.report() end
+ + p_newline
+)^1
+
local function reportlines(t,str)
if str then
- for line in gmatch(str,"(.-)[\n\r]") do
- t.report(line)
- end
+ lpegmatch(linewise,str,1,t)
end
end
@@ -661,8 +676,7 @@ local function reporthelp(t,...)
if type(helpinfo) == "string" then
reportlines(t,helpinfo)
elseif type(helpinfo) == "table" then
- local n = select("#",...)
- for i=1,n do
+ for i=1,select("#",...) do
reportlines(t,t.helpinfo[select(i,...)])
if i < n then
t.report()
@@ -673,16 +687,43 @@ end
local function reportinfo(t)
t.report()
- reportlines(t,moreinfo)
+ reportlines(t,t.moreinfo)
+end
+
+local function reportexport(t,method)
+ report(t.helpinfo)
end
+local reporters = {
+ lines = reportlines, -- not to be overloaded
+ banner = reportbanner,
+ version = reportversion,
+ help = reporthelp,
+ info = reportinfo,
+ export = reportexport,
+}
+
+logs.reporters = reporters
+
function logs.application(t)
t.name = t.name or "unknown"
t.banner = t.banner
+ t.moreinfo = moreinfo
t.report = logs.reporter(t.name)
- t.help = function(...) reportbanner(t) ; reporthelp(t,...) ; reportinfo(t) end
- t.identify = function() reportbanner(t) end
- t.version = function() reportversion(t) end
+ t.help = function(...)
+ reporters.banner(t)
+ reporters.help(t,...)
+ reporters.info(t)
+ end
+ t.export = function(...)
+ reporters.export(t,...)
+ end
+ t.identify = function()
+ reporters.banner(t)
+ end
+ t.version = function()
+ reporters.version(t)
+ end
return t
end
diff --git a/tex/context/base/trac-xml.lua b/tex/context/base/trac-xml.lua
new file mode 100644
index 000000000..e44f3c399
--- /dev/null
+++ b/tex/context/base/trac-xml.lua
@@ -0,0 +1,92 @@
+if not modules then modules = { } end modules ['trac-xml'] = {
+ version = 1.001,
+ comment = "companion to trac-log.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local formatters = string.formatters
+local reporters = logs.reporters
+local xmlserialize = xml.serialize
+local xmlcollected = xml.collected
+local xmltext = xml.text
+local xmlfirst = xml.first
+
+-- there is no need for a newhandlers { name = "help", parent = "string" }
+
+local function showhelp(specification,...)
+ local root = xml.convert(specification.helpinfo or "")
+ if not root then
+ return
+ end
+ local xs = xml.gethandlers("string")
+ xml.sethandlersfunction(xs,"short",function(e,handler) xmlserialize(e.dt,handler) end)
+ xml.sethandlersfunction(xs,"ref", function(e,handler) handler.handle("--"..e.at.name) end)
+ local wantedcategories = select("#",...) == 0 and true or table.tohash { ... }
+ local nofcategories = xml.count(root,"/application/flags/category")
+ local report = specification.report
+ for category in xmlcollected(root,"/application/flags/category") do
+ local categoryname = category.at.name or ""
+ if wantedcategories == true or wantedcategories[categoryname] then
+ if nofcategories > 1 then
+ report("%s options:",categoryname)
+ report()
+ end
+ for subcategory in xmlcollected(category,"/subcategory") do
+ for flag in xmlcollected(subcategory,"/flag") do
+ local name = flag.at.name
+ local value = flag.at.value
+ -- local short = xmlfirst(s,"/short")
+ -- local short = xmlserialize(short,xs)
+ local short = xmltext(xmlfirst(flag,"/short"))
+ if value then
+ report("--%-24s %s",formatters["%s=%s"](name,value),short)
+ else
+ report("--%-24s %s",name,short)
+ end
+ end
+ report()
+ end
+ end
+ end
+ for category in xmlcollected(root,"/application/examples/category") do
+ local title = xmltext(xmlfirst(category,"/title"))
+ if title and title ~= "" then
+ report()
+ report(title)
+ report()
+ end
+ for subcategory in xmlcollected(category,"/subcategory") do
+ for example in xmlcollected(subcategory,"/example") do
+ local command = xmltext(xmlfirst(example,"/command"))
+ local comment = xmltext(xmlfirst(example,"/comment"))
+ report(command)
+ end
+ report()
+ end
+ end
+end
+
+local reporthelp = reporters.help
+local exporthelp = reporters.export
+
+function reporters.help(t,...)
+ local helpinfo = t.helpinfo
+ if type(helpinfo) == "string" and string.find(helpinfo,"^<%?xml") then
+ showhelp(t,...)
+ else
+ reporthelp(t,...)
+ end
+end
+
+function reporters.export(t,method,filename)
+ dofile(resolvers.findfile("trac-exp.lua","tex"))
+ local exporters = logs.exporters
+ local result = method and exporters and exporters[method] and exporters[method](t,method) or exporthelp(t)
+ if type(filename) == "string" and filename ~= "" then
+ io.savedata(filename,result)
+ else
+ reporters.lines(t,result)
+ end
+end
diff --git a/tex/context/base/util-mrg.lua b/tex/context/base/util-mrg.lua
index 97a02e7cf..78b23dcbb 100644
--- a/tex/context/base/util-mrg.lua
+++ b/tex/context/base/util-mrg.lua
@@ -132,7 +132,7 @@ local function self_compact(data)
if merger.strip_comment then
local before = #data
data = lpegmatch(compact,data)
- data = lpegmatch(strip,data)
+ data = lpegmatch(strip,data) -- also strips in longstrings ... alas
-- data = string.strip(data)
local after = #data
delta = before - after
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index e2a6781ed..cf2316ac2 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 : 03/20/13 10:34:56
+-- merge date : 03/20/13 21:07:28
do -- begin closure to overcome local limits and interference