summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/buff-imp-default.lua2
-rw-r--r--tex/context/base/char-ini.lua38
-rw-r--r--tex/context/base/char-tex.lua20
-rw-r--r--tex/context/base/cldf-prs.lua88
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4436 -> 4432 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/core-con.lua33
-rw-r--r--tex/context/base/core-env.mkiv6
-rw-r--r--tex/context/base/core-uti.lua27
-rw-r--r--tex/context/base/data-env.lua2
-rw-r--r--tex/context/base/data-res.lua81
-rw-r--r--tex/context/base/data-tre.lua67
-rw-r--r--tex/context/base/file-ini.lua8
-rw-r--r--tex/context/base/file-ini.mkvi2
-rw-r--r--tex/context/base/file-job.mkvi8
-rw-r--r--tex/context/base/grph-inc.lua43
-rw-r--r--tex/context/base/l-lpeg.lua1
-rw-r--r--tex/context/base/l-unicode.lua32
-rw-r--r--tex/context/base/lxml-aux.lua12
-rw-r--r--tex/context/base/page-mix.mkiv2
-rw-r--r--tex/context/base/publ-dat.lua3
-rw-r--r--tex/context/base/publ-fnd.lua33
-rw-r--r--tex/context/base/publ-imp-apa.mkvi23
-rw-r--r--tex/context/base/publ-tra.lua4
-rw-r--r--tex/context/base/status-files.pdfbin24922 -> 24924 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin249917 -> 326283 bytes
-rw-r--r--tex/context/base/syst-aux.lua11
-rw-r--r--tex/context/base/syst-aux.mkiv4
-rw-r--r--tex/context/base/util-dim.lua95
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
31 files changed, 411 insertions, 240 deletions
diff --git a/tex/context/base/buff-imp-default.lua b/tex/context/base/buff-imp-default.lua
index 72a49d625..79f01c47d 100644
--- a/tex/context/base/buff-imp-default.lua
+++ b/tex/context/base/buff-imp-default.lua
@@ -20,7 +20,7 @@ local grammar = { "visualizer",
beginline = makepattern(handler,"beginline",patterns.beginline),
newline = makepattern(handler,"newline", patterns.newline),
space = makepattern(handler,"space", patterns.space),
- default = makepattern(handler,"default", patterns.utf8char),
+ default = makepattern(handler,"default", patterns.utf8character),
content = makepattern(handler,"default", patterns.somecontent), -- not too efficient
-- handy
diff --git a/tex/context/base/char-ini.lua b/tex/context/base/char-ini.lua
index a2505c0eb..e5806622c 100644
--- a/tex/context/base/char-ini.lua
+++ b/tex/context/base/char-ini.lua
@@ -22,7 +22,7 @@ if not characters then require("char-def") end
local lpegpatterns = lpeg.patterns
local lpegmatch = lpeg.match
local utf8byte = lpegpatterns.utf8byte
-local utf8char = lpegpatterns.utf8char
+local utf8character = lpegpatterns.utf8character
local utfchartabletopattern = lpeg.utfchartabletopattern
@@ -879,13 +879,13 @@ end
----- toupper = Cs((utf8byte/ucchars)^0)
----- toshape = Cs((utf8byte/shchars)^0)
-local tolower = Cs((utf8char/lcchars)^0) -- no need to check spacing
-local toupper = Cs((utf8char/ucchars)^0) -- no need to check spacing
-local toshape = Cs((utf8char/shchars)^0) -- no need to check spacing
+local tolower = Cs((utf8character/lcchars)^0) -- no need to check spacing
+local toupper = Cs((utf8character/ucchars)^0) -- no need to check spacing
+local toshape = Cs((utf8character/shchars)^0) -- no need to check spacing
-lpegpatterns.tolower = tolower
-lpegpatterns.toupper = toupper
-lpegpatterns.toshape = toshape
+lpegpatterns.tolower = tolower -- old ones ... will be overloaded
+lpegpatterns.toupper = toupper -- old ones ... will be overloaded
+lpegpatterns.toshape = toshape -- old ones ... will be overloaded
-- function characters.lower (str) return lpegmatch(tolower,str) end
-- function characters.upper (str) return lpegmatch(toupper,str) end
@@ -931,13 +931,25 @@ for k, v in next, characters.data do
-- end
end
-local utf8lower = Cs((utfchartabletopattern(lhash) / lhash + utf8char)^0)
-local utf8upper = Cs((utfchartabletopattern(uhash) / uhash + utf8char)^0)
-local utf8shape = Cs((utfchartabletopattern(shash) / shash + utf8char)^0)
+local utf8lowercharacter = utfchartabletopattern(lhash) / lhash
+local utf8uppercharacter = utfchartabletopattern(uhash) / uhash
+local utf8shapecharacter = utfchartabletopattern(shash) / shash
-lpegpatterns.utf8lower = utf8lower
-lpegpatterns.utf8upper = utf8upper
-lpegpatterns.utf8shape = utf8shape
+local utf8lower = Cs((utf8lowercharacter + utf8character)^0)
+local utf8upper = Cs((utf8uppercharacter + utf8character)^0)
+local utf8shape = Cs((utf8shapecharacter + utf8character)^0)
+
+lpegpatterns.utf8lowercharacter = utf8lowercharacter -- one character
+lpegpatterns.utf8uppercharacter = utf8uppercharacter -- one character
+lpegpatterns.utf8shapecharacter = utf8shapecharacter -- one character
+
+lpegpatterns.utf8lower = utf8lower -- string
+lpegpatterns.utf8upper = utf8upper -- string
+lpegpatterns.utf8shape = utf8shape -- string
+
+characters.lhash = lhash -- nil if no conversion
+characters.uhash = uhash -- nil if no conversion
+characters.shash = shash -- nil if no conversion
function characters.lower (str) return lpegmatch(utf8lower,str) end
function characters.upper (str) return lpegmatch(utf8upper,str) end
diff --git a/tex/context/base/char-tex.lua b/tex/context/base/char-tex.lua
index a9a760c7a..3aba53986 100644
--- a/tex/context/base/char-tex.lua
+++ b/tex/context/base/char-tex.lua
@@ -18,8 +18,6 @@ local P, C, R, S, V, Cs, Cc = lpeg.P, lpeg.C, lpeg.R, lpeg.S, lpeg.V, lpeg.Cs, l
local lpegpatterns = lpeg.patterns
local lpegmatch = lpeg.match
-local utf8byte = lpegpatterns.utf8byte
-local utf8char = lpegpatterns.utf8char
local utfchartabletopattern = lpeg.utfchartabletopattern
local allocate = utilities.storage.allocate
@@ -44,19 +42,6 @@ local trace_defining = false trackers.register("characters.defining", fu
local report_defining = logs.reporter("characters")
-
-
-
-
-
-
-
-
-
-
-
-
-
--[[ldx--
<p>In order to deal with 8-bit output, we need to find a way to go from <l n='utf'/> to
8-bit. This is handled in the <l n='luatex'/> engine itself.</p>
@@ -426,6 +411,11 @@ function texcharacters.defineaccents()
end
end
+if not context or not commands then
+ -- used in e.g. mtx-bibtex
+ return
+end
+
-- all kind of initializations
local tex = tex
diff --git a/tex/context/base/cldf-prs.lua b/tex/context/base/cldf-prs.lua
index 1554b5e57..f9fccd832 100644
--- a/tex/context/base/cldf-prs.lua
+++ b/tex/context/base/cldf-prs.lua
@@ -12,58 +12,54 @@ local lpegmatch, patterns = lpeg.match, lpeg.patterns
local P, R, V, Cc, Cs = lpeg.P, lpeg.R, lpeg.V, lpeg.Cc, lpeg.Cs
local format = string.format
-local cpatterns = patterns.context or { }
-patterns.context = cpatterns
+local cpatterns = patterns.context or { }
+patterns.context = cpatterns
-local utf8char = patterns.utf8char
-local cardinal = patterns.cardinal
+local utf8character = patterns.utf8character
+local cardinal = patterns.cardinal
-local leftbrace = P("{")
-local rightbrace = P("}")
-local backslash = P("\\")
-local csname = backslash * P(1) * (1-backslash-leftbrace)^0 * P(" ")^0
-local sign = P("+") / "\\textplus "
- + P("-") / "\\textminus "
-local nested = P { leftbrace * (V(1) + (1-rightbrace))^0 * rightbrace }
-local subscript = P("_")
-local superscript = P("^")
+local leftbrace = P("{")
+local rightbrace = P("}")
+local backslash = P("\\")
+local csname = backslash * P(1) * (1-backslash-leftbrace)^0 * P(" ")^0
+local sign = P("+") / "\\textplus "
+ + P("-") / "\\textminus "
+local nested = P { leftbrace * (V(1) + (1-rightbrace))^0 * rightbrace }
+local subscript = P("_")
+local superscript = P("^")
--- local scripts = P { "start",
--- start = V("csname") + V("lowfirst") + V("highfirst"),
--- csname = csname,
--- content = Cs(V("csname") + nested + sign^-1 * (cardinal + utf8char)),
--- lowfirst = subscript * ( Cc("\\lohi{%s}{%s}") * V("content") * superscript + Cc("\\low{%s}" ) ) * V("content") / format,
--- highfirst = superscript * ( Cc("\\hilo{%s}{%s}") * V("content") * subscript + Cc("\\high{%s}") ) * V("content") / format,
--- }
+-- local scripts = P { "start",
+-- start = V("csname") + V("lowfirst") + V("highfirst"),
+-- csname = csname,
+-- content = Cs(V("csname") + nested + sign^-1 * (cardinal + utf8character)),
+-- lowfirst = subscript * ( Cc("\\lohi{%s}{%s}") * V("content") * superscript + Cc("\\low{%s}" ) ) * V("content") / format,
+-- highfirst = superscript * ( Cc("\\hilo{%s}{%s}") * V("content") * subscript + Cc("\\high{%s}") ) * V("content") / format,
+-- }
--- local scripts = P { "start",
--- start = (V("csname") + V("lowfirst") + V("highfirst"))^1,
--- csname = csname,
--- content = Cs(V("csname") + nested + sign^-1 * (cardinal + utf8char)),
--- lowfirst = (subscript /"") * ( Cc("\\lohi{") * V("content") * Cc("}{") * (superscript/"") + Cc("\\low{" ) ) * V("content") * Cc("}"),
--- highfirst = (superscript/"") * ( Cc("\\hilo{") * V("content") * Cc("}{") * (subscript /"") + Cc("\\high{") ) * V("content") * Cc("}"),
--- }
+-- local scripts = P { "start",
+-- start = (V("csname") + V("lowfirst") + V("highfirst"))^1,
+-- csname = csname,
+-- content = Cs(V("csname") + nested + sign^-1 * (cardinal + utf8character)),
+-- lowfirst = (subscript /"") * ( Cc("\\lohi{") * V("content") * Cc("}{") * (superscript/"") + Cc("\\low{" ) ) * V("content") * Cc("}"),
+-- highfirst = (superscript/"") * ( Cc("\\hilo{") * V("content") * Cc("}{") * (subscript /"") + Cc("\\high{") ) * V("content") * Cc("}"),
+-- }
-local scripted = Cs { "start",
- start = (V("csname") + V("nested") + V("lowfirst") + V("highfirst") + V("utf8char"))^1,
- rest = V("csname") + V("nested") + V("lowfirst") + V("highfirst"),
- csname = csname,
- utf8char = utf8char,
- -- nested = leftbrace * (V("rest") + (V("utf8char")-rightbrace))^0 * rightbrace,
- nested = leftbrace * (V("start") -rightbrace)^0 * rightbrace,
- content = Cs(V("nested") + sign^-1 * (cardinal + V("utf8char"))),
- content = V("nested") + sign^-1 * (cardinal + V("utf8char")),
- lowfirst = (subscript /"") * ( Cc("\\lohi{") * V("content") * Cc("}{") * (superscript/"") + Cc("\\low{" ) ) * V("content") * Cc("}"),
- highfirst = (superscript/"") * ( Cc("\\hilo{") * V("content") * Cc("}{") * (subscript /"") + Cc("\\high{") ) * V("content") * Cc("}"),
- }
+local scripted = Cs { "start",
+ start = (V("csname") + V("nested") + V("lowfirst") + V("highfirst") + V("character"))^1,
+ rest = V("csname") + V("nested") + V("lowfirst") + V("highfirst"),
+ csname = csname,
+ character = utf8character,
+ -- nested = leftbrace * (V("rest") + (V("character")-rightbrace))^0 * rightbrace,
+ nested = leftbrace * (V("start") -rightbrace)^0 * rightbrace,
+ content = Cs(V("nested") + sign^-1 * (cardinal + V("character"))),
+ content = V("nested") + sign^-1 * (cardinal + V("character")),
+ lowfirst = (subscript /"") * ( Cc("\\lohi{") * V("content") * Cc("}{") * (superscript/"") + Cc("\\low{" ) ) * V("content") * Cc("}"),
+ highfirst = (superscript/"") * ( Cc("\\hilo{") * V("content") * Cc("}{") * (subscript /"") + Cc("\\high{") ) * V("content") * Cc("}"),
+ }
-
--- local scripted = Cs((scripts))
-
--- cpatterns.scripts = scripts
-cpatterns.csname = csname
-cpatterns.scripted = scripted
-cpatterns.nested = nested
+cpatterns.csname = csname
+cpatterns.scripted = scripted
+cpatterns.nested = nested
-- print(lpegmatch(scripted,"10^-3_x"))
-- print(lpegmatch(scripted,"\\L {C_5}"))
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index c21e50c86..b87b4d5cd 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{2014.07.07 17:48}
+\newcontextversion{2014.07.09 10:26}
%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 171f98b51..73fc6286d 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 2e5cc632b..24c3c8244 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -28,7 +28,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2014.07.07 17:48}
+\edef\contextversion{2014.07.09 10:26}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/core-con.lua b/tex/context/base/core-con.lua
index 99f8fc652..343485ed2 100644
--- a/tex/context/base/core-con.lua
+++ b/tex/context/base/core-con.lua
@@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['core-con'] = {
license = "see context related readme files"
}
+-- todo: split into char-lan.lua and core-con.lua
+
--[[ldx--
<p>This module implements a bunch of conversions. Some are more
efficient than their <l n='tex'/> counterpart, some are even
@@ -979,17 +981,28 @@ end
-- These are just helpers but not really for the tex end. Do we have to
-- use translate here?
-local character = lpeg.patterns.utf8character
local whitespace = lpeg.patterns.whitespace
-local word = (character-whitespace) / characters.upper * (character-whitespace)^1
-local spacing = whitespace^1
-local pattern_one = Cs(word * P(1)^1)
-local pattern_all = Cs((word + spacing)^1)
-
-function converters.word (s) return s end
-function converters.words(s) return s end
-function converters.Word (s) return lpegmatch(pattern_one,s) end
-function converters.Words(s) return lpegmatch(pattern_all,s) end
+local word = lpeg.patterns.utf8uppercharacter^-1 * (1-whitespace)^1
+local pattern_one = Cs(whitespace^0 * word^-1 * P(1)^1)
+local pattern_all = Cs((whitespace^1 + word)^1)
+
+function converters.word (s) return s end -- dummies for typos
+function converters.words(s) return s end -- dummies for typos
+function converters.Word (s) return lpegmatch(pattern_one,s) or s end
+function converters.Words(s) return lpegmatch(pattern_all,s) or s end
+
+converters.upper = characters.upper
+converters.lower = characters.lower
+
+-- print(converters.Word("foo bar"))
+-- print(converters.Word(" foo bar"))
+-- print(converters.Word("123 foo bar"))
+-- print(converters.Word(" 123 foo bar"))
+
+-- print(converters.Words("foo bar"))
+-- print(converters.Words(" foo bar"))
+-- print(converters.Words("123 foo bar"))
+-- print(converters.Words(" 123 foo bar"))
-- --
diff --git a/tex/context/base/core-env.mkiv b/tex/context/base/core-env.mkiv
index 30fc83b4b..01d127d2f 100644
--- a/tex/context/base/core-env.mkiv
+++ b/tex/context/base/core-env.mkiv
@@ -149,7 +149,11 @@
\rawprocesscommacommand[#1]\syst_modes_define_indeed}
\def\syst_modes_define_indeed#1%
- {\syst_modes_new{#1}%
+ {\ifcsname\??mode#1\endcsname
+ % already set
+ \else
+ \syst_modes_new{#1}
+ \fi
\ifx\m_modes_asked\v!keep
% not changes, disabled when undefined
\else
diff --git a/tex/context/base/core-uti.lua b/tex/context/base/core-uti.lua
index 1903ad823..d172eb05f 100644
--- a/tex/context/base/core-uti.lua
+++ b/tex/context/base/core-uti.lua
@@ -65,6 +65,7 @@ job.comment("version",job.version)
local enabled = true
directives.register("job.save",function(v) enabled = v end)
+----------.register("job.keep",function(v) kept = v end)
function job.disablesave() -- can be command
enabled = false
@@ -74,6 +75,9 @@ function job.initialize(loadname,savename)
job.load(loadname) -- has to come after structure is defined !
luatex.registerstopactions(function()
if enabled and not status.lasterrorstring or status.lasterrorstring == "" then
+ -- if kept then
+ -- job.keep(loadname) -- could move to mtx-context instead
+ -- end
job.save(savename)
end
end)
@@ -283,6 +287,28 @@ function job.loadother(filename)
statistics.stoptiming(_load_)
end
+-- function job.keep(filename)
+-- local suffix = file.suffix(filename)
+-- local base = file.removesuffix(filename)
+-- if suffix == "" then
+-- suffix = "tuc"
+-- end
+-- for i=1,10 do
+-- local tmpname = format("%s-%s-%02d.tmp",base,suffix,i)
+-- if lfs.isfile(tmpname) then
+-- os.remove(tmpname)
+-- report_passes("removing %a",tmpname)
+-- end
+-- end
+-- if lfs.isfile(filename) then
+-- local tmpname = format("%s-%s-%02d.tmp",base,suffix,environment.currentrun or 1)
+-- report_passes("copying %a into %a",filename,tmpname)
+-- file.copy(filename,tmpname)
+-- else
+-- report_passes("no file %a, nothing kept",filename)
+-- end
+-- end
+
-- eventually this will end up in strc-ini
statistics.register("startup time", function()
@@ -352,6 +378,5 @@ function statistics.formatruntime(runtime)
end
end
-
commands.savevariable = job.variables.save
commands.setjobcomment = job.comment
diff --git a/tex/context/base/data-env.lua b/tex/context/base/data-env.lua
index 90b031b0f..03a382e7b 100644
--- a/tex/context/base/data-env.lua
+++ b/tex/context/base/data-env.lua
@@ -96,7 +96,7 @@ local relations = allocate { -- todo: handlers also here
tex = {
names = { "tex" },
variable = 'TEXINPUTS',
- suffixes = { 'tex', "mkvi", "mkiv", "mkii" },
+ suffixes = { "tex", "mkvi", "mkiv", "mkii", "cld", "lfg", "xml" }, -- known suffixes have less lookups
},
icc = {
names = { "icc", "icc profile", "icc profiles" },
diff --git a/tex/context/base/data-res.lua b/tex/context/base/data-res.lua
index 844a0601f..a22aea27f 100644
--- a/tex/context/base/data-res.lua
+++ b/tex/context/base/data-res.lua
@@ -761,45 +761,47 @@ function resolvers.registerextrapath(paths,subpaths)
end
end
-local function made_list(instance,list)
+local function made_list(instance,list,extra_too)
+ if not extra_too then
+ return list
+ end
local ep = instance.extra_paths
if not ep or #ep == 0 then
return list
- else
- local done, new, newn = { }, { }, 0
- -- honour . .. ../.. but only when at the start
- for k=1,#list do
- local v = list[k]
- if not done[v] then
- if find(v,"^[%.%/]$") then
- done[v] = true
- newn = newn + 1
- new[newn] = v
- else
- break
- end
- end
- end
- -- first the extra paths
- for k=1,#ep do
- local v = ep[k]
- if not done[v] then
+ end
+ local done, new, newn = { }, { }, 0
+ -- honour . .. ../.. but only when at the start
+ for k=1,#list do
+ local v = list[k]
+ if not done[v] then
+ if find(v,"^[%.%/]$") then
done[v] = true
newn = newn + 1
new[newn] = v
+ else
+ break
end
end
- -- next the formal paths
- for k=1,#list do
- local v = list[k]
- if not done[v] then
- done[v] = true
- newn = newn + 1
- new[newn] = v
- end
+ end
+ -- first the extra paths
+ for k=1,#ep do
+ local v = ep[k]
+ if not done[v] then
+ done[v] = true
+ newn = newn + 1
+ new[newn] = v
+ end
+ end
+ -- next the formal paths
+ for k=1,#list do
+ local v = list[k]
+ if not done[v] then
+ done[v] = true
+ newn = newn + 1
+ new[newn] = v
end
- return new
end
+ return new
end
function resolvers.cleanpathlist(str)
@@ -816,7 +818,7 @@ function resolvers.expandpath(str)
return joinpath(resolvers.expandedpathlist(str))
end
-function resolvers.expandedpathlist(str)
+function resolvers.expandedpathlist(str,extra_too)
if not str then
return { }
elseif instance.savelists then
@@ -824,14 +826,14 @@ function resolvers.expandedpathlist(str)
local lists = instance.lists
local lst = lists[str]
if not lst then
- local l = made_list(instance,resolvers.splitpath(resolvers.expansion(str)))
+ local l = made_list(instance,resolvers.splitpath(resolvers.expansion(str)),extra_too)
lst = expandedpathfromlist(l)
lists[str] = lst
end
return lst
else
local lst = resolvers.splitpath(resolvers.expansion(str))
- return made_list(instance,expandedpathfromlist(lst))
+ return made_list(instance,expandedpathfromlist(lst),extra_too)
end
end
@@ -1138,7 +1140,7 @@ end
local function find_intree(filename,filetype,wantedfiles,allresults)
local typespec = resolvers.variableofformat(filetype)
- local pathlist = resolvers.expandedpathlist(typespec)
+ local pathlist = resolvers.expandedpathlist(typespec,filetype=="tex") -- only extra path with user files
local method = "intree"
if pathlist and #pathlist > 0 then
-- list search
@@ -1261,6 +1263,19 @@ local function find_intree(filename,filetype,wantedfiles,allresults)
else
-- no access needed for non existing path, speedup (esp in large tree with lots of fake)
end
+ else
+ -- we can have extra_paths that are urls
+ for k=1,#wantedfiles do
+ -- independent url scanner
+ local fname = methodhandler('finders',pathname .. "/" .. wantedfiles[k])
+ if fname then
+ result[#result+1] = fname
+ doen = true
+ if not allresults then
+ break
+ end
+ end
+ end
end
end
-- todo recursive scanning
diff --git a/tex/context/base/data-tre.lua b/tex/context/base/data-tre.lua
index 044e205c5..58e44c23b 100644
--- a/tex/context/base/data-tre.lua
+++ b/tex/context/base/data-tre.lua
@@ -21,7 +21,7 @@ if not modules then modules = { } end modules ['data-tre'] = {
local find, gsub, lower = string.find, string.gsub, string.lower
local basename, dirname, joinname = file.basename, file.dirname, file .join
-local globdir, isdir = dir.glob, lfs.isdir
+local globdir, isdir, isfile = dir.glob, lfs.isdir, lfs.isfile
local P, lpegmatch = lpeg.P, lpeg.match
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
@@ -115,8 +115,29 @@ table.setmetatableindex(collectors, function(t,k)
return content
end)
-function resolvers.finders.dirlist(specification) -- can be called directly too
+
+local function checked(root,p,n)
+ if p then
+ if type(p) == "table" then
+ for i=1,#p do
+ local fullname = joinname(root,p[i],n)
+ if isfile(fullname) then -- safeguard
+ return fullname
+ end
+ end
+ else
+ local fullname = joinname(root,p,n)
+ if isfile(fullname) then -- safeguard
+ return fullname
+ end
+ end
+ end
+ return notfound()
+end
+
+local function resolve(specification) -- can be called directly too
local filename = specification.filename
+ -- print(filename) -- in case we want to check for unwanted lookups
if filename ~= "" then
local root, rest = lpegmatch(splitter,filename)
if root and rest then
@@ -133,42 +154,60 @@ function resolvers.finders.dirlist(specification) -- can be called directly too
for i=1,#p do
local pi = p[i]
if pi == path or find(pi,pattern) then
- return joinname(root,pi,n)
+ local fullname = joinname(root,pi,n)
+ if isfile(fullname) then -- safeguard
+ return fullname
+ end
end
end
- else
- if p == path or find(p,pattern) then
- return joinname(root,p,n)
+ elseif p == path or find(p,pattern) then
+ local fullname = joinname(root,p,n)
+ if isfile(fullname) then -- safeguard
+ return fullname
end
end
local queries = specification.queries
if queries and queries.option == "fileonly" then
- return joinname(root,istable and p[1] or p,n)
+ return checked(root,p,n)
+ else
+ return notfound()
end
- return notfound()
end
end
local path, name = dirname(filename), basename(filename)
local root = lpegmatch(stripper,path)
local content = collectors[path]
local p, n = lookup(content,name)
- if not p then
- return notfound()
- elseif type(p) == "table" then
- -- maybe a warning that the first name is taken
- p = p[1]
+ if p then
+ return checked(root,p,n)
end
- return joinname(root,p,n)
end
return notfound()
end
+resolvers.finders .dirlist = resolve
resolvers.locators .dirlist = resolvers.locators .tree
resolvers.hashers .dirlist = resolvers.hashers .tree
resolvers.generators.dirlist = resolvers.generators.file
resolvers.openers .dirlist = resolvers.openers .file
resolvers.loaders .dirlist = resolvers.loaders .file
+function resolvers.finders.dirfile(specification)
+ local queries = specification.queries
+ if queries then
+ queries.option = "fileonly"
+ else
+ specification.queries = { option = "fileonly" }
+ end
+ return resolve(specification)
+end
+
+resolvers.locators .dirfile = resolvers.locators .dirlist
+resolvers.hashers .dirfile = resolvers.hashers .dirlist
+resolvers.generators.dirfile = resolvers.generators.dirlist
+resolvers.openers .dirfile = resolvers.openers .dirlist
+resolvers.loaders .dirfile = resolvers.loaders .dirlist
+
-- local locate = collectors[ [[E:\temporary\mb-mp]] ]
-- local locate = collectors( [[\\storage-2\resources\mb-mp]] )
diff --git a/tex/context/base/file-ini.lua b/tex/context/base/file-ini.lua
index 3314bb33d..e6acc9e5d 100644
--- a/tex/context/base/file-ini.lua
+++ b/tex/context/base/file-ini.lua
@@ -34,6 +34,10 @@ function commands.doifparentfileelse(n)
end
function commands.doiffileexistelse(name)
- local foundname = resolvers.findtexfile(name)
- commands_doifelse(foundname and foundname ~= "")
+ name = resolvers.findtexfile(name)
+ commands_doifelse(name and name ~= "")
+end
+
+function commands.doifpathexistelse(name)
+ commands_doifelse(lfs.isdir(name))
end
diff --git a/tex/context/base/file-ini.mkvi b/tex/context/base/file-ini.mkvi
index 989241dd1..633407fe2 100644
--- a/tex/context/base/file-ini.mkvi
+++ b/tex/context/base/file-ini.mkvi
@@ -135,8 +135,10 @@
%D \stoptyping
\def\doiffileexistselse#name{\ctxcommand{doiffileexistelse([[#name]])}}
+\def\doifpathexistselse#name{\ctxcommand{doifpathexistelse([[#name]])}}
\def\doiffileelse {\doiffileexistselse}
+\def\doifpathelse {\doifpathexistselse}
\def\doiffile #name{\doiffileexistselse{#name}\firstofoneargument\gobbleoneargument}
\def\doifnotfile #name{\doiffileexistselse{#name}\gobbleoneargument\firstofoneargument}
diff --git a/tex/context/base/file-job.mkvi b/tex/context/base/file-job.mkvi
index 5f646ed28..243a8d856 100644
--- a/tex/context/base/file-job.mkvi
+++ b/tex/context/base/file-job.mkvi
@@ -45,6 +45,14 @@
\unexpanded\def\locatefilepath#name% no [] ?
{\edef\locatedfilepath{\ctxcommand{locatefilepath("#name")}}}
+% % maybe:
+%
+% % \dirlist{c:/data/temporary/foo}{images/bar.jpg}
+% % \dirfile{c:/data/temporary/foo}{images/bar.jpg}
+%
+% \def\dirlist#1#2{dirlist://#1/**/#2}
+% \def\dirfile#1#2{dirlist://#1/**/#2?option=fileonly}
+
% zip files are tree'd
\unexpanded\def\usezipfile
diff --git a/tex/context/base/grph-inc.lua b/tex/context/base/grph-inc.lua
index d89c52996..a32773ecb 100644
--- a/tex/context/base/grph-inc.lua
+++ b/tex/context/base/grph-inc.lua
@@ -6,6 +6,7 @@ if not modules then modules = { } end modules ['grph-inc'] = {
license = "see context related readme files"
}
+-- todo: files are sometimes located twice
-- todo: empty filename or only suffix always false (not found)
-- lowercase types
-- mps tex tmp svg
@@ -552,6 +553,9 @@ local function register(askedname,specification)
report_inclusion("no converter for %a to %a",format,newformat)
end
if converter then
+ --
+ -- todo: outline as helper function
+ --
local oldname = specification.fullname
local newpath = file.dirname(oldname)
local oldbase = file.basename(oldname)
@@ -641,19 +645,21 @@ local function register(askedname,specification)
end
end
end
- local found = figures_suffixes[format] -- validtypes[format]
- if not found then
- specification.found = false
- if trace_figures then
- report_inclusion("format %a is not supported",format)
- end
- else
- specification.found = true
- if trace_figures then
- if validtypes[format] then -- format?
- report_inclusion("format %a natively supported by backend",format)
- else
- report_inclusion("format %a supported by output file format",format)
+ if format then
+ local found = figures_suffixes[format] -- validtypes[format]
+ if not found then
+ specification.found = false
+ if trace_figures then
+ report_inclusion("format %a is not supported",format)
+ end
+ else
+ specification.found = true
+ if trace_figures then
+ if validtypes[format] then -- format?
+ report_inclusion("format %a natively supported by backend",format)
+ else
+ report_inclusion("format %a supported by output file format",format)
+ end
end
end
end
@@ -697,6 +703,7 @@ local function locate(request) -- name, format, cache
askedname = path
end
else
+-- local fname = methodhandler('finders',pathname .. "/" .. wantedfiles[k])
local foundname = resolvers.findbinfile(askedname)
if not foundname or not lfs.isfile(foundname) then -- foundname can be dummy
if trace_figures then
@@ -1011,11 +1018,15 @@ end
function existers.generic(askedname,resolve)
-- not findbinfile
local result
- if lfs.isfile(askedname) then
+ if url.hasscheme(askedname) then
+ result = resolvers.findbinfile(askedname)
+ elseif lfs.isfile(askedname) then
result = askedname
elseif resolve then
- result = resolvers.findbinfile(askedname) or ""
- if result == "" then result = false end
+ result = resolvers.findbinfile(askedname)
+ end
+ if not result or result == "" then
+ result = false
end
if trace_figures then
if result then
diff --git a/tex/context/base/l-lpeg.lua b/tex/context/base/l-lpeg.lua
index 79e75a7b7..f3fd28b1d 100644
--- a/tex/context/base/l-lpeg.lua
+++ b/tex/context/base/l-lpeg.lua
@@ -499,7 +499,6 @@ function lpeg.finder(lst,makefunction,isutf) -- beware: slower than find with 'p
pattern = P(lst)
end
if isutf then
--- pattern = ((utf8char or 1)-pattern)^0 * pattern
pattern = ((utf8char or 1)-pattern)^0 * pattern
else
pattern = (1-pattern)^0 * pattern
diff --git a/tex/context/base/l-unicode.lua b/tex/context/base/l-unicode.lua
index be61f3d73..fb4ea37fa 100644
--- a/tex/context/base/l-unicode.lua
+++ b/tex/context/base/l-unicode.lua
@@ -34,25 +34,29 @@ local type = type
local char, byte, format, sub, gmatch = string.char, string.byte, string.format, string.sub, string.gmatch
local concat = table.concat
local P, C, R, Cs, Ct, Cmt, Cc, Carg, Cp = lpeg.P, lpeg.C, lpeg.R, lpeg.Cs, lpeg.Ct, lpeg.Cmt, lpeg.Cc, lpeg.Carg, lpeg.Cp
-local lpegmatch, patterns = lpeg.match, lpeg.patterns
-local bytepairs = string.bytepairs
+local lpegmatch = lpeg.match
+local patterns = lpeg.patterns
+local tabletopattern = lpeg.utfchartabletopattern
-local finder = lpeg.finder
-local replacer = lpeg.replacer
+local bytepairs = string.bytepairs
-local utfvalues = utf.values
-local utfgmatch = utf.gmatch -- not always present
+local finder = lpeg.finder
+local replacer = lpeg.replacer
+
+local utfvalues = utf.values
+local utfgmatch = utf.gmatch -- not always present
local p_utftype = patterns.utftype
local p_utfstricttype = patterns.utfstricttype
local p_utfoffset = patterns.utfoffset
-local p_utf8char = patterns.utf8char
+local p_utf8char = patterns.utf8character
local p_utf8byte = patterns.utf8byte
local p_utfbom = patterns.utfbom
local p_newline = patterns.newline
local p_whitespace = patterns.whitespace
+
if not unicode then
unicode = { utf = utf } -- for a while
@@ -510,8 +514,20 @@ end
-- a replacement for simple gsubs:
+-- function utf.remapper(mapping)
+-- local pattern = Cs((p_utf8char/mapping)^0)
+-- return function(str)
+-- if not str or str == "" then
+-- return ""
+-- else
+-- return lpegmatch(pattern,str)
+-- end
+-- end, pattern
+-- end
+
function utf.remapper(mapping)
- local pattern = Cs((p_utf8char/mapping)^0)
+ local pattern = type(mapping) == "table" and tabletopattern(mapping) or p_utf8char
+ local pattern = Cs((pattern/mapping + p_utf8char)^0)
return function(str)
if not str or str == "" then
return ""
diff --git a/tex/context/base/lxml-aux.lua b/tex/context/base/lxml-aux.lua
index b3f1684e7..3f502df44 100644
--- a/tex/context/base/lxml-aux.lua
+++ b/tex/context/base/lxml-aux.lua
@@ -364,10 +364,9 @@ xml.injectafter = inject_element
xml.injectbefore = function(r,p,e) inject_element(r,p,e,true) end
local function include(xmldata,pattern,attribute,recursive,loaddata)
- -- parse="text" (default: xml), encoding="" (todo)
- -- attribute = attribute or 'href'
- pattern = pattern or 'include'
- loaddata = loaddata or io.loaddata
+ -- attribute = attribute or 'href'
+ pattern = pattern or 'include'
+ loaddata = loaddata or io.loaddata
local collected = xmlapplylpath(xmldata,pattern)
if collected then
for c=1,#collected do
@@ -386,16 +385,13 @@ local function include(xmldata,pattern,attribute,recursive,loaddata)
if name then break end
end
end
- local data = (name and name ~= "" and loaddata(name)) or ""
+ local data = name and name ~= "" and loaddata(name) or ""
if data == "" then
epdt[ek.ni] = "" -- xml.empty(d,k)
elseif ekat["parse"] == "text" then
-- for the moment hard coded
epdt[ek.ni] = xml.escaped(data) -- d[k] = xml.escaped(data)
else
---~ local settings = xmldata.settings
---~ settings.parent_root = xmldata -- to be tested
---~ local xi = xmlconvert(data,settings)
local xi = xmlinheritedconvert(data,xmldata)
if not xi then
epdt[ek.ni] = "" -- xml.empty(d,k)
diff --git a/tex/context/base/page-mix.mkiv b/tex/context/base/page-mix.mkiv
index 57de14b88..0fe56d970 100644
--- a/tex/context/base/page-mix.mkiv
+++ b/tex/context/base/page-mix.mkiv
@@ -554,6 +554,8 @@
% needs packaging anyway
\setbox\scratchbox\page_mix_command_package_column
\page_marks_synchronize_column\plusone\c_page_mix_n_of_columns\recurselevel\scratchbox
+ % backgrounds
+\anch_mark_column_box\scratchbox
% for the moment a quick and dirty patch .. we need to go into the box (hence the \plusone) .. a slowdowner
\page_lines_add_numbers_to_box\scratchbox\recurselevel\c_page_mix_n_of_columns\plusone
% the framed needs a reset of strut, align, setups etc
diff --git a/tex/context/base/publ-dat.lua b/tex/context/base/publ-dat.lua
index 986ef75c2..1823b33c2 100644
--- a/tex/context/base/publ-dat.lua
+++ b/tex/context/base/publ-dat.lua
@@ -16,8 +16,7 @@ in a convenient way. Actually handling the data takes place elsewhere.</p>
--ldx]]--
if not characters then
- dofile(resolvers.findfile("char-def.lua"))
- dofile(resolvers.findfile("char-ini.lua"))
+ dofile(resolvers.findfile("char-utf.lua"))
dofile(resolvers.findfile("char-tex.lua"))
end
diff --git a/tex/context/base/publ-fnd.lua b/tex/context/base/publ-fnd.lua
index 14d65a244..f9afd5fd0 100644
--- a/tex/context/base/publ-fnd.lua
+++ b/tex/context/base/publ-fnd.lua
@@ -8,8 +8,7 @@ if not modules then modules = { } end modules ['publ-fnd'] = {
if not characters then
dofile(resolvers.findfile("char-def.lua"))
- dofile(resolvers.findfile("char-ini.lua"))
- dofile(resolvers.findfile("char-tex.lua"))
+ dofile(resolvers.findfile("char-utf.lua"))
end
if not publications then
@@ -18,7 +17,7 @@ end
local tonumber, next, type = tonumber, next, type
local P, R, C, Cs, Cp, Cc, Carg = lpeg.P, lpeg.R, lpeg.C, lpeg.Cs, lpeg.Cp, lpeg.Cc, lpeg.Carg
-local lpegmatch = lpeg.match
+local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns
local concat = table.concat
local formatters = string.formatters
@@ -30,11 +29,11 @@ local colon = P(":")
local dash = P("-")
local lparent = P("(")
local rparent = P(")")
-local space = lpeg.patterns.whitespace
+local space = lpegpatterns.whitespace
local valid = 1 - colon - space - lparent - rparent
----- key = C(valid^1)
local key = C(R("az","AZ")^1)
-local word = Cs(lpeg.patterns.unquoted + valid^1)
+local word = Cs(lpegpatterns.unquoted + lpegpatterns.argument + valid^1)
local number = C(valid^1)
----- f_string_key = formatters[" local s_%s = entry[%q]"]
@@ -75,21 +74,23 @@ local pattern = Cs(Cc("(") * (P("match")/"" * p_match)^1 * Cc(")"))
-- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- --
-local tolower = lpeg.patterns.tolower
-local lower = string.lower
-
-local allascii = R("\000\127")^1 * P(-1)
-
-function characters.checkedlower(str)
- return lpegmatch(allascii,str) and lower(str) or lpegmatch(tolower,str) or str
-end
+-- no longer faster
+--
+-- local tolower = lpegpatterns.tolower
+-- local lower = string.lower
+--
+-- local allascii = R("\000\127")^1 * P(-1)
+--
+-- function characters.checkedlower(str)
+-- return lpegmatch(allascii,str) and lower(str) or lpegmatch(tolower,str) or str
+-- end
-- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- --
local f_template = string.formatters[ [[
local find = string.find
-local lower = characters.checkedlower
+local lower = characters.lower
return function(entry)
%s
return %s and true or false
@@ -120,6 +121,10 @@ local function compile(expr)
return false
end
+-- compile([[match(key:"foo bar")]])
+-- compile([[match(key:'foo bar')]])
+-- compile([[match(key:{foo bar})]])
+
local cache = { } -- todo: make weak, or just remember the last one (trial typesetting)
local check = P("match") -- * space^0 * Cp()
diff --git a/tex/context/base/publ-imp-apa.mkvi b/tex/context/base/publ-imp-apa.mkvi
index cbec80365..08724a5f9 100644
--- a/tex/context/base/publ-imp-apa.mkvi
+++ b/tex/context/base/publ-imp-apa.mkvi
@@ -29,6 +29,7 @@
[apa:mastersthesis={Master's thesis},
apa:phdthesis={PhD thesis},
apa:technicalreport={Technical report},
+ apa:patent=patent,
apa:editor=editor,
apa:editors=editors,
apa:edition=edition,
@@ -50,6 +51,7 @@
[apa:mastersthesis={Thèse de master (DEA, DESS, master)},
apa:phdthesis={Thèse de doctorat},
apa:technicalreport={Rapport technique},
+ apa:patent=brevet,
apa:editor=éditeur,
apa:editors=éditeurs,
apa:edition=édition,
@@ -71,6 +73,7 @@
[apa:mastersthesis={Masterarbeit},
apa:phdthesis={Dissertation},
apa:technicalreport={Technischer Bericht},
+ apa:patent=Patent,
apa:editor=Herausgeber,
apa:editors=Herausgeber,
apa:edition=Auflage,
@@ -740,6 +743,26 @@
\texdefinition{btx:apa:note}
\stopsetups
+\startsetups btx:apa:patent
+ \texdefinition{btx:apa:author-and-year}
+ \btxdoif {title} {
+ \btxspace
+ \texdefinition{btx:apa:italic}{converters.Word -> title}
+ }
+ \btxdoif {nationality} {
+ \btxspace
+ \btxflush{nationality}
+ }
+ \btxspace
+ \btxlabeltext{apa:patent}
+ \btxdoif {number} {
+ \btxspace
+ \btxflush{number}
+ }
+ \texdefinition{btx:apa:wherefrom}{publisher}
+ \texdefinition{btx:apa:note}
+\stopsetups
+
\startsetups btx:apa:misc
\texdefinition{btx:apa:author-and-year}
\texdefinition{btx:apa:title-and-series}
diff --git a/tex/context/base/publ-tra.lua b/tex/context/base/publ-tra.lua
index 1cbbf3383..0b7e840c8 100644
--- a/tex/context/base/publ-tra.lua
+++ b/tex/context/base/publ-tra.lua
@@ -146,6 +146,10 @@ local categories = {
required = { "author", "title", "institution", "year" },
optional = { "type", "number", "address", "month", "note" },
},
+ patent = {
+ required = { "nationality", "number", "year", "yearfiled" },
+ optional = { "author", "title", "language", "assignee", "address", "type", "day", "dayfiled", "month", "monthfiled", "note", },
+ },
unpublished = {
required = { "author", "title", "note" },
optional = { "month", "year" },
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index a37c74d32..8541081c8 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 6f309ed57..5160a3765 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/syst-aux.lua b/tex/context/base/syst-aux.lua
index de15428f9..e645bb3b9 100644
--- a/tex/context/base/syst-aux.lua
+++ b/tex/context/base/syst-aux.lua
@@ -13,15 +13,16 @@ if not modules then modules = { } end modules ['syst-aux'] = {
local commands, context = commands, context
+local tonumber = tonumber
local settings_to_array = utilities.parsers.settings_to_array
local format = string.format
local utfsub = utf.sub
-local P, S, C, Cc, Cs, Carg, lpegmatch, utf8char = lpeg.P, lpeg.S, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Carg, lpeg.match, lpeg.patterns.utf8char
-
+local P, S, C, Cc, Cs, Carg, lpegmatch, utf8character = lpeg.P, lpeg.S, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Carg, lpeg.match, lpeg.patterns.utf8character
+local todimen = number.todimen
local setvalue = context.setvalue
-local pattern = C(utf8char^-1) * C(P(1)^0)
+local pattern = C(utf8character^-1) * C(P(1)^0)
function commands.getfirstcharacter(str)
local first, rest = lpegmatch(pattern,str)
@@ -38,7 +39,7 @@ function commands.theremainingcharacters(str)
context(rest)
end
-local pattern = C(utf8char^-1)
+local pattern = C(utf8character^-1)
function commands.doiffirstcharelse(chr,str)
commands.doifelse(lpegmatch(pattern,str) == chr)
@@ -114,3 +115,5 @@ local upper, lower, strip = utf.upper, utf.lower, string.strip
function commands.upper(s) context(upper(s)) end
function commands.lower(s) context(lower(s)) end
function commands.strip(s) context(strip(s)) end
+
+function commands.converteddimen(dimen,unit) context(todimen(dimen,unit or "pt","%0.5f")) end -- no unit appended
diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv
index 2288223af..3642d6753 100644
--- a/tex/context/base/syst-aux.mkiv
+++ b/tex/context/base/syst-aux.mkiv
@@ -7000,6 +7000,10 @@
%def\getsubstring#1#2#3{\cldcontext{utf.sub([[#3]],tonumber("#1"),tonumber("#2"))}}
\def\getsubstring#1#2#3{\ctxcommand{getsubstring(\!!bs#3\!!es,"#1","#2")}}
+%D Other dimensions that pt:
+
+% \def\converteddimen#1#2{\ctxcommand{converteddimen(\number\dimexpr#1,"#2")}}
+
\protect \endinput
% \edef\choicetokenyes{+}
diff --git a/tex/context/base/util-dim.lua b/tex/context/base/util-dim.lua
index 69061495f..bfffb1010 100644
--- a/tex/context/base/util-dim.lua
+++ b/tex/context/base/util-dim.lua
@@ -24,13 +24,15 @@ local formatters = string.formatters
local texget = tex and tex.get or function() return 65536*10*100 end
+local p_stripzeros = lpeg.patterns.stripzeros
+
--this might become another namespace
number = number or { }
local number = number
-number.tonumberf = function(n) return match(format("%.20f",n),"(.-0?)0*$") end -- one zero too much but alas
-number.tonumberg = function(n) return format("%.20g",n) end
+number.tonumberf = function(n) return lpegmatch(p_stripzeros,format("%.20f",n)) end
+number.tonumberg = function(n) return format("%.20g",n) end
local dimenfactors = allocate {
["pt"] = 1/65536,
@@ -46,66 +48,65 @@ local dimenfactors = allocate {
["nc"] = ( 5080/65043)/65536
}
---~ print(table.serialize(dimenfactors))
---~
---~ %.99g:
---~
---~ t={
---~ ["bp"]=1.5201782378580324e-005,
---~ ["cc"]=1.1883696112892098e-006,
---~ ["cm"]=5.3628510057769479e-007,
---~ ["dd"]=1.4260435335470516e-005,
---~ ["em"]=0.000152587890625,
---~ ["ex"]=6.103515625e-005,
---~ ["in"]=2.1113586636917117e-007,
---~ ["mm"]=5.3628510057769473e-008,
---~ ["nc"]=1.1917446679504327e-006,
---~ ["nd"]=1.4300936015405194e-005,
---~ ["pc"]=1.2715657552083333e-006,
---~ ["pt"]=1.52587890625e-005,
---~ ["sp"]=1,
---~ }
---~
---~ patched %s and tonumber
---~
---~ t={
---~ ["bp"]=0.00001520178238,
---~ ["cc"]=0.00000118836961,
---~ ["cm"]=0.0000005362851,
---~ ["dd"]=0.00001426043534,
---~ ["em"]=0.00015258789063,
---~ ["ex"]=0.00006103515625,
---~ ["in"]=0.00000021113587,
---~ ["mm"]=0.00000005362851,
---~ ["nc"]=0.00000119174467,
---~ ["nd"]=0.00001430093602,
---~ ["pc"]=0.00000127156576,
---~ ["pt"]=0.00001525878906,
---~ ["sp"]=1,
---~ }
+-- print(table.serialize(dimenfactors))
+--
+-- %.99g:
+--
+-- t={
+-- ["bp"]=1.5201782378580324e-005,
+-- ["cc"]=1.1883696112892098e-006,
+-- ["cm"]=5.3628510057769479e-007,
+-- ["dd"]=1.4260435335470516e-005,
+-- ["em"]=0.000152587890625,
+-- ["ex"]=6.103515625e-005,
+-- ["in"]=2.1113586636917117e-007,
+-- ["mm"]=5.3628510057769473e-008,
+-- ["nc"]=1.1917446679504327e-006,
+-- ["nd"]=1.4300936015405194e-005,
+-- ["pc"]=1.2715657552083333e-006,
+-- ["pt"]=1.52587890625e-005,
+-- ["sp"]=1,
+-- }
+--
+-- patched %s and tonumber
+--
+-- t={
+-- ["bp"]=0.00001520178238,
+-- ["cc"]=0.00000118836961,
+-- ["cm"]=0.0000005362851,
+-- ["dd"]=0.00001426043534,
+-- ["em"]=0.00015258789063,
+-- ["ex"]=0.00006103515625,
+-- ["in"]=0.00000021113587,
+-- ["mm"]=0.00000005362851,
+-- ["nc"]=0.00000119174467,
+-- ["nd"]=0.00001430093602,
+-- ["pc"]=0.00000127156576,
+-- ["pt"]=0.00001525878906,
+-- ["sp"]=1,
+-- }
--[[ldx--
<p>A conversion function that takes a number, unit (string) and optional
format (string) is implemented using this table.</p>
--ldx]]--
+local f_none = formatters["%s%s"]
+local f_true = formatters["%0.5f%s"]
local function numbertodimen(n,unit,fmt)
if type(n) == 'string' then
return n
else
unit = unit or 'pt'
+ n = n * dimenfactors[unit]
if not fmt then
- fmt = "%s%s"
+ fmt = f_none(n,unit)
elseif fmt == true then
- fmt = "%0.5f%s"
+ fmt = f_true(n,unit)
+ else
+ return formatters[fmt](n,unit)
end
- return format(fmt,n*dimenfactors[unit],unit)
- -- if fmt then
- -- return format(fmt,n*dimenfactors[unit],unit)
- -- else
- -- return match(format("%.20f",n*dimenfactors[unit]),"(.-0?)0*$") .. unit
- -- end
end
end
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index ea3a8cc12..a7b7b83d0 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 : 07/07/14 17:48:35
+-- merge date : 07/09/14 10:26:17
do -- begin closure to overcome local limits and interference