summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2016-04-16 16:06:47 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2016-04-16 16:06:47 +0200
commita104570ad82618ffffc82ffea3f12c5bb0a35232 (patch)
treef58dd337722644cc179ed4865aa0c1d6ca8b1b7b /scripts
parentdaff89c886893f6bf7d092e45b7f78d5395f6274 (diff)
downloadcontext-a104570ad82618ffffc82ffea3f12c5bb0a35232.tar.gz
2016-04-16 15:32:00
Diffstat (limited to 'scripts')
-rw-r--r--scripts/context/lua/mtx-fonts.lua4
-rw-r--r--scripts/context/lua/mtx-server-ctx-help.lua732
-rw-r--r--scripts/context/lua/mtxrun.lua6
-rw-r--r--scripts/context/stubs/mswin/contextjit.exebin0 -> 4608 bytes
-rw-r--r--scripts/context/stubs/mswin/mtxrun.lua6
-rw-r--r--scripts/context/stubs/unix/mtxrun6
-rw-r--r--scripts/context/stubs/win64/mtxrun.lua6
7 files changed, 420 insertions, 340 deletions
diff --git a/scripts/context/lua/mtx-fonts.lua b/scripts/context/lua/mtx-fonts.lua
index a83d8fc48..4411e268c 100644
--- a/scripts/context/lua/mtx-fonts.lua
+++ b/scripts/context/lua/mtx-fonts.lua
@@ -14,8 +14,8 @@ local suffix, addsuffix, removesuffix, replacesuffix = file.suffix, file.addsuff
local nameonly, basename, joinpath, collapsepath = file.nameonly, file.basename, file.join, file.collapsepath
local lower = string.lower
-local otfversion = 2.819
-local otlversion = 3.013
+local otfversion = 2.824
+local otlversion = 3.017
local helpinfo = [[
<?xml version="1.0"?>
diff --git a/scripts/context/lua/mtx-server-ctx-help.lua b/scripts/context/lua/mtx-server-ctx-help.lua
index 66051f794..0a3081428 100644
--- a/scripts/context/lua/mtx-server-ctx-help.lua
+++ b/scripts/context/lua/mtx-server-ctx-help.lua
@@ -6,153 +6,105 @@ if not modules then modules = { } end modules ['mtx-server-ctx-help'] = {
license = "see context related readme files"
}
--- todo in lua interface: noargument, oneargument, twoarguments, threearguments
--- todo: pickup translations from mult file
+local gsub, find, lower = string.gsub, string.find, string.lower
+local concat, sort = table.concat, table.sort
dofile(resolvers.findfile("trac-lmx.lua","tex"))
dofile(resolvers.findfile("util-sci.lua","tex"))
+dofile(resolvers.findfile("char-def.lua","tex"))
+dofile(resolvers.findfile("char-ini.lua","tex"))
+dofile(resolvers.findfile("char-utf.lua","tex"))
+
+local scite = utilities.scite
+local formatters = string.formatters
+local sortedkeys = table.sortedkeys
+local setmetatableindex = table.setmetatableindex
+local lowercase = characters.lower
+local uppercase = characters.upper
+local setupstrings = dofile(resolvers.findfile("mult-def.lua","tex")).setupstrings
+local report = logs.reporter("ctx-help")
+local gettime = os.gettimeofday or os.clock
+
+local xmlcollected = xml.collected
+local xmlfirst = xml.first
+local xmltext = xml.text
+local xmlload = xml.load
+
+document = document or { }
+document.setups = document.setups or { }
-local scite = utilities.scite
-
-local setupstrings = dofile(resolvers.findfile("mult-def.lua","tex")).setupstrings
-
--- problem ... serialize parent stack
-
-local format, match, gsub, find, lower = string.format, string.match, string.gsub, string.find, string.lower
-local concat, sort = table.concat, table.sort
-
-local formatters = string.formatters
-
-local report = logs.reporter("ctx-help")
-
--- -- -- make this a module: cont-xx.lua
+local f_divs_t = {
+ pe = formatters["<div dir='rtl' lang='arabic'>%s</div>"],
+}
-document = document or { }
-document.setups = document.setups or { }
+local f_spans_t = {
+ pe = formatters["<span dir='rtl' lang='arabic'>%s</span>"]
+}
-document.setups.div = {
- pe = "<div dir='rtl' lang='arabic'>%s</div>"
+local f_href_in_list_t = {
+ tex = formatters[ [[<a class="setupmenuurl" href='mtx-server-ctx-help.lua?command=%s&mode=%s'>%s</a>]] ],
+ lua = formatters[ [[<a class="setupmenuurl" href='mtx-server-ctx-help.lua?command=%s&mode=%s'>%s</a>]] ],
}
-document.setups.span = {
- pe = "<span dir='rtl' lang='arabic'>%s</span>"
+local f_href_as_command_t = {
+ tex = formatters[ [[<a class="setuplisturl" href='mtx-server-ctx-help.lua?command=%s&mode=%s'>\%s</a>]] ],
+ lua = formatters[ [[<a class="setuplisturl" href='mtx-server-ctx-help.lua?command=%s&mode=%s'>context.%s</a>]] ],
}
-document.setups.translations = table.setmetatableindex(setupstrings, {
- ["noargument"] = { en = "\\cs" },
- ["oneargument"] = { en = "\\cs#1{..}" },
- ["twoarguments"] = { en = "\\cs#1#2{..}{..}" },
- ["threearguments"] = { en = "\\cs#1#2#3{..}{..}{..}" },
-})
-
-document.setups.formats = {
- open_command = {
- tex = [[\%s]],
- lua = [[context.%s (]],
- },
- close_command = {
- tex = [[]],
- lua = [[ )]],
- },
- connector = {
- tex = [[]],
- lua = [[, ]],
- },
- href_in_list = {
- tex = [[<a href='mtx-server-ctx-help.lua?command=%s&mode=%s'>%s</a>]],
- lua = [[<a href='mtx-server-ctx-help.lua?command=%s&mode=%s'>%s</a>]],
- },
- href_as_command = {
- tex = [[<a href='mtx-server-ctx-help.lua?command=%s&mode=%s'>\%s</a>]],
- lua = [[<a href='mtx-server-ctx-help.lua?command=%s&mode=%s'>context.%s</a>]],
- },
- modes = {
- tex = [[<a href='mtx-server-ctx-help.lua?mode=lua'>lua mode</a>]],
- lua = [[<a href='mtx-server-ctx-help.lua?mode=tex'>tex mode</a>]],
- },
- optional_single = {
- tex = "[optional string %s]",
- lua = "{optional string %s}",
- },
- optional_list = {
- tex = "[optional list %s]",
- lua = "{optional table %s}" ,
- } ,
- mandate_single = {
- tex = "[mandate string %s]",
- lua = "{mandate string %s}",
- },
- mandate_list = {
- tex = "[mandate list %s]",
- lua = "{mandate list %s}",
- },
- interface = [[<a href='mtx-server-ctx-help.lua?interface=%s&mode=%s'>%s</a>]],
- source = [[<a href='mtx-server-ctx-help.lua?source=%s&mode=%s'>%s</a>]],
- parameter = [[<tr><td width='15%%'>%s</td><td width='15%%'>%s</td><td width='70%%'>%s</td></tr>]],
- parameters = [[<table width='100%%'>%s</table>]],
- listing = [[<pre><t>%s</t></listing>]],
- special = [[<i>%s</i>]],
- default = [[<u>%s</u>]],
+local s_modes_t = {
+ tex = [[<a class="setupmodeurl" href='mtx-server-ctx-help.lua?mode=lua'>lua mode</a>]],
+ lua = [[<a class="setupmodeurl" href='mtx-server-ctx-help.lua?mode=tex'>tex mode</a>]],
}
-local function translate(tag,int,noformat)
- local formats = document.setups.formats
- local translations = document.setups.translations
- local translation = translations[tag]
- local translated = translation and (translation[tag] or translation[tag]) or tag
+local f_interface = formatters[ [[<a href='mtx-server-ctx-help.lua?interface=%s&mode=%s'>%s</a>]] ]
+local f_source = formatters[ [[<a href='mtx-server-ctx-help.lua?source=%s&mode=%s'>%s</a>]] ]
+local f_keyword = formatters[ [[<tr><td width='15%%'>%s</td><td width='85%%' colspan='2'>%s</td></tr>]] ]
+local f_parameter = formatters[ [[<tr><td width='15%%'>%s</td><td width='15%%'>%s</td><td width='70%%'>%s</td></tr>]] ]
+local f_parameters = formatters[ [[<table width='100%%'>%s</table>]] ]
+local f_listing = formatters[ [[<pre><t>%s</t></listing>]] ]
+local f_special = formatters[ [[<i>%s</i>]] ]
+local f_url = formatters[ [[<tr><td width='15%%'>%s</td><td width='85%%' colspan='2'><i>%s</i>: %s</td></tr>]] ]
+local f_default = formatters[ [[<u>%s</u>]] ]
+
+local function translate(tag,int,noformat) -- to be checked
+ local translation = setupstrings[tag]
+ local translated = translation and (translation[tag] or translation[tag]) or tag
if noformat then
return translated
else
- return formatters[formats.special](translated)
+ return f_special(translated)
end
end
-local function translated(e,int)
- local formats = document.setups.formats
+local function translated(e,int) -- to be checked
local attributes = e.at
local s = attributes.type or "?"
- local tag = match(s,"^cd:(.*)$")
- if attributes.default == "yes" then
- return formatters[formats.default](tag or "?")
- elseif tag then
- return translate(tag,int)
+ if find(s,"^cd:") then
+ local t = setupstrings[s]
+ local f = t and (t[int] or t.en) or s
+ if attributes.default == "yes" then
+ return f_default(f)
+ elseif tag then
+ return f_default(f)
+ else
+ return f
+ end
else
- return s
- end
-end
-
-document.setups.loaded = document.setups.loaded or { }
-
-document.setups.current = { }
-document.setups.showsources = true
-document.setups.mode = "tex"
-
-function document.setups.load(filename)
- filename = resolvers.findfile(filename) or ""
- if filename ~= "" then
- local current = document.setups.loaded[filename]
- if not current then
- local loaded = xml.load(filename)
- if loaded then
- -- xml.inject(document.setups.root,"/",loaded)
- current = {
- file = filename,
- root = loaded,
- names = { },
- used = { },
- }
- document.setups.loaded[filename] = current
- end
+ if attributes.default == "yes" then
+ return f_default(translate(s,int) or "?")
+ elseif tag then
+ return translate(s,int)
+ else
+ return s
end
- document.setups.current = current or { }
end
end
-function document.setups.name(ek)
- local at = ek.at
+local function makename(e) -- to be checked
+ local at = e.at
local name = at.name
if at.type == 'environment' then
- name = "start" .. name
+ name = "start" .. name -- todo: elements.start
end
if at.variant then
name = name .. ":" .. at.variant
@@ -163,230 +115,358 @@ function document.setups.name(ek)
return lower(name)
end
-local function csname(ek,int)
+local function csname(e,int) -- to be checked
local cs = ""
- local at = ek.at or { }
+ local at = e.at
if at.type == 'environment' then
- cs = translate("start",int,true) .. cs
+ cs = "start" .. cs -- todo: elements.start
end
- local e = xml.first(ek,'cd:sequence/(cd:string|variable)')
- if e then
- if e.tg == "string" then
- cs = cs .. e.at.value
+ local f = xmlfirst(e,'cd:sequence/(cd:string|variable)')
+ if f then
+ if f.tg == "string" then
+ cs = cs .. f.at.value
else
- cs = cs .. e.at.value -- to be translated
+ cs = cs .. f.at.value -- to be translated
end
else
- cs = cs .. ek.at.name
+ cs = cs .. at.name
end
return cs
end
-document.setups.csname = csname
-
-function document.setups.names()
- local current = document.setups.current
- local names = current.names
- if not names or #names == 0 then
- local found = { }
- local name = document.setups.name
- names = { }
- for e in xml.collected(current.root,'cd:command') do
- local name = e.at.name
- local csname = csname(e,int)
- local done = found[csname]
- if not done then
- names[#names+1] = { name, csname }
- found[csname] = name
- else
- -- variant
- end
+local function getnames(root)
+ local found = { }
+ local names = { }
+ for e in xmlcollected(root,'cd:command') do
+ local name = e.at.name
+ local csname = csname(e,int)
+ if not found[csname] then
+ names[#names+1] = { name, csname }
+ found[csname] = name
+ else
+ -- variant
end
- sort(names, function(a,b) return lower(a[2]) < lower(b[2]) end)
- current.names = names -- can also become a hash
end
+ sort(names, function(a,b) return lower(a[2]) < lower(b[2]) end)
return names
end
-function document.setups.show(name)
- local current = document.setups.current
- if current.root then
- local name = gsub(name,"[<>]","")
- local setup = xml.first(current.root,"cd:command[@name='" .. name .. "']")
- current.used[#current.used+1] = setup
- xml.sprint(setup)
+local function getdefinitions(root)
+ local definitions = { }
+ for e in xmlcollected(root,"cd:define") do
+ definitions[e.at.name] = e
end
+ return definitions
end
-function document.setups.showused()
- local current = document.setups.current
- if current.root and next(current.used) then
- local sorted = table.sortedkeys(current.used)
- for i=1,#sorted do
- xml.sprint(current.used[sorted[i]])
- end
- end
-end
-function document.setups.showall()
- local current = document.setups.current
- if current.root then
- local list = { }
- for e in xml.collected(current.root,"cd:command") do
- list[document.setups.name(e)] = e
- end
- local sorted = table.sortedkeys(list)
- for i=1,#sorted do
- xml.sprint(list[sorted[i]])
+local loaded = setmetatableindex(function(loaded,interface)
+ local starttime = gettime()
+ local filename = formatters["context-%s.xml"](interface)
+ local fullname = resolvers.findfile(filename) or ""
+ local current = false
+ if fullname ~= "" then
+ local root = xmlload(fullname)
+ if root then
+ current = {
+ intercace = interface,
+ filename = filename,
+ fullname = fullname,
+ root = root,
+ names = getnames(root),
+ definitions = getdefinitions(root),
+ }
end
end
-end
-function document.setups.resolve(name)
- local current = document.setups.current
- if current.root then
- local e = xml.filter(current.root,formatters["cd:define[@name='%s']/text()"](name))
- if e then
- xml.sprint(e)
- end
+ if current then
+ report("data file %a loaded for interface %a in %0.3f seconds",filename,interface,gettime()-starttime)
+ else
+ report("no valid interface file for %a",interface)
end
-end
-
--- todo: cache definitions
+ loaded[filename] = current
+ return current
+end)
-function document.setups.collect(name,int,lastmode)
- local current = document.setups.current
- local formats = document.setups.formats
- local list = { }
- for command in xml.collected(current.root,formatters["cd:command[@name='%s']"](name)) do
+local function collect(current,name,int,lastmode)
+ local list = { }
+ for command in xmlcollected(current.root,formatters["cd:command[@name='%s']"](name)) do
local attributes = command.at or { }
local data = {
- command = command,
+ command = command,
category = attributes.category or "",
+ source = attributes.file and f_source(attributes.file,lastmode,attributes.file) or ""
}
- if document.setups.showsources then
- data.source = (attributes.file and formatters[formats.source](attributes.file,lastmode,attributes.file)) or ""
- else
- data.source = attributes.file or ""
+
+ local sequence = { }
+ local tags = { }
+ local arguments = { }
+ local tag = ""
+
+ local generated = attributes.generated == "yes"
+ local environment = attributes.type == "environment"
+
+ -- first pass: construct the top line
+
+ local start = environment and (attributes["begin"] or "start") or "" -- elements.start
+ local stop = environment and (attributes["end"] or "stop" ) or "" -- elements.stop
+ local name = attributes.name
+ local valid = true
+ local texmode = lastmode == "tex"
+
+ local first = xmlfirst(command,"/sequence")
+
+ if first then
+ name = xmltext(xmlfirst(first))
end
- local n, sequence, tags = 0, { }, { }
- sequence[#sequence+1] = formatters[formats.open_command[lastmode]](document.setups.csname(command,int))
- local arguments, tag = { }, ""
- for e in xml.collected(command,"(cd:keywords|cd:assignments)") do
- n = n + 1
- local attributes = e.at
- if #sequence > 1 then
- local c = formats.connector[lastmode]
- if c ~= "" then
- sequence[#sequence+1] = c
+
+ -- translate name
+
+ local function process(e)
+ for e in xmlcollected(e,"/*") do
+ if not e.special then
+ local tag = e.tg
+ local attributes = e.at
+ if tag == "resolve" then
+ local resolved = current.definitions[e.at.name or ""]
+ if resolved then
+ process(resolved)
+ end
+ else
+ -- we need a 'lua' tag i.e. we only support a subset of string/table
+ local delimiters = attributes.delimiters or "brackets"
+ local optional = attributes.optional == "yes"
+ local list = attributes.list == "yes"
+ if texmode then
+ local okay
+ if tag == "keywords" then
+ -- todo = optional
+ okay = setupstrings["cd:" .. delimiters .. (list and "-l" or "-s")]
+ elseif tag == "assignments" then
+ -- todo = optional
+ okay = setupstrings["cd:assignment" .. delimiters .. (list and "-l" or "-s")]
+ elseif tag == "delimiter" then
+ tag = "\\" .. attributes.name
+ elseif tag == "string" then
+ tag = attributes.value
+ else
+ -- todo = optional
+ okay = setupstrings["cd:" .. tag .. (list and "-l" or "-s")]
+ or setupstrings["cd:" .. tag]
+ end
+ if okay then
+ tag = okay.en or tag
+ end
+ else
+ local okay
+ if tag == "keywords" then
+ -- todo = optional
+ okay = setupstrings["cd:" .. delimiters .. (list and "-l" or "-s")]
+ elseif tag == "assignments" then
+ -- todo = optional
+ okay = setupstrings["cd:assignment" .. delimiters .. (list and "-l" or "-s")]
+ elseif tag == "delimiter" then
+ okay = false
+ elseif tag == "string" then
+ okay = false
+ else
+ -- todo = optional
+ okay = setupstrings["cd:" .. tag .. (list and "-l" or "-s")]
+ or setupstrings["cd:" .. tag]
+ end
+ if okay then
+ local luatag = okay.lua
+ if luatag then
+ tag = luatag
+ else
+ tag = "unsupported"
+ valid = false
+ end
+ else
+ tag = "unsupported"
+ valid = false
+ end
+ end
+ if tag then
+ sequence[#sequence+1] = tag
+ tags[#tags+1] = tag
+ end
+ end
end
+ end
+ end
+
+ if start and start ~= "" then
+ if texmode then
+ sequence[#sequence+1] = formatters["\\%s%s"](start,name)
+ else
+ sequence[#sequence+1] = formatters["context.%s%s("](start,name)
end
- if attributes.optional == 'yes' then
- if attributes.list == 'yes' then
- tag = formatters[formats.optional_list[lastmode]](n)
- else
- tag = formatters[formats.optional_single[lastmode]](n)
- end
+ else
+ if texmode then
+ sequence[#sequence+1] = formatters["\\%s"](name)
else
- if attributes.list == 'yes' then
- tag = formatters[formats.mandate_list[lastmode]](n)
- else
- tag = formatters[formats.mandate_single[lastmode]](n)
- end
+ sequence[#sequence+1] = formatters["context.%s("](name)
end
- sequence[#sequence+1] = tag
- tags[#tags+1] = tag
end
- sequence[#sequence+1] = formats.close_command[lastmode]
- data.sequence = concat(sequence, " ")
- local parameters, n = { }, 0
- local function process(e)
- for e in xml.collected(e,"(cd:keywords|cd:assignments|cd:resolve)") do
- n = n + 1
- local tag = e.tg
- if tag == "resolve" then
- local name = e.at.name or ""
- if name ~= "" then
- local resolved = xml.first(current.root,formatters["cd:define[@name='%s']"](name))
+ for e in xmlcollected(command,"/cd:arguments") do
+ process(e)
+ end
+
+ if texmode then
+ if stop and stop ~= "" then
+ sequence[#sequence+1] = "\\" .. stop .. name
+ end
+ else
+ for i=2,#sequence-1 do
+ sequence[i] = sequence[i] .. ", "
+ end
+
+ if stop and stop ~= "" then
+ sequence[#sequence+1] = formatters[") context.%s%s()"](stop,name)
+ else
+ sequence[#sequence+1] = ")"
+ end
+ end
+
+ if valid then
+
+ data.sequence = concat(sequence," ")
+
+ -- second pass: construct the descriptions
+
+ local parameters = { }
+ local n = 0
+
+ local function process(e)
+ for e in xmlcollected(e,"/*") do
+ local tag = e.tg
+
+ if tag == "resolve" then
+
+ local resolved = current.definitions[e.at.name or ""]
if resolved then
process(resolved)
end
- end
- elseif tag == "keywords" then
- local left = tags[n]
- local right = { }
- for e in xml.collected(e,"(cd:constant|cd:resolve)") do
- local tag = e.tg
- if tag == "resolve" then
- local name = e.at.name or ""
- if name ~= "" then
- local resolved = xml.first(current.root,formatters["cd:define[@name='%s']"](name))
- for e in xml.collected(resolved,"cd:constant") do
- right[#right+1] = translated(e,int)
- end
- end
- else
+
+ elseif tag == "keywords" then
+
+ n = n + 1
+ local left = tags[n]
+ local right = { }
+
+ local function processkeyword(e)
right[#right+1] = translated(e,int)
end
- end
- parameters[#parameters+1] = formatters[formats.parameter](left,"",concat(right, ", "))
- else
- local what = tags[n]
- for e in xml.collected(e,"(cd:parameter|cd:inherit|cd:resolve)") do
- local tag = e.tg
- local left = e.at.name or "?"
- local right = { }
- if tag == "resolve" then
- local name = e.at.name or ""
- if name ~= "" then
- local resolved = xml.first(current.root,formatters["cd:define[@name='%s']"](name))
- if resolved then
- process(resolved)
+
+ for e in xmlcollected(e,"/*") do
+ if not e.special then
+ local tag = e.tg
+ if tag == "resolve" then
+ local resolved = current.definitions[e.at.name or ""]
+ if resolved then
+ processkeyword(resolved)
+ end
+ elseif tag == "constant" then
+ processkeyword(e)
+ else
+ right[#right+1] = "KEYWORD TODO"
end
end
- elseif tag == "inherit" then
- local name = e.at.name or "?"
- local url = formatters[formats.href_as_command[lastmode]](name,lastmode,name)
- if #parameters > 0 and not find(parameters[#parameters],"<br/>") then
- parameters[#parameters+1] = formatters[formats.parameter]("<br/>","","")
+ end
+ parameters[#parameters+1] = f_keyword(left,concat(right, ", "))
+
+ elseif tag == "assignments" then
+
+ n = n + 1
+ local what = tags[n]
+ local done = false
+
+ local function processparameter(e,right)
+ for e in xmlcollected(e,"/*") do
+ if not e.special then
+ local tag = e.tg
+ if tag == "resolve" then
+ local resolved = current.definitions[e.at.name or ""]
+ if resolved then
+ processparameter(resolved,right)
+ end
+ elseif tag == "constant" then
+ right[#right+1] = translated(e,int)
+ else
+ right[#right+1] = "PARAMETER TODO"
+ end
+ end
end
- parameters[#parameters+1] = formatters[formats.parameter](what,formatters[formats.special](translate("inherits",int)),url)
- else
- for e in xml.collected(e,"(cd:constant|cd:resolve)") do
- local tag = e.tg
+ end
+
+ for e in xmlcollected(e,"/*") do
+ if not e.special then
+ local tag = e.tg
+ local left = e.at.name or "?"
+ local right = { }
if tag == "resolve" then
- local name = e.at.name or ""
- if name ~= "" then
- local resolved = xml.first(current.root,formatters["cd:define[@name='%s']"](name))
- for e in xml.collected(resolved,"cd:constant") do
- right[#right+1] = translated(e,int)
- end
+ local resolved = current.definitions[e.at.name or ""]
+ if resolved then
+ -- todo
+ process(resolved)
end
+ elseif tag == "inherit" then
+ local name = e.at.name or "?"
+ local url = f_href_as_command_t[lastmode](name,lastmode,name)
+ parameters[#parameters+1] = f_url(what,translate("inherits",int),url)
+ elseif tag == "parameter" then
+ processparameter(e,right)
+ parameters[#parameters+1] = f_parameter(what,left,concat(right, ", "))
else
- right[#right+1] = translated(e,int)
+ parameters[#parameters+1] = "PARAMETER TODO"
+ end
+ if not done then
+ done = true
+ what = ""
end
end
- parameters[#parameters+1] = formatters[formats.parameter](what,left,concat(right, ", "))
end
+
what = ""
+ else
+
+ n = n + 1
+ local left = tags[n]
+ local right = setupstrings["cd:"..tag]
+
+ if right then
+ right = uppercase(right[int] or right.en or tag)
+ end
+
+ parameters[#parameters+1] = f_keyword(left,right)
+
end
end
- parameters[#parameters+1] = formatters[formats.parameter]("<br/>","","")
end
+
+ for e in xmlcollected(command,"/cd:arguments") do
+ process(e)
+ end
+
+ data.parameters = parameters
+ else
+ if texmode then
+ data.sequence = formatters["unsupported command '%s%s'"](start or "",name)
+ else
+ data.sequence = formatters["unsupported function '%s%s'"](start or "",name)
+ end
+ data.parameters = { }
end
- process(command)
- data.parameters = parameters or { }
- data.mode = formats.modes[lastmode or "tex"]
+
+ data.mode = s_modes_t[lastmode or "tex"]
list[#list+1] = data
+
end
return list
end
-- -- --
-tex = tex or { }
-
--- -- --
-
local interfaces = {
czech = 'cz',
dutch = 'nl',
@@ -398,8 +478,6 @@ local interfaces = {
romanian = 'ro',
}
-local lastinterface, lastcommand, lastsource, lastmode = "en", "", "", "tex"
-
local variables = {
['color-background-main-left'] = '#3F3F3F',
['color-background-main-right'] = '#5F5F5F',
@@ -408,68 +486,59 @@ local variables = {
['title'] = 'ConTeXt Help Information',
}
---~ function lmx.loadedfile(filename)
---~ return io.loaddata(resolvers.findfile(filename)) -- return resolvers.texdatablob(filename)
---~ end
-
local what = { "environment", "category", "source", "mode" }
-local function doit(configuration,filename,hashed)
+local function generate(configuration,filename,hashed)
- local start = os.clock()
+ local start = gettime()
local detail = hashed.queries or { }
- local formats = document.setups.formats
if detail then
- lastinterface = detail.interface or lastinterface
- lastcommand = detail.command or lastcommand
- lastsource = detail.source or lastsource
- lastmode = detail.mode or lastmode or "tex"
+ local lastinterface = detail.interface or "en"
+ local lastcommand = detail.command or ""
+ local lastsource = detail.source or ""
+ local lastmode = detail.mode or "tex"
+
+ local current = loaded[lastinterface]
lastcommand = gsub(lastcommand,"%s*^\\*(.+)%s*","%1")
- if lastinterface then
- report("checking interface: %s",lastinterface)
- -- document.setups.load(formatters["cont-%s.xml"](lastinterface))
- document.setups.load(formatters["context-%s.xml"](lastinterface))
- end
+ local f_div = f_divs_t[lastinterface]
+ ----- f_span = f_spans[lastinterface]
- local div = document.setups.div [lastinterface]
- local span = document.setups.span[lastinterface]
+ local names = current.names
+ local refs = { }
+ local ints = { }
- local names, refs, ints = document.setups.names(lastinterface), { }, { }
for k=1,#names do
local v = names[k]
- refs[k] = formatters[formats.href_in_list[lastmode]](v[1],lastmode,v[2])
+ refs[k] = f_href_in_list_t[lastmode](v[1],lastmode,v[2])
end
+
if lastmode ~= "lua" then
- local sorted = table.sortedkeys(interfaces)
+ local sorted = sortedkeys(interfaces)
for k=1,#sorted do
local v = sorted[k]
- ints[k] = formatters[formats.interface](interfaces[v],lastmode,v)
+ ints[k] = f_interface(interfaces[v],lastmode,v)
end
end
local n = concat(refs,"<br/>")
local i = concat(ints,"<br/><br/>")
- if div then
- variables.names = formatters[div](n)
- variables.interfaces = formatters[div](i)
+ if f_div then
+ variables.names = f_div(n)
+ variables.interfaces = f_div(i)
else
variables.names = n
variables.interfaces = i
end
- -- first we need to add information about mkii/mkiv
+ -- we only support mkiv
- variables.maintitle = "no definition"
- variables.maintext = ""
- variables.extra = ""
+ if lastsource and lastsource ~= "" then
- if document.setups.showsources and lastsource and lastsource ~= "" then
- -- todo: mkii, mkiv, tex (can be different)
local name = lastsource
local full = resolvers.findfile(name)
if full == "" and file.suffix(lastsource) == "tex" then
@@ -482,16 +551,20 @@ local function doit(configuration,filename,hashed)
end
if full == "" then
variables.maintitle = lastsource
- variables.maintext = formatters[formats.listing]("no source found")
+ variables.maintext = f_listing("no source found")
else
local data = io.loaddata(full)
data = scite.html(data,file.suffix(full),true)
variables.maintitle = name
- variables.maintext = formatters[formats.listing](data)
+ variables.maintext = f_listing(data)
end
- lastsource = ""
+ lastsource = ""
+ variables.extra = "mode: " .. s_modes_t.tex .. " " .. s_modes_t.lua
+
elseif lastcommand and lastcommand ~= "" then
- local list = document.setups.collect(lastcommand,lastinterface,lastmode)
+
+
+ local list = collect(current,lastcommand,lastinterface,lastmode)
if list and #list > 0 then
local data = list[1]
local extra = { }
@@ -503,11 +576,18 @@ local function doit(configuration,filename,hashed)
end
end
variables.maintitle = data.sequence
- variables.maintext = formatters[formats.parameters](concat(data.parameters))
+ variables.maintext = f_parameters(concat(data.parameters))
variables.extra = concat(extra,"&nbsp;&nbsp;&nbsp;")
else
- variables.maintext = "select command"
+ variables.maintitle = "no command"
+ variables.maintext = "select command"
+ variables.extra = ""
end
+
+ else
+ variables.maintitle = "no definition"
+ variables.maintext = ""
+ variables.extra = ""
end
else
@@ -520,9 +600,9 @@ local function doit(configuration,filename,hashed)
local content = lmx.convert('context-help.lmx',false,variables)
- report("time spent on page: %0.03f seconds",os.clock()-start)
+ report("time spent on building page: %0.03f seconds",gettime()-start)
return { content = content }
end
-return doit, true
+return generate, true
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index 5cb5f6356..2249c154f 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -8765,7 +8765,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-inf"] = package.loaded["trac-inf"] or true
--- original size: 6916, stripped down to: 5484
+-- original size: 6917, stripped down to: 5484
if not modules then modules={} end modules ['trac-inf']={
version=1.001,
@@ -18735,8 +18735,8 @@ end -- of closure
-- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 796598
--- stripped bytes : 288945
+-- original bytes : 796599
+-- stripped bytes : 288946
-- end library merge
diff --git a/scripts/context/stubs/mswin/contextjit.exe b/scripts/context/stubs/mswin/contextjit.exe
new file mode 100644
index 000000000..0e7882cf9
--- /dev/null
+++ b/scripts/context/stubs/mswin/contextjit.exe
Binary files differ
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index 5cb5f6356..2249c154f 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -8765,7 +8765,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-inf"] = package.loaded["trac-inf"] or true
--- original size: 6916, stripped down to: 5484
+-- original size: 6917, stripped down to: 5484
if not modules then modules={} end modules ['trac-inf']={
version=1.001,
@@ -18735,8 +18735,8 @@ end -- of closure
-- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 796598
--- stripped bytes : 288945
+-- original bytes : 796599
+-- stripped bytes : 288946
-- end library merge
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index 5cb5f6356..2249c154f 100644
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -8765,7 +8765,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-inf"] = package.loaded["trac-inf"] or true
--- original size: 6916, stripped down to: 5484
+-- original size: 6917, stripped down to: 5484
if not modules then modules={} end modules ['trac-inf']={
version=1.001,
@@ -18735,8 +18735,8 @@ end -- of closure
-- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 796598
--- stripped bytes : 288945
+-- original bytes : 796599
+-- stripped bytes : 288946
-- end library merge
diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua
index 5cb5f6356..2249c154f 100644
--- a/scripts/context/stubs/win64/mtxrun.lua
+++ b/scripts/context/stubs/win64/mtxrun.lua
@@ -8765,7 +8765,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-inf"] = package.loaded["trac-inf"] or true
--- original size: 6916, stripped down to: 5484
+-- original size: 6917, stripped down to: 5484
if not modules then modules={} end modules ['trac-inf']={
version=1.001,
@@ -18735,8 +18735,8 @@ end -- of closure
-- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 796598
--- stripped bytes : 288945
+-- original bytes : 796599
+-- stripped bytes : 288946
-- end library merge