summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2014-07-29 00:30:00 +0200
committerHans Hagen <pragma@wxs.nl>2014-07-29 00:30:00 +0200
commitb5e7eb047db872bbaf068384c4e3cd866ad84077 (patch)
tree4f8e1c0a513abb0bcec51e35299c3da23784ced5 /tex
parente63baf9e8915e379e3883d5885e11b923d038318 (diff)
downloadcontext-b5e7eb047db872bbaf068384c4e3cd866ad84077.tar.gz
beta 2014.07.29 00:30
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4441 -> 4431 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/data-pre.lua52
-rw-r--r--tex/context/base/font-otb.lua17
-rw-r--r--tex/context/base/font-ott.lua7
-rw-r--r--tex/context/base/font-sel.lua3
-rw-r--r--tex/context/base/font-sel.mkvi89
-rw-r--r--tex/context/base/l-file.lua75
-rw-r--r--tex/context/base/publ-aut.lua4
-rw-r--r--tex/context/base/publ-imp-apa.mkvi16
-rw-r--r--tex/context/base/publ-imp-cite.mkvi21
-rw-r--r--tex/context/base/publ-ini.lua325
-rw-r--r--tex/context/base/publ-ini.mkiv3
-rw-r--r--tex/context/base/status-files.pdfbin24895 -> 24949 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin326886 -> 326999 bytes
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua37
17 files changed, 462 insertions, 191 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 98218ba55..f8ce269bc 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.26 14:38}
+\newcontextversion{2014.07.29 00:30}
%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 1afdca0d3..ea6da3b1c 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 d4f5bec86..ce5b6db10 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.26 14:38}
+\edef\contextversion{2014.07.29 00:30}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/data-pre.lua b/tex/context/base/data-pre.lua
index ae4477ac6..1c5016f86 100644
--- a/tex/context/base/data-pre.lua
+++ b/tex/context/base/data-pre.lua
@@ -87,6 +87,17 @@ prefixes.home = function(str)
return cleanpath(joinpath(getenv('HOME'),str))
end
+prefixes.env = prefixes.environment
+prefixes.rel = prefixes.relative
+prefixes.loc = prefixes.locate
+prefixes.kpse = prefixes.locate
+prefixes.full = prefixes.locate
+prefixes.file = prefixes.filename
+prefixes.path = prefixes.pathname
+
+-- This one assumes that inputstack is set (used in the tex loader). It is a momentary resolve
+-- as the top of the input stack changes.
+
local function toppath()
local inputstack = resolvers.inputstack -- dependency, actually the code should move but it's
if not inputstack then -- more convenient to keep it here
@@ -100,27 +111,32 @@ local function toppath()
end
end
-resolvers.toppath = toppath
-
-prefixes.toppath = function(str)
- return cleanpath(joinpath(toppath(),str))
-end
-
-prefixes.env = prefixes.environment
-prefixes.rel = prefixes.relative
-prefixes.loc = prefixes.locate
-prefixes.kpse = prefixes.locate
-prefixes.full = prefixes.locate
-prefixes.file = prefixes.filename
-prefixes.path = prefixes.pathname
+-- The next variant is similar but bound to explicitly registered paths. Practice should
+-- show if that gives the same results as the previous one. It is meant for a project
+-- stucture.
-prefixes.jobfile = function(str)
- local path = resolvers.stackpath() or "."
- if str and str ~= "" then
- return cleanpath(joinpath(path,str))
+local function jobpath()
+ local path = resolvers.stackpath()
+ if not path or path == "" then
+ return "."
else
- return cleanpath(path)
+ return path
end
end
+resolvers.toppath = toppath
+resolvers.jobpath = jobpath
+
+-- This hook sit into the resolver:
+
+prefixes.toppath = function(str) return cleanpath(joinpath(toppath(),str)) end -- str can be nil or empty
+prefixes.jobpath = function(str) return cleanpath(joinpath(jobpath(),str)) end -- str can be nil or empty
+
+resolvers.setdynamic("toppath")
+resolvers.setdynamic("jobpath")
+
+-- for a while (obsolete):
+
+prefixes.jobfile = prefixes.jobpath
+
resolvers.setdynamic("jobfile")
diff --git a/tex/context/base/font-otb.lua b/tex/context/base/font-otb.lua
index 2e98d3ecb..a68b57c8a 100644
--- a/tex/context/base/font-otb.lua
+++ b/tex/context/base/font-otb.lua
@@ -271,7 +271,7 @@ local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplis
local lookuptypes = resources.lookuptypes
local ligatures = { }
- local alternate = tonumber(value)
+ local alternate = tonumber(value) or true and 1
local defaultalt = otf.defaultbasealternate
local trace_singles = trace_baseinit and trace_singles
@@ -475,7 +475,7 @@ local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplis
local lookuptypes = resources.lookuptypes
local ligatures = { }
- local alternate = tonumber(value)
+ local alternate = tonumber(value) or true and 1
local defaultalt = otf.defaultbasealternate
local trace_singles = trace_baseinit and trace_singles
@@ -493,7 +493,7 @@ local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplis
end
changed[unicode] = data
elseif lookuptype == "alternate" then
- local replacement = data[alternate]
+ local replacement = data[alternate]
if replacement then
changed[unicode] = replacement
if trace_alternatives then
@@ -602,7 +602,7 @@ local function featuresinitializer(tfmdata,value)
if true then -- value then
local starttime = trace_preparing and os.clock()
local features = tfmdata.shared.features
- local fullname = trace_preparing and tfmdata.properties.fullname
+ local fullname = tfmdata.properties.fullname or "?"
if features then
applybasemethod("initializehashes",tfmdata)
local collectlookups = otf.collectlookups
@@ -648,21 +648,22 @@ local function featuresinitializer(tfmdata,value)
if order then
for i=1,#order do --
local feature = order[i]
- if features[feature] then
+ local value = features[feature]
+ if value then
local validlookups, lookuplist = collectlookups(rawdata,feature,script,language)
if not validlookups then
-- skip
elseif basesubstitutions and basesubstitutions[feature] then
if trace_preparing then
- report_prepare("filtering base feature %a for %a",feature,fullname)
+ report_prepare("filtering base %s feature %a for %a with value %a","sub",feature,fullname,value)
end
applybasemethod("preparesubstitutions",tfmdata,feature,value,validlookups,lookuplist)
registerbasefeature(feature,value)
elseif basepositionings and basepositionings[feature] then
if trace_preparing then
- report_prepare("filtering base feature %a for %a",feature,fullname)
+ report_prepare("filtering base %a feature %a for %a with value %a","pos",feature,fullname,value)
end
- applybasemethod("preparepositionings",tfmdata,feature,features[feature],validlookups,lookuplist)
+ applybasemethod("preparepositionings",tfmdata,feature,value,validlookups,lookuplist)
registerbasefeature(feature,value)
end
end
diff --git a/tex/context/base/font-ott.lua b/tex/context/base/font-ott.lua
index 1e2309056..348672491 100644
--- a/tex/context/base/font-ott.lua
+++ b/tex/context/base/font-ott.lua
@@ -858,10 +858,13 @@ function otf.features.normalize(features)
if uv then
-- report_checks("feature value %a first seen at %a",value,key)
else
- if type(value) == "string" then
+ uv = tonumber(value) -- before boolean as there we also handle 0/1
+ if uv then
+ -- we're okay
+ elseif type(value) == "string" then
local b = is_boolean(value)
if type(b) == "nil" then
- uv = tonumber(value) or lower(value)
+ uv = lower(value)
else
uv = b
end
diff --git a/tex/context/base/font-sel.lua b/tex/context/base/font-sel.lua
index 86300c2db..aef528c53 100644
--- a/tex/context/base/font-sel.lua
+++ b/tex/context/base/font-sel.lua
@@ -526,6 +526,9 @@ local function definefontsynonym(data,alternative,index,fallback)
local designsize = entry["designsize"] or 100
if designsize == 100 or designsize == 110 or designsize == 120 or designsize == 0 or #fontdata == 1 then
local filepath, filename = splitbase(entry["filename"])
+ if entry["format"] == "ttc" or entry["format"] == "dfont" then
+ filename = formatters["%s(%s)"](filename, entry["rawname"])
+ end
registerdesignsizes( fontfile, "default", filename )
break
end
diff --git a/tex/context/base/font-sel.mkvi b/tex/context/base/font-sel.mkvi
index 0b9a4bda9..933afa466 100644
--- a/tex/context/base/font-sel.mkvi
+++ b/tex/context/base/font-sel.mkvi
@@ -1,6 +1,6 @@
%D \module
%D [ file=font-sel,
-%D version=2014.03.10,
+%D version=2014.07.27,
%D title=\CONTEXT\ User Module,
%D subtitle=Selectfont,
%D author=Wolfgang Schuster,
@@ -115,18 +115,74 @@
% unknown preset
\fi}
-%definefontfamilypreset [range:chinese] [\c!range={cjkcompatibilityforms,cjkcompatibilityideographs,cjkcompatibilityideographssupplement,cjkradicalssupplement,cjkstrokes,cjksymbolsandpunctuation,cjkunifiedideographs,cjkunifiedideographsextensiona,cjkunifiedideographsextensionb,halfwidthandfullwidthforms,verticalforms,bopomofo,bopomofoextended}]
-%definefontfamilypreset [range:japanese] [\c!range={cjkcompatibilityforms,cjkcompatibilityideographs,cjkcompatibilityideographssupplement,cjkradicalssupplement,cjkstrokes,cjksymbolsandpunctuation,cjkunifiedideographs,cjkunifiedideographsextensiona,cjkunifiedideographsextensionb,halfwidthandfullwidthforms,verticalforms,hiragana,katakana}]
-%definefontfamilypreset [range:korean] [\c!range={cjkcompatibilityforms,cjkcompatibilityideographs,cjkcompatibilityideographssupplement,cjkradicalssupplement,cjkstrokes,cjksymbolsandpunctuation,cjkunifiedideographs,cjkunifiedideographsextensiona,cjkunifiedideographsextensionb,halfwidthandfullwidthforms,verticalforms,hangulcompatibilityjamo,hanguljamo,hanguljamoextendeda,hanguljamoextendedb,hangulsyllables}]
-%definefontfamilypreset [range:cyrillic] [\c!range={cyrillic,cyrillicextendeda,cyrillicextendedb,cyrillicsupplement}]
-%definefontfamilypreset [range:greek] [\c!range={greekandcoptic,greekextended,ancientgreeknumbers}]
-
-\definefontfamilypreset [range:chinese] [\c!range={0x02E80-0x02EFF,0x03000-0x031EF,0x03300-0x09FFF,0x0F900-0x0FFEF,0x20000-0x2A6DF,0x2F800-0x2FA1F,0x03100-0x0312F,0x031A0-0x031BF}]
-\definefontfamilypreset [range:japanese] [\c!range={0x02E80-0x02EFF,0x03000-0x031EF,0x03300-0x09FFF,0x0F900-0x0FFEF,0x20000-0x2A6DF,0x2F800-0x2FA1F,0x03040-0x0309F,0x030A0-0x030FF}]
-\definefontfamilypreset [range:korean] [\c!range={0x02E80-0x02EFF,0x03000-0x031EF,0x03300-0x09FFF,0x0F900-0x0FFEF,0x20000-0x2A6DF,0x2F800-0x2FA1F,0x01100-0x011FF,0x03130-0x0318F,0x0A960-0x0D7FF}]
-\definefontfamilypreset [range:cyrillic] [\c!range={0x00400-0x0052F,0x02DE0-0x02DFF,0x0A640-0x0A69F}]
-\definefontfamilypreset [range:greek] [\c!range={0x00370-0x003FF,0x01F00-0x01FFF,0x10140-0x1018F}]
-\definefontfamilypreset [range:hebrew] [\c!range={0x00590-0x005FF,0x0FB00-0x0FB4F}]
+\definefontfamilypreset
+ [range:chinese]
+ [\c!range={cjkcompatibilityforms,
+ cjkcompatibilityideographs,
+ cjkcompatibilityideographssupplement,
+ cjkradicalssupplement,
+ cjkstrokes,
+ cjksymbolsandpunctuation,
+ cjkunifiedideographs,
+ cjkunifiedideographsextensiona,
+ cjkunifiedideographsextensionb,
+ halfwidthandfullwidthforms,
+ verticalforms,
+ bopomofo,
+ bopomofoextended}]
+
+\definefontfamilypreset
+ [range:japanese]
+ [\crange={cjkcompatibilityforms,
+ cjkcompatibilityideographs,
+ cjkcompatibilityideographssupplement,
+ cjkradicalssupplement,
+ cjkstrokes,
+ cjksymbolsandpunctuation,
+ cjkunifiedideographs,
+ cjkunifiedideographsextensiona,
+ cjkunifiedideographsextensionb,
+ halfwidthandfullwidthforms,
+ verticalforms,
+ hiragana,
+ katakana}]
+
+\definefontfamilypreset
+ [range:korean]
+ [\c!range={cjkcompatibilityforms,
+ cjkcompatibilityideographs,
+ cjkcompatibilityideographssupplement,
+ cjkradicalssupplement,
+ cjkstrokes,
+ cjksymbolsandpunctuation,
+ cjkunifiedideographs,
+ cjkunifiedideographsextensiona,
+ cjkunifiedideographsextensionb,
+ halfwidthandfullwidthforms,
+ verticalforms,
+ hangulcompatibilityjamo,
+ hanguljamo,
+ hanguljamoextendeda,
+ hanguljamoextendedb,
+ hangulsyllables}]
+
+\definefontfamilypreset
+ [range:cyrillic]
+ [\c!range={cyrillic,
+ cyrillicextendeda,
+ cyrillicextendedb,
+ cyrillicsupplement}]
+
+\definefontfamilypreset
+ [range:greek]
+ [\c!range={greekandcoptic,
+ greekextended,
+ ancientgreeknumbers}]
+
+\definefontfamilypreset
+ [range:hebrew]
+ [\c!range={hebrew,
+ alphabeticpresentationforms}]
\definefontfamilypreset [math:digitsnormal] [\c!range=digitsnormal]
\definefontfamilypreset [math:digitsbold] [\c!range=digitsnormal,\c!offset=digitsbold,\s!tf=style:bold]
@@ -226,7 +282,7 @@
%D \stoptyping
%D
%D When a document contains different languages and the global font lacks some characters
-%D for one language, one could set a different font where these characters are taken from.
+%D for one language, one could set a different font where these charcters are taken from.
%D This fallback font (there can be more than one for a certain style) could be set with
%D the \tex{definefallbackfamily} command which takes the same argument as
%D the \tex{definefontfamily} command.
@@ -332,7 +388,8 @@
\unexpanded\def\selectfont_set_default
{\selectfont_set_font_family[\v!serif][Latin Modern Roman][\c!opticalsize=\v!yes]%
\selectfont_set_font_family[\v!sans] [Latin Modern Sans] [\c!opticalsize=\v!yes]%
- \selectfont_set_font_family[\v!mono] [Latin Modern Mono] [\c!opticalsize=\v!yes,\c!features=\s!none]}
+ \selectfont_set_font_family[\v!mono] [Latin Modern Mono] [\c!opticalsize=\v!yes,\c!features=\s!none]%
+ \selectfont_set_font_family[\v!math] [Latin Modern Math] [\c!opticalsize=\v!yes]}
\unexpanded\def\setupfallbackfamily
{\dotripleempty\selectfont_fallback_setup}
@@ -371,4 +428,4 @@
\c!smallcapsfeatures=\s!smallcaps,
\c!style=\s!rm]
-\protect
+\protect \ No newline at end of file
diff --git a/tex/context/base/l-file.lua b/tex/context/base/l-file.lua
index c05372a05..2742e99b3 100644
--- a/tex/context/base/l-file.lua
+++ b/tex/context/base/l-file.lua
@@ -385,31 +385,90 @@ local deslasher = lpeg.replacer(S("\\/")^1,"/")
-- then we still have to deal with urls ... anyhow, multiple // are never a real
-- problem but just ugly.
-function file.join(...)
- local lst = { ... }
- local one = lst[1]
+-- function file.join(...)
+-- local lst = { ... }
+-- local one = lst[1]
+-- if lpegmatch(isnetwork,one) then
+-- local one = lpegmatch(reslasher,one)
+-- local two = lpegmatch(deslasher,concat(lst,"/",2))
+-- if lpegmatch(hasroot,two) then
+-- return one .. two
+-- else
+-- return one .. "/" .. two
+-- end
+-- elseif lpegmatch(isroot,one) then
+-- local two = lpegmatch(deslasher,concat(lst,"/",2))
+-- if lpegmatch(hasroot,two) then
+-- return two
+-- else
+-- return "/" .. two
+-- end
+-- elseif one == "" then
+-- return lpegmatch(stripper,concat(lst,"/",2))
+-- else
+-- return lpegmatch(deslasher,concat(lst,"/"))
+-- end
+-- end
+
+function file.join(one, two, three, ...)
+ if not two then
+ return one == "" and one or lpegmatch(stripper,one)
+ end
+ if one == "" then
+ return lpegmatch(stripper,three and concat({ two, three, ... },"/") or two)
+ end
if lpegmatch(isnetwork,one) then
local one = lpegmatch(reslasher,one)
- local two = lpegmatch(deslasher,concat(lst,"/",2))
+ local two = lpegmatch(deslasher,three and concat({ two, three, ... },"/") or two)
if lpegmatch(hasroot,two) then
return one .. two
else
return one .. "/" .. two
end
elseif lpegmatch(isroot,one) then
- local two = lpegmatch(deslasher,concat(lst,"/",2))
+ local two = lpegmatch(deslasher,three and concat({ two, three, ... },"/") or two)
if lpegmatch(hasroot,two) then
return two
else
return "/" .. two
end
- elseif one == "" then
- return lpegmatch(stripper,concat(lst,"/",2))
else
- return lpegmatch(deslasher,concat(lst,"/"))
+ return lpegmatch(deslasher,concat({ one, two, three, ... },"/"))
end
end
+-- or we can use this:
+--
+-- function file.join(...)
+-- local n = select("#",...)
+-- local one = select(1,...)
+-- if n == 1 then
+-- return one == "" and one or lpegmatch(stripper,one)
+-- end
+-- if one == "" then
+-- return lpegmatch(stripper,n > 2 and concat({ ... },"/",2) or select(2,...))
+-- end
+-- if lpegmatch(isnetwork,one) then
+-- local one = lpegmatch(reslasher,one)
+-- local two = lpegmatch(deslasher,n > 2 and concat({ ... },"/",2) or select(2,...))
+-- if lpegmatch(hasroot,two) then
+-- return one .. two
+-- else
+-- return one .. "/" .. two
+-- end
+-- elseif lpegmatch(isroot,one) then
+-- local two = lpegmatch(deslasher,n > 2 and concat({ ... },"/",2) or select(2,...))
+-- if lpegmatch(hasroot,two) then
+-- return two
+-- else
+-- return "/" .. two
+-- end
+-- else
+-- return lpegmatch(deslasher,concat({ ... },"/"))
+-- end
+-- end
+
+-- print(file.join("c:/whatever"))
-- print(file.join("c:/whatever","name"))
-- print(file.join("//","/y"))
-- print(file.join("/","/y"))
diff --git a/tex/context/base/publ-aut.lua b/tex/context/base/publ-aut.lua
index 73d50f614..90bb4b3df 100644
--- a/tex/context/base/publ-aut.lua
+++ b/tex/context/base/publ-aut.lua
@@ -423,7 +423,7 @@ local function newsplitter(splitter)
end)
end
-local function byauthor(dataset,list,method) -- todo: yearsuffix
+local function byauthor(dataset,list,method)
local luadata = datasets[dataset].luadata
local details = datasets[dataset].details
local result = { }
@@ -441,6 +441,7 @@ local function byauthor(dataset,list,method) -- todo: yearsuffix
split = {
splitted[strip(writer(detail.author or detail.editor or "",snippets))],
splitted[entry.year or "9998"],
+ splitted[detail.suffix or " "],
splitted[strip(entry.journal or "")],
splitted[strip(entry.title or "")],
splitted[entry.pages or ""],
@@ -453,6 +454,7 @@ local function byauthor(dataset,list,method) -- todo: yearsuffix
split = {
splitted[""],
splitted["9999"],
+ splitted[" "],
splitted[""],
splitted[""],
splitted[""],
diff --git a/tex/context/base/publ-imp-apa.mkvi b/tex/context/base/publ-imp-apa.mkvi
index 08724a5f9..5aa2c80ca 100644
--- a/tex/context/base/publ-imp-apa.mkvi
+++ b/tex/context/base/publ-imp-apa.mkvi
@@ -195,7 +195,11 @@
}
\btxdoif {year} {
\btxlparent
+ % \btxflush{suffixedyear}
\btxflush{year}
+ \btxdoif {suffix} {
+ \btxflush{suffix}
+ }
\btxrparent
}
\btxperiod
@@ -213,7 +217,11 @@
}
\btxdoif {year} {
\btxlparent
+ % \btxflush{suffixedyear}
\btxflush{year}
+ \btxdoif {suffix} {
+ \btxflush{suffix}
+ }
\btxrparent
}
\btxperiod
@@ -244,7 +252,11 @@
}
\btxdoif {year} {
\btxlparent
+ % \btxflush{suffixedyear}
\btxflush{year}
+ \btxdoif {suffix} {
+ \btxflush{suffix}
+ }
\btxrparent
}
\btxperiod
@@ -270,7 +282,11 @@
\btxspace
\btxdoif {year} {
\btxlparent
+ % \btxflush{suffixedyear}
\btxflush{year}
+ \btxdoif {suffix} {
+ \btxflush{suffix}
+ }
\btxrparent
}
\btxperiod
diff --git a/tex/context/base/publ-imp-cite.mkvi b/tex/context/base/publ-imp-cite.mkvi
index 6ef584699..64a244def 100644
--- a/tex/context/base/publ-imp-cite.mkvi
+++ b/tex/context/base/publ-imp-cite.mkvi
@@ -63,11 +63,17 @@
\else\ifx\currentbtxsecond\empty
\btxcitereference
\currentbtxfirst
+ \ifx\currentbtxthird\empty \else
+ \currentbtxthird
+ \fi
\else
\btxcitereference
\currentbtxfirst
\btxcitevariantparameter\v!inbetween
\currentbtxsecond
+ \ifx\currentbtxthird\empty \else
+ \currentbtxthird
+ \fi
\fi\fi
\stopsetups
@@ -77,11 +83,17 @@
\else\ifx\currentbtxsecond\empty
\btxcitereference
\currentbtxfirst
+ \ifx\currentbtxthird\empty \else
+ \currentbtxthird
+ \fi
\else
\btxcitereference
\currentbtxfirst
\btxcitevariantparameter\c!range
\currentbtxsecond
+ \ifx\currentbtxthird\empty \else
+ \currentbtxthird
+ \fi
\fi\fi
\stopsetups
@@ -107,6 +119,9 @@
\btxcitevariantparameter\v!inbetween
\currentbtxsecond
\fi
+ \ifx\currentbtxthird\empty \else
+ \currentbtxthird
+ \fi
}
\fi
\stopsetups
@@ -123,6 +138,9 @@
\btxcitevariantparameter\c!range
\currentbtxsecond
\fi
+ \ifx\currentbtxthird\empty \else
+ \currentbtxthird
+ \fi
}
\fi
\stopsetups
@@ -146,6 +164,9 @@
\btxcitevariantparameter\v!inbetween
\currentbtxsecond
\fi
+ \ifx\currentbtxthird\empty \else
+ \currentbtxthird
+ \fi
\stopsetups
% one level will be removed
diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua
index ed50af9d3..d2600d8a0 100644
--- a/tex/context/base/publ-ini.lua
+++ b/tex/context/base/publ-ini.lua
@@ -112,6 +112,7 @@ local ctx_btxsetcategory = context.btxsetcategory
local ctx_btxcitesetup = context.btxcitesetup
local ctx_btxsetfirst = context.btxsetfirst
local ctx_btxsetsecond = context.btxsetsecond
+local ctx_btxsetthird = context.btxsetthird
local ctx_btxsetinternal = context.btxsetinternal
local ctx_btxsetbacklink = context.btxsetbacklink
local ctx_btxsetbacktrace = context.btxsetbacktrace
@@ -582,10 +583,22 @@ local pagessplitter = lpeg.splitat(P("-")^1)
-- maybe not redo when already done
+local function shortsorter(a,b)
+ local ay, by = a[2], b[2]
+ if ay == by then
+ return a[3] < b[3]
+ else
+ return ay < by
+ end
+end
+
function publications.enhance(dataset) -- for the moment split runs (maybe publications.enhancers)
statistics.starttiming(publications)
+ local used = usedentries[dataset]
if type(dataset) == "string" then
dataset = datasets[dataset]
+ else
+ -- message
end
local luadata = dataset.luadata
local details = dataset.details
@@ -628,12 +641,11 @@ function publications.enhance(dataset) -- for the moment split runs (maybe publi
local year = tonumber(entry.year) or 0
local short = formatters["%t%02i"](t,mod(year,100))
local s = shorts[short]
+ -- we could also sort on reference i.e. entries.text
if not s then
- shorts[short] = tag
- elseif type(s) == "string" then
- shorts[short] = { s, tag }
+ shorts[short] = { { tag, year, i } }
else
- s[#s+1] = tag
+ s[#s+1] = { tag, year, i }
end
else
--
@@ -660,16 +672,47 @@ function publications.enhance(dataset) -- for the moment split runs (maybe publi
end
end
for short, tags in next, shorts do -- ordered ?
- if type(tags) == "table" then
- sort(tags)
+ if #tags > 1 then
+ sort(tags,shortsorter)
+ local n = 0
for i=1,#tags do
- -- details[tags[i]].short = short .. numbertochar(i)
- local detail = details[tags[i]]
- detail.short = short
- detail.suffix = numbertochar(i)
+ local tag = tags[i][1]
+ local detail = details[tag]
+ detail.short = short
+ if used[tag] then
+ n = n + 1
+ local suffix = numbertochar(n)
+ detail.suffix = suffix
+ local entry = luadata[tag]
+ local year = entry.year
+ if year then
+ detail.suffixedyear = year .. suffix
+ end
+ end
+ end
+ for i=1,#tags do
+ local tag = tags[i][1]
+ local detail = details[tag]
+ if not detail.suffix then
+ n = n + 1
+ local suffix = numbertochar(n)
+ detail.suffix = suffix
+ local entry = luadata[tag]
+ local year = entry.year
+ if year then
+ detail.suffixedyear = year .. suffix
+ end
+ end
end
else
- details[tags].short = short
+ local tag = tags[i][1]
+ local detail = details[tag]
+ detail.short = short
+ local entry = luadata[tag]
+ local year = entry.year
+ if year then
+ detail.suffixedyear = year
+ end
end
end
statistics.stoptiming(publications)
@@ -717,13 +760,13 @@ function commands.btxflush(name,tag,field)
local manipulator, field = splitmanipulation(field)
local value = fields[field]
if type(value) == "string" then
- local suffixes = dataset.suffixes[tag]
- if suffixes then
- local suffix = suffixes[field]
- if suffix then
- value = value .. converters.characters(suffix)
- end
- end
+-- local suffixes = dataset.suffixes[tag]
+-- if suffixes then
+-- local suffix = suffixes[field]
+-- if suffix then
+-- value = value .. converters.characters(suffix)
+-- end
+-- end
context(manipulator and applymanipulation(manipulator,value) or value)
return
end
@@ -731,13 +774,13 @@ function commands.btxflush(name,tag,field)
if details then
local value = details[field]
if type(value) == "string" then
- local suffixes = dataset.suffixes[tag]
- if suffixes then
- local suffix = suffixes[field]
- if suffix then
- value = value .. converters.characters(suffix)
- end
- end
+-- local suffixes = dataset.suffixes[tag]
+-- if suffixes then
+-- local suffix = suffixes[field]
+-- if suffix then
+-- value = value .. converters.characters(suffix)
+-- end
+-- end
context(manipulator and applymanipulation(manipulator,value) or value)
return
end
@@ -759,13 +802,13 @@ function commands.btxdetail(name,tag,field)
local manipulator, field = splitmanipulation(field)
local value = details[field]
if type(value) == "string" then
- local suffixes = dataset.suffixes[tag]
- if suffixes then
- local suffix = suffixes[field]
- if suffix then
- value = value .. converters.characters(suffix)
- end
- end
+-- local suffixes = dataset.suffixes[tag]
+-- if suffixes then
+-- local suffix = suffixes[field]
+-- if suffix then
+-- value = value .. converters.characters(suffix)
+-- end
+-- end
context(manipulator and applymanipulation(manipulator,value) or value)
else
report("unknown detail %a of tag %a in dataset %a",field,tag,name)
@@ -786,13 +829,13 @@ function commands.btxfield(name,tag,field)
local manipulator, field = splitmanipulation(field)
local value = fields[field]
if type(value) == "string" then
- local suffixes = dataset.suffixes[tag]
- if suffixes then
- local suffix = suffixes[field]
- if suffix then
- value = value .. converters.characters(suffix)
- end
- end
+-- local suffixes = dataset.suffixes[tag]
+-- if suffixes then
+-- local suffix = suffixes[field]
+-- if suffix then
+-- value = value .. converters.characters(suffix)
+-- end
+-- end
context(manipulator and applymanipulation(manipulator,value) or value)
else
report("unknown field %a of tag %a in dataset %a",field,tag,name)
@@ -807,43 +850,54 @@ end
-- testing: to be speed up with testcase
-function commands.btxdoifelse(name,tag,field)
+local function found(name,tag,field,yes)
local dataset = rawget(datasets,name)
if dataset then
local data = dataset.luadata[tag]
- local value = data and data[field]
- if value and value ~= "" then
- ctx_firstoftwoarguments()
- return
+ if data then
+ local value = data[field]
+ if value then
+ if value ~= "" then
+ return true
+ end
+ else
+ local data = dataset.details[tag]
+ if data then
+ local value = data[field]
+ if value then
+ if value ~= "" then
+ return true
+ end
+ end
+ end
+ end
end
end
- ctx_secondoftwoarguments()
+ return false
+end
+
+function commands.btxdoifelse(name,tag,field)
+ if found(name,tag,field) then
+ ctx_firstoftwoarguments()
+ else
+ ctx_secondoftwoarguments()
+ end
end
function commands.btxdoif(name,tag,field)
- local dataset = rawget(datasets,name)
- if dataset then
- local data = dataset.luadata[tag]
- local value = data and data[field]
- if value and value ~= "" then
- ctx_firstofoneargument()
- return
- end
+ if found(name,tag,field) then
+ ctx_firstofoneargument()
+ else
+ ctx_gobbleoneargument()
end
- ctx_gobbleoneargument()
end
function commands.btxdoifnot(name,tag,field)
- local dataset = rawget(datasets,name)
- if dataset then
- local data = dataset.luadata[tag]
- local value = data and data[field]
- if value and value ~= "" then
- ctx_gobbleoneargument()
- return
- end
+ if found(name,tag,field) then
+ ctx_gobbleoneargument()
+ else
+ ctx_firstofoneargument()
end
- ctx_firstofoneargument()
end
-- -- alternative approach: keep data at the tex end
@@ -1451,40 +1505,40 @@ local function compresslist(source)
sort(source,keysorter)
-- suffixes
local oldvalue = nil
- local suffix = 0
- local function setsuffix(entry,suffix,sortfld)
- entry.suffix = suffix
- local dataset = datasets[entry.dataset]
- if dataset then
- local suffixes = dataset.suffixes[entry.tag]
- if suffixes then
- suffixes[sortfld] = suffix
- else
- dataset.suffixes[entry.tag] = { [sortfld] = suffix }
- end
- end
- end
- for i=1,#source do
- local entry = source[i]
- local sortfld = entry.sortfld
- if sortfld then
- local value = entry.sortkey
- if value == oldvalue then
- if suffix == 0 then
- suffix = 1
- local entry = source[i-1]
- setsuffix(entry,suffix,sortfld)
- end
- suffix = suffix + 1
- setsuffix(entry,suffix,sortfld)
- else
- oldvalue = value
- suffix = 0
- end
- else
- break
- end
- end
+-- local suffix = 0
+-- local function setsuffix(entry,suffix,sortfld)
+-- entry.suffix = suffix
+-- local dataset = datasets[entry.dataset]
+-- if dataset then
+-- local suffixes = dataset.suffixes[entry.tag]
+-- if suffixes then
+-- suffixes[sortfld] = suffix
+-- else
+-- dataset.suffixes[entry.tag] = { [sortfld] = suffix }
+-- end
+-- end
+-- end
+-- for i=1,#source do
+-- local entry = source[i]
+-- local sortfld = entry.sortfld
+-- if sortfld then
+-- local value = entry.sortkey
+-- if value == oldvalue then
+-- if suffix == 0 then
+-- suffix = 1
+-- local entry = source[i-1]
+-- setsuffix(entry,suffix,sortfld)
+-- end
+-- suffix = suffix + 1
+-- setsuffix(entry,suffix,sortfld)
+-- else
+-- oldvalue = value
+-- suffix = 0
+-- end
+-- else
+-- break
+-- end
+-- end
--
local function flushrange()
noftarget = noftarget + 1
@@ -1659,6 +1713,8 @@ local getters = setmetatableindex({},function(t,k)
return v
end)
+-- todo: just a sort key and then fetch normal by fieldname
+
-- default
setmetatableindex(citevariants,function(t,k)
@@ -1677,8 +1733,8 @@ local function setter(dataset,tag,entry,internal)
return {
tag = tag,
internal = internal,
- short = getfield(dataset,tag,"short"),
- suffix = getfield(dataset,tag,"suffix"),
+ short = getdetail(dataset,tag,"short"),
+ suffix = getdetail(dataset,tag,"suffix"),
}
end
@@ -1751,15 +1807,26 @@ end
-- year
+-- local function setter(dataset,tag,entry,internal)
+-- local year = getfield(dataset,tag,"year")
+-- return {
+-- dataset = dataset,
+-- tag = tag,
+-- internal = internal,
+-- year = year,
+-- sortkey = year,
+-- sortfld = "year",
+-- }
+-- end
+
local function setter(dataset,tag,entry,internal)
- local year = getfield(dataset,tag,"year")
return {
dataset = dataset,
tag = tag,
internal = internal,
- year = year,
- sortkey = year,
- sortfld = "year",
+ year = getfield(dataset,tag,"year"),
+ suffix = getdetail(dataset,tag,"suffix"),
+ sortkey = getdetail(dataset,tag,"suffixedyear"),
}
end
@@ -1906,21 +1973,30 @@ local function authorconcat(target,key,setup)
ctx_btxsetinternal(bl and bl.references.internal or "")
if first then
ctx_btxsetfirst(first[key] or f_missing(first.tag))
+-- third ? of gewoon getfield?
local suffix = entry.suffix
local value = entry.last[key]
- if suffix then
- ctx_btxsetsecond(value .. converters.characters(suffix))
- else
- ctx_btxsetsecond(value)
- end
+-- if suffix then
+-- ctx_btxsetsecond(value .. converters.characters(suffix))
+-- else
+-- ctx_btxsetsecond(value)
+-- end
+ctx_btxsetsecond(value)
+if suffix then
+ ctx_btxsetthird(suffix)
+end
else
local suffix = entry.suffix
local value = entry[key] or f_missing(tag)
- if suffix then
- ctx_btxsetfirst(value .. converters.characters(suffix))
- else
- ctx_btxsetfirst(value)
- end
+-- if suffix then
+-- ctx_btxsetfirst(value .. converters.characters(suffix))
+-- else
+-- ctx_btxsetfirst(value)
+-- end
+ctx_btxsetfirst(value)
+if suffix then
+ ctx_btxsetthird(suffix)
+end
end
ctx_btxsetconcat(concatstate(i,nofcollected))
ctx_btxcitesetup(setup)
@@ -1940,6 +2016,7 @@ local function authorsingle(entry,key,setup)
-- local bl = listtocite[currentcitation]
-- ctx_btxsetinternal(bl and bl.references.internal or "")
ctx_btxsetfirst(entry[key] or f_missing(tag))
+ ctx_btxsetthird(entry.suffix)
ctx_btxcitesetup(setup)
ctx_btxstopciteauthor()
ctx_btxstopsubcite()
@@ -2019,16 +2096,28 @@ end
-- authoryear | authoryears
+-- local function setter(dataset,tag,entry,internal)
+-- local year = getfield(dataset,tag,"year")
+-- return {
+-- dataset = dataset,
+-- tag = tag,
+-- internal = internal,
+-- author = getfield(dataset,tag,"author"),
+-- year = year,
+-- sortkey = year and lpegmatch(numberonly,year),
+-- sortfld = "year",
+-- }
+-- end
+
local function setter(dataset,tag,entry,internal)
- local year = getfield(dataset,tag,"year")
return {
dataset = dataset,
tag = tag,
internal = internal,
author = getfield(dataset,tag,"author"),
- year = year,
- sortkey = year and lpegmatch(numberonly,year),
- sortfld = "year",
+ year = getfield(dataset,tag,"year"),
+ suffix = getdetail(dataset,tag,"suffix"),
+ sortkey = getdetail(dataset,tag,"suffixedyear"),
}
end
@@ -2086,7 +2175,7 @@ function listvariants.short(dataset,block,tag,variant,listindex)
ctx_btxsetfirst(short)
end
if suffix then
- ctx_btxsetsecond(suffix)
+ ctx_btxsetthird(suffix)
end
ctx_btxlistsetup(variant)
end
diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv
index 5d64af19c..0ef8f39cc 100644
--- a/tex/context/base/publ-ini.mkiv
+++ b/tex/context/base/publ-ini.mkiv
@@ -353,9 +353,10 @@
\let\currentbtxcombis \empty \unexpanded\def\btxsetcombis {\def\currentbtxcombis}
\let\currentbtxdataset \empty \unexpanded\def\btxsetdataset {\def\currentbtxdataset}
\let\currentbtxfirst \empty \unexpanded\def\btxsetfirst {\def\currentbtxfirst}
+\let\currentbtxsecond \empty \unexpanded\def\btxsetsecond {\def\currentbtxsecond}
+\let\currentbtxthird \empty \unexpanded\def\btxsetthird {\def\currentbtxthird}
\let\currentbtxinternal \empty \unexpanded\def\btxsetinternal {\def\currentbtxinternal}
\let\currentbtxlanguage \empty \unexpanded\def\btxsetlanguage {\def\currentbtxlanguage}
-\let\currentbtxsecond \empty \unexpanded\def\btxsetsecond {\def\currentbtxsecond}
\let\currentbtxtag \empty \unexpanded\def\btxsettag {\def\currentbtxtag}
\let\currentbtxnumber \empty \unexpanded\def\btxsetnumber {\def\currentbtxnumber}
\let\currentbtxauthorvariant\v!normal \unexpanded\def\btxsetauthorvariant{\def\currentbtxauthorvariant}
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index cf1c7dfe1..a9107b947 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 b96ea1dba..39eb99248 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 881e8d951..660524e6f 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/26/14 14:38:45
+-- merge date : 07/29/14 00:30:11
do -- begin closure to overcome local limits and interference
@@ -2377,28 +2377,30 @@ local isroot=fwslash^1*-1
local hasroot=fwslash^1
local reslasher=lpeg.replacer(S("\\/"),"/")
local deslasher=lpeg.replacer(S("\\/")^1,"/")
-function file.join(...)
- local lst={... }
- local one=lst[1]
+function file.join(one,two,three,...)
+ if not two then
+ return one=="" and one or lpegmatch(stripper,one)
+ end
+ if one=="" then
+ return lpegmatch(stripper,three and concat({ two,three,... },"/") or two)
+ end
if lpegmatch(isnetwork,one) then
local one=lpegmatch(reslasher,one)
- local two=lpegmatch(deslasher,concat(lst,"/",2))
+ local two=lpegmatch(deslasher,three and concat({ two,three,... },"/") or two)
if lpegmatch(hasroot,two) then
return one..two
else
return one.."/"..two
end
elseif lpegmatch(isroot,one) then
- local two=lpegmatch(deslasher,concat(lst,"/",2))
+ local two=lpegmatch(deslasher,three and concat({ two,three,... },"/") or two)
if lpegmatch(hasroot,two) then
return two
else
return "/"..two
end
- elseif one=="" then
- return lpegmatch(stripper,concat(lst,"/",2))
else
- return lpegmatch(deslasher,concat(lst,"/"))
+ return lpegmatch(deslasher,concat({ one,two,three,... },"/"))
end
end
local drivespec=R("az","AZ")^1*colon
@@ -8854,7 +8856,7 @@ local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplis
local lookuphash=resources.lookuphash
local lookuptypes=resources.lookuptypes
local ligatures={}
- local alternate=tonumber(value)
+ local alternate=tonumber(value) or true and 1
local defaultalt=otf.defaultbasealternate
local trace_singles=trace_baseinit and trace_singles
local trace_alternatives=trace_baseinit and trace_alternatives
@@ -9045,7 +9047,7 @@ local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplis
local lookuphash=resources.lookuphash
local lookuptypes=resources.lookuptypes
local ligatures={}
- local alternate=tonumber(value)
+ local alternate=tonumber(value) or true and 1
local defaultalt=otf.defaultbasealternate
local trace_singles=trace_baseinit and trace_singles
local trace_alternatives=trace_baseinit and trace_alternatives
@@ -9061,7 +9063,7 @@ local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplis
end
changed[unicode]=data
elseif lookuptype=="alternate" then
- local replacement=data[alternate]
+ local replacement=data[alternate]
if replacement then
changed[unicode]=replacement
if trace_alternatives then
@@ -9154,7 +9156,7 @@ local function featuresinitializer(tfmdata,value)
if true then
local starttime=trace_preparing and os.clock()
local features=tfmdata.shared.features
- local fullname=trace_preparing and tfmdata.properties.fullname
+ local fullname=tfmdata.properties.fullname or "?"
if features then
applybasemethod("initializehashes",tfmdata)
local collectlookups=otf.collectlookups
@@ -9174,20 +9176,21 @@ local function featuresinitializer(tfmdata,value)
if order then
for i=1,#order do
local feature=order[i]
- if features[feature] then
+ local value=features[feature]
+ if value then
local validlookups,lookuplist=collectlookups(rawdata,feature,script,language)
if not validlookups then
elseif basesubstitutions and basesubstitutions[feature] then
if trace_preparing then
- report_prepare("filtering base feature %a for %a",feature,fullname)
+ report_prepare("filtering base %s feature %a for %a with value %a","sub",feature,fullname,value)
end
applybasemethod("preparesubstitutions",tfmdata,feature,value,validlookups,lookuplist)
registerbasefeature(feature,value)
elseif basepositionings and basepositionings[feature] then
if trace_preparing then
- report_prepare("filtering base feature %a for %a",feature,fullname)
+ report_prepare("filtering base %a feature %a for %a with value %a","pos",feature,fullname,value)
end
- applybasemethod("preparepositionings",tfmdata,feature,features[feature],validlookups,lookuplist)
+ applybasemethod("preparepositionings",tfmdata,feature,value,validlookups,lookuplist)
registerbasefeature(feature,value)
end
end