summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/anch-bar.mkiv8
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4086 -> 4083 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/enco-ini.mkiv15
-rw-r--r--tex/context/base/file-res.lua16
-rw-r--r--tex/context/base/l-lpeg.lua4
-rw-r--r--tex/context/base/l-table.lua4
-rw-r--r--tex/context/base/l-url.lua10
-rw-r--r--tex/context/base/node-aux.lua13
-rw-r--r--tex/context/base/publ-aut.lua88
-rw-r--r--tex/context/base/publ-ini.lua3
-rw-r--r--tex/context/base/status-files.pdfbin24794 -> 24779 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin229237 -> 229284 bytes
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua10
15 files changed, 140 insertions, 35 deletions
diff --git a/tex/context/base/anch-bar.mkiv b/tex/context/base/anch-bar.mkiv
index c7c6190be..501507b3b 100644
--- a/tex/context/base/anch-bar.mkiv
+++ b/tex/context/base/anch-bar.mkiv
@@ -81,9 +81,6 @@
\let\setupsidebars\setupsidebar
\unexpanded\def\startsidebar
- {\dosingleempty\anch_sidebars_start}
-
-\unexpanded\def\startsidebar
{\dodoubleempty\anch_sidebars_start}
\def\anch_sidebars_start[#1][#2]%
@@ -123,7 +120,7 @@
\d_anch_sidebars_distance\dimexpr\scratchdimen+\numexpr\m_level-\plusone\relax\dimexpr\scratchdistance\relax\relax
\fi
\fi
- \startpositionoverlay{text-1}%
+ \startpositionoverlay{\v!text-1}%
\normalexpanded{\setMPpositiongraphicrange % maybe expand in definition
{b:sidebar:\the\c_anch_sidebars_n}%
{e:sidebar:\the\c_anch_sidebars_n}%
@@ -211,9 +208,6 @@
\unexpanded\def\startmarginrule
{\dosingleempty\anch_marginrules_start}
-\unexpanded\def\startmarginrule
- {\dosingleempty\anch_marginrules_start}
-
\def\anch_marginrules_start[#1]% pretty inefficient checking
{\edef\m_anch_marginrules_kind{#1}%
\ifx\m_anch_marginrules_kind\empty
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index b2f56e628..e142a9fc0 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.01.17 12:19}
+\newcontextversion{2014.01.17 22:09}
%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 574fdfcb0..8e513604e 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 7902a604a..0f06c39ce 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.01.17 12:19}
+\edef\contextversion{2014.01.17 22:09}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/enco-ini.mkiv b/tex/context/base/enco-ini.mkiv
index 77fcbe483..ab3aa488d 100644
--- a/tex/context/base/enco-ini.mkiv
+++ b/tex/context/base/enco-ini.mkiv
@@ -87,17 +87,26 @@
%D Accent handling (try to avoid this):
+% \buildtextaccent\greekdasia\greekalphamacron
+% \buildtextaccent\textacute q
+
\newbox\b_enco_accent
\def\buildmathaccent#1%
{\mathaccent#1 }
+% \unexpanded\def\buildtextaccent#1#2% we could do all at the lua end
+% {\begingroup % but that's no fun (yet)
+% \setbox\b_enco_accent\hbox{#1}%
+% \scratchcounter\cldcontext{nodes.firstcharinbox(\number\b_enco_accent)}\relax
+% \ifcase\scratchcounter\else\accent\scratchcounter\fi
+% \relax#2%
+% \endgroup}
+
\unexpanded\def\buildtextaccent#1#2% we could do all at the lua end
{\begingroup % but that's no fun (yet)
\setbox\b_enco_accent\hbox{#1}%
- \scratchcounter\cldcontext{nodes.firstcharinbox(\number\b_enco_accent)}\relax
- \ifcase\scratchcounter\else\accent\scratchcounter\fi
- \relax#2%
+ \ctxcommand{buildtextaccent(\number\b_enco_accent)}#2%
\endgroup}
\unexpanded\def\bottomaccent#1#2#3#4#5% down right slantcorrection accent char
diff --git a/tex/context/base/file-res.lua b/tex/context/base/file-res.lua
index 8e65ba4c7..8a50c0d58 100644
--- a/tex/context/base/file-res.lua
+++ b/tex/context/base/file-res.lua
@@ -6,13 +6,14 @@ if not modules then modules = { } end modules ['file-res'] = {
license = "see context related readme files"
}
-local format = string.format
+local format, find = string.format, string.find
local isfile = lfs.isfile
local is_qualified_path = file.is_qualified_path
-local hasscheme = url.hasscheme
+local hasscheme, urlescape = url.hasscheme, url.escape
-local trace_files = false trackers.register("resolvers.readfile", function(v) trace_files = v end)
-local report_files = logs.reporter("files","readfile")
+local trace_files = false trackers.register("resolvers.readfile", function(v) trace_files = v end)
+local trace_details = false trackers.register("resolvers.readfile.details", function(v) trace_details = v end)
+local report_files = logs.reporter("files","readfile")
resolvers.maxreadlevel = 2
@@ -23,6 +24,9 @@ local finders, loaders, openers = resolvers.finders, resolvers.loaders, resolver
local found = { } -- can best be done in the resolver itself
local function readfilename(specification,backtrack,treetoo)
+ if trace_details then
+ report_files(table.serialize(specification,"specification"))
+ end
local name = specification.filename
local fnd = name and found[name]
if not fnd then
@@ -132,9 +136,11 @@ function getreadfilename(scheme,path,name) -- better do a split and then pass ta
if hasscheme(name) or is_qualified_path(name) then
fullname = name
else
+ if not find(name,"%%") then
+ name = urlescape(name) -- if no % in names
+ end
fullname = ((path == "") and format("%s:///%s",scheme,name)) or format("%s:///%s/%s",scheme,path,name)
end
---~ print(">>>",fullname)
return resolvers.findtexfile(fullname) or "" -- can be more direct
end
diff --git a/tex/context/base/l-lpeg.lua b/tex/context/base/l-lpeg.lua
index bad90efa8..982d8f98d 100644
--- a/tex/context/base/l-lpeg.lua
+++ b/tex/context/base/l-lpeg.lua
@@ -74,7 +74,9 @@ local lpegtype, lpegmatch, lpegprint = lpeg.type, lpeg.match, lpeg.print
-- let's start with an inspector:
-setinspector(function(v) if lpegtype(v) then lpegprint(v) return true end end)
+if setinspector then
+ setinspector(function(v) if lpegtype(v) then lpegprint(v) return true end end)
+end
-- Beware, we predefine a bunch of patterns here and one reason for doing so
-- is that we get consistent behaviour in some of the visualizers.
diff --git a/tex/context/base/l-table.lua b/tex/context/base/l-table.lua
index f361f3d20..c318c57bb 100644
--- a/tex/context/base/l-table.lua
+++ b/tex/context/base/l-table.lua
@@ -1006,7 +1006,9 @@ function table.print(t,...)
end
end
-setinspector(function(v) if type(v) == "table" then serialize(print,v,"table") return true end end)
+if setinspector then
+ setinspector(function(v) if type(v) == "table" then serialize(print,v,"table") return true end end)
+end
-- -- -- obsolete but we keep them for a while and might comment them later -- -- --
diff --git a/tex/context/base/l-url.lua b/tex/context/base/l-url.lua
index 7b7910fa7..7bb731254 100644
--- a/tex/context/base/l-url.lua
+++ b/tex/context/base/l-url.lua
@@ -26,6 +26,8 @@ local lpegmatch, lpegpatterns, replacer = lpeg.match, lpeg.patterns, lpeg.replac
-- | ___________|____________ |
-- / \ / \ |
-- urn:example:animal:ferret:nose interpretable as extension
+--
+-- also nice: http://url.spec.whatwg.org/ (maybe some day ...)
url = url or { }
local url = url
@@ -43,7 +45,7 @@ local hexdigit = R("09","AF","af")
local plus = P("+")
local nothing = Cc("")
local escapedchar = (percent * C(hexdigit * hexdigit)) / tochar
-local escaped = (plus / " ") + escapedchar
+local escaped = (plus / " ") + escapedchar -- so no loc://foo++.tex
local noslash = P("/") / ""
@@ -189,7 +191,11 @@ local function hashed(str) -- not yet ok (/test?test)
return s
end
--- inspect(hashed("template://test"))
+-- inspect(hashed("template:///test"))
+-- inspect(hashed("template:///test++.whatever"))
+-- inspect(hashed("template:///test%2B%2B.whatever"))
+-- inspect(hashed("template:///test%x.whatever"))
+-- inspect(hashed("tem%2Bplate:///test%x.whatever"))
-- Here we assume:
--
diff --git a/tex/context/base/node-aux.lua b/tex/context/base/node-aux.lua
index 1f9b50c57..e7977a307 100644
--- a/tex/context/base/node-aux.lua
+++ b/tex/context/base/node-aux.lua
@@ -255,7 +255,7 @@ end
-- end
-- end
-function nuts.firstcharinbox(n)
+local function firstcharinbox(n)
local l = getlist(getbox(n))
if l then
for g in traverse_id(glyph_code,l) do
@@ -265,9 +265,18 @@ function nuts.firstcharinbox(n)
return 0
end
-nodes.firstcharinbox = nuts.firstcharinbox
+nuts .firstcharinbox = firstcharinbox
+nodes.firstcharinbox = firstcharinbox
nodes.firstcharacter = vianuts(firstcharacter)
+function commands.buildtextaccent(n)
+ local char = firstcharinbox(n)
+ if char > 0 then
+ -- context.accent(false,char)
+ context([[\accent%s\relax]],char)
+ end
+end
+
-- this depends on fonts, so we have a funny dependency ... will be
-- sorted out .. we could make tonodes a plugin into this
diff --git a/tex/context/base/publ-aut.lua b/tex/context/base/publ-aut.lua
index 46597edf0..985f70eae 100644
--- a/tex/context/base/publ-aut.lua
+++ b/tex/context/base/publ-aut.lua
@@ -13,6 +13,7 @@ end
local chardata = characters.data
+local tostring = tostring
local concat = table.concat
local lpeg = lpeg
local utfchar = utf.char
@@ -95,13 +96,12 @@ local function splitauthorstring(str)
-- print("hit 2",author,nofhits,nofused,math.round(100*nofhits/nofused))
end
if not detail then
- local firstnames, vons, surnames, initials, juniors, words
+ local firstnames, vons, surnames, initials, juniors
local split = lpegmatch(commasplitter,author)
local n = #split
if n == 1 then
-- First von Last
- words = lpegmatch(spacesplitter,author)
--- inspect(words)
+ local words = lpegmatch(spacesplitter,author)
firstnames, vons, surnames = { }, { }, { }
local i, n = 1, #words
while i <= n do
@@ -138,9 +138,22 @@ local function splitauthorstring(str)
end
elseif n == 2 then
-- von Last, First
- words = lpegmatch(spacesplitter,split[2])
- surnames = lpegmatch(spacesplitter,split[1])
- firstnames, vons = { }, { }
+ firstnames, vons, surnames = { }, { }, { }
+ local words = lpegmatch(spacesplitter,split[1])
+ local i, n = 1, #words
+ while i <= n do
+ local w = words[i]
+ if is_upper(w) then
+ break
+ else
+ vons[#vons+1], i = w, i + 1
+ end
+ end
+ while i <= n do
+ surnames[#surnames+1], i = words[i], i + 1
+ end
+ --
+ local words = lpegmatch(spacesplitter,split[2])
local i, n = 1, #words
while i <= n do
local w = words[i]
@@ -437,6 +450,65 @@ end
-- We can consider creating a hashtable key -> entry but I wonder if
-- pays off.
--- inspect(splitauthorstring("Hagen, Hans and Hoekwater, Taco Whoever T. Ex. and Henkel Hut, Hartmut Harald von der"))
--- inspect(splitauthorstring("Hans Hagen and Taco Whoever T. Ex. Hoekwater and Hartmut Harald von der Henkel Hut"))
+local compare = sorters.comparers.basic -- (a,b)
+local strip = sorters.strip
+local splitter = sorters.splitters.utf
+local sort = sorters.sort
+
+function authors.sorted(dataset,list,sorttype) -- experimental
+ local luadata = datasets[dataset].details -- details
+ local valid = { }
+ for i=1,#list do
+ local tag = list[i]
+ local entry = luadata[tag]
+ if entry then
+ local key = entry[sorttype]
+ local suf = tostring(i)
+ if key then
+ local split = { }
+ for i=1,#key do
+ local k = key[i]
+ local vons = table.concat(k.vons," ")
+ local surnames = table.concat(k.surnames," ")
+ local assembled = (#vons > 0 and vons .. " " .. surnames) or surnames
+ split[i] = splitter(strip(assembled .. ":" .. suf))
+ end
+ valid[i] = {
+ index = i,
+ split = split,
+ }
+ else
+ local split = splitter(suf)
+ valid[i] = {
+ index = i,
+ split = split,
+ }
+ end
+ end
+ end
+ -- inspect(valid)
+ if #valid == 0 or #valid ~= #list then
+ return list
+ else
+ sorters.sort(valid,compare)
+ for i=1,#valid do
+ valid[i] = valid[i].index
+ end
+ return valid
+ end
+end
+-- local dataset = publications.datasets.test
+--
+-- local function add(str)
+-- dataset.details[str] = { author = publications.authors.splitstring(str) }
+-- end
+--
+-- add("Hagen, Hans and Hoekwater, Taco Whoever T. Ex. and Henkel Hut, Hartmut Harald von der")
+-- add("Hans Hagen and Taco Whoever T. Ex. Hoekwater and Hartmut Harald von der Henkel Hut")
+-- add("de Gennes, P. and Gennes, P. de")
+-- add("van't Hoff, J. H. and {van't Hoff}, J. H.")
+--
+-- local list = table.keys(dataset.details)
+-- local sort = publications.authors.sorted("test",list,"author")
+-- local test = { } for i=1,#sort do test[i] = dataset.details[list[sort[i]]] end
diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua
index b0e8d8b2f..afdc1b76a 100644
--- a/tex/context/base/publ-ini.lua
+++ b/tex/context/base/publ-ini.lua
@@ -979,6 +979,7 @@ publications.citevariants = citevariants
local compare = sorters.comparers.basic -- (a,b)
local strip = sorters.strip
local splitter = sorters.splitters.utf
+local sort = sorters.sort
local function sortedtags(dataset,list,sorttype)
local luadata = datasets[dataset].luadata
@@ -1000,7 +1001,7 @@ local function sortedtags(dataset,list,sorttype)
if #valid == 0 or #valid ~= #list then
return list
else
- table.sort(valid,sorters.comparers.basic)
+ sort(valid,sorters.comparers.basic)
for i=1,#valid do
valid[i] = valid[i].tag
end
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 4d3431786..bc2385de2 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 cd1db80d0..fc3a4d4df 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index f9ee8f3ba..42eee2723 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 : 01/17/14 12:19:08
+-- merge date : 01/17/14 22:09:11
do -- begin closure to overcome local limits and interference
@@ -101,7 +101,9 @@ local byte,char,gmatch,format=string.byte,string.char,string.gmatch,string.forma
local floor=math.floor
local P,R,S,V,Ct,C,Cs,Cc,Cp,Cmt=lpeg.P,lpeg.R,lpeg.S,lpeg.V,lpeg.Ct,lpeg.C,lpeg.Cs,lpeg.Cc,lpeg.Cp,lpeg.Cmt
local lpegtype,lpegmatch,lpegprint=lpeg.type,lpeg.match,lpeg.print
-setinspector(function(v) if lpegtype(v) then lpegprint(v) return true end end)
+if setinspector then
+ setinspector(function(v) if lpegtype(v) then lpegprint(v) return true end end)
+end
lpeg.patterns=lpeg.patterns or {}
local patterns=lpeg.patterns
local anything=P(1)
@@ -1640,7 +1642,9 @@ function table.print(t,...)
serialize(print,t,...)
end
end
-setinspector(function(v) if type(v)=="table" then serialize(print,v,"table") return true end end)
+if setinspector then
+ setinspector(function(v) if type(v)=="table" then serialize(print,v,"table") return true end end)
+end
function table.sub(t,i,j)
return { unpack(t,i,j) }
end