From 9020c3ed65292094f6ec3dcc53e512b5eb5ec890 Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Fri, 31 Oct 2014 00:15:03 +0100 Subject: 2014-10-31 00:13:00 --- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4381 -> 4382 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/publ-aut.lua | 49 +++++++++++++++------ tex/context/base/status-files.pdf | Bin 24702 -> 24706 bytes tex/context/base/status-lua.pdf | Bin 333910 -> 333908 bytes tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 7 files changed, 39 insertions(+), 16 deletions(-) (limited to 'tex') diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index ffa81330a..642a38063 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.10.30 20:05} +\newcontextversion{2014.10.31 00:11} %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 3bce35aea..0d9ec2303 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 91a684a24..6557a4e11 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.10.30 20:05} +\edef\contextversion{2014.10.31 00:11} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/publ-aut.lua b/tex/context/base/publ-aut.lua index ed02ace54..f483075a1 100644 --- a/tex/context/base/publ-aut.lua +++ b/tex/context/base/publ-aut.lua @@ -47,10 +47,15 @@ local report = logs.reporter("publications","authors") local space = P(" ") local comma = P(",") +local period = P(".") +local dash = P("-") local firstcharacter = lpegpatterns.utf8byte +local utf8character = lpegpatterns.utf8character local p_and = space^1 * "and" * space^1 local p_comma = space^0 * comma * space^0 local p_space = space^1 +local p_shortone = C((utf8character -dash-period)^1) +local p_longone = C( utf8character) * (1-dash-period)^0 local andsplitter = Ct { "start", start = (Cs((V("inner") + (1-p_and))^1) + p_and)^1, @@ -69,6 +74,10 @@ local spacesplitter = Ct { "start", inner = P("{") * ((V("inner") + P(1-P("}")))^1) * P("}"), } +local p_initial = p_shortone * period * dash^0 + + p_longone * (period + dash + P(-1)) +local initialsplitter = p_initial * P(-1) + Ct((p_initial)^1) + local function is_upper(str) local first = lpegmatch(firstcharacter,str) local okay = chardata[first] @@ -185,7 +194,7 @@ local function splitauthorstring(str) if firstnames then initials = { } for i=1,#firstnames do - initials[i] = utfchar(lpegmatch(firstcharacter,firstnames[i])) + initials[i] = lpegmatch(initialsplitter,firstnames[i]) end end detail = { @@ -206,16 +215,30 @@ end authors.splitstring = splitauthorstring -local function the_initials(initials,symbol) - if not symbol or symbol == "" then - return initials - else - local result = { } - for i=1,#initials do - result[i] = initials[i] .. symbol +local function the_initials(initials,symbol,connector) + if not symbol then + symbol = "." + end + if not connector then + connector = "-" + end + local result, r = { }, 0 + for i=1,#initials do + local initial = initials[i] + if type(initial) == "table" then + for i=1,#initial do + if i > 1 then + r = r + 1 ; result[r] = connector + end + r = r + 1 ; result[r] = initial[i] + r = r + 1 ; result[r] = symbol + end + else + r = r + 1 ; result[r] = initial + r = r + 1 ; result[r] = symbol end - return result end + return result end local ctx_btxsetconcat = context.btxsetconcat @@ -255,7 +278,7 @@ local function value(i,field) end end -function commands.btx_a_i(i) local v = value(i,"initials") if v then context(concat(the_initials(v,currentauthorsymbol or "."))) end end +function commands.btx_a_i(i) local v = value(i,"initials") if v then context(concat(the_initials(v,currentauthorsymbol))) end end function commands.btx_a_f(i) local v = value(i,"firstnames") if v then context(concat(v," ")) end end function commands.btx_a_j(i) local v = value(i,"juniors") if v then context(concat(v," ")) end end function commands.btx_a_s(i) local v = value(i,"surnames") if v then context(concat(v," ")) end end @@ -277,7 +300,7 @@ function commands.btxauthorfield(i,field) context(applymanipulation(manipulator,value) or value) end elseif field == "initials" then - context(concat(the_initials(value,currentauthorsymbol or "."))) + context(concat(the_initials(value,currentauthorsymbol))) else context(concat(value," ")) end @@ -392,7 +415,7 @@ local function components(snippet,short) return vons and #vons > 0 and concat(vons, " ") or "", surnames and #surnames > 0 and concat(surnames, " ") or "", - initials and #initials > 0 and concat(initials, " ") or "", + initials and #initials > 0 and concat(the_initials(initials)) or "", firstnames and #firstnames > 0 and concat(firstnames," ") or "", juniors and #juniors > 0 and concat(juniors, " ") or "" end @@ -425,7 +448,7 @@ local function writer(key,snippets) s = s + 1 ; snippets[s] = concat(surnames," ") end if initials and #initials > 0 then - s = s + 1 ; snippets[s] = concat(initials," ") + s = s + 1 ; snippets[s] = concat(the_initials(initials," ","")," ") -- todo: configure . and - end if juniors and #juniors > 0 then s = s + 1 ; snippets[s] = concat(juniors," ") diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 1af607c01..9826aa676 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index 027f891fc..c6983a8ee 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index d47158c88..b2cf24d9e 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 : 10/30/14 20:05:59 +-- merge date : 10/31/14 00:11:07 do -- begin closure to overcome local limits and interference -- cgit v1.2.3