From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/112860 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Joey McCollum via ntg-context Newsgroups: gmane.comp.tex.context Subject: Re: Implementing a custom authorconversion for bibliographies Date: Wed, 15 Sep 2021 10:13:21 -0400 Message-ID: References: <0a3d6a27-30b2-90eb-1ddd-a8b732e2ae4a@xs4all.nl> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2365768056253094810==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6878"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Joey McCollum To: Hans Hagen , mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Wed Sep 15 16:14:21 2021 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mQVg4-0001ZT-VA for gctc-ntg-context-518@m.gmane-mx.org; Wed, 15 Sep 2021 16:14:20 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id C32DD2875E2; Wed, 15 Sep 2021 16:13:44 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fk4QmmFCKnWD; Wed, 15 Sep 2021 16:13:42 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 2C79E2875E3; Wed, 15 Sep 2021 16:13:42 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 9A55D2875DF for ; Wed, 15 Sep 2021 16:13:39 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mL7FrXxRFT-g for ; Wed, 15 Sep 2021 16:13:37 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.166.46; helo=mail-io1-f46.google.com; envelope-from=jmccollum20140511@gmail.com; receiver= Original-Received: from mail-io1-f46.google.com (mail-io1-f46.google.com [209.85.166.46]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 61095287289 for ; Wed, 15 Sep 2021 16:13:37 +0200 (CEST) Original-Received: by mail-io1-f46.google.com with SMTP id q3so3613901iot.3 for ; Wed, 15 Sep 2021 07:13:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=JdvBDLZAr1j283sMxwxErtsgDGD+KwmZ5uejyKXBLOA=; b=lwWDcxoFZEq8X3zR5iDxaLTxXvkI3I5AJu4k7If4f921R/GZGLFstNVqK98aBiDhXW w5kgKkeNOiKt4IbQKOb7B+GQjoSNWGH7lcK2hBcyoyux3VbnZSY3wwODD565E5eznzNG m31u8G7iwd0YMa2yBzk0HBZYimdNeoz6RDUWkaTULyk3BaGVrTXMU/ToZwc2n6bJg+Me h9AE5JeGjNk/YMoFxzbgc4G6tS/ZBp/uwaA9c7MoAtpa9zvG5/pkrAq6SPexQgK3ESKx qDfRMOCd7iCx254K5G52hR7pKrZM4JDqaTvBRn9dfaQ0u8a/MpGouhPGfDSfxAxUgiW1 fQrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=JdvBDLZAr1j283sMxwxErtsgDGD+KwmZ5uejyKXBLOA=; b=PK2lWhJhTER34w+VDwIwwCwKesCiI8gedBHZO14URceGd+G/DK/WR2776spN1f2c/Q ET1IjVsiNVJ8U4OTLd2QfVeUFEpN4Cw6PAfEObxgBX/EfWYykJwPzHKFL4sef0JPZIbw iy6B8O7z8Cov7ggEUP1T8BvPZZroqJ78lsyiu0jd+is5Nw6jzhcAc557rrIIvr3xcvXm vJ/btTUsUwBweeGHURdZALz6xZUGVxjC4GptJBDYnusPi1zJabEc0ERkW9lUG2vWE/wT nN+I+j/s2gGh8jEk11N7vwhMmVS/cfiuRgqObjZIbbJSknyf3SAFJ0A7Kmtp5CqRNBTV /KSQ== X-Gm-Message-State: AOAM533N6SPc1mC+n9A/ZYSQ3MS7uKHdm81cOO762LesaRFVOzlod8Jb SlXbSo6UAMs8iln7QLHsQ1fP/2Fi3YHYl+bXmto= X-Google-Smtp-Source: ABdhPJxJ2IzN03lFuuAdWC8AGlF9EnxCbbv0vDkAFlX7FxQ8vnkEV7xfnbb8cSmGEmUkHzQj5vmqijo0oB+m3EZc/t4= X-Received: by 2002:a05:6602:340a:: with SMTP id n10mr186620ioz.188.1631715215419; Wed, 15 Sep 2021 07:13:35 -0700 (PDT) In-Reply-To: <0a3d6a27-30b2-90eb-1ddd-a8b732e2ae4a@xs4all.nl> X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:112860 Archived-At: --===============2365768056253094810== Content-Type: multipart/alternative; boundary="000000000000ca2ed705cc094d59" --000000000000ca2ed705cc094d59 Content-Type: text/plain; charset="UTF-8" Good suggestion! I removed my changes to publ-aut.lua for now and tried adding each of the two setups you described to publ-imp-author.mkvi (where it seemed to fit best). But simply specifying ``` \definebtx [sbl:\s!list:author] [sbl:\s!list] [\c!authorconversion=invertedfirst] ``` in my custom rendering file does not access the invertedfirst setup, regardless of which of the two setups I use. Do I have to do something different to access it? Thanks! On Wed, Sep 15, 2021 at 4:18 AM Hans Hagen wrote: > On 9/15/2021 5:06 AM, Joey McCollum via ntg-context wrote: > > All right, I figured out where I needed to make this change for it to > > take effect. The relevant script is publ-aut.lua. The code I needed to > > change was for the "oneauthor" function definition, which itself is > > located in the "btxauthor" function definition. My changes are detailed > > below: > > did you try to stay at the tex end? like: > > % \startsetups \s!btx:\s!cite:\s!author:invertedfirst > % \ifnum\currentbtxauthorindex>\plusone > % \btxsetauthorvariant{inverted} > % \else > % \btxsetauthorvariant{normal} > % \fi > % \fastsetup{\s!btx:\s!cite:\s!author:\btxauthorvariant} > % \stopsetups > > \startsetups \s!btx:\s!cite:\s!author:invertedfirst > \ifnum\currentbtxauthorindex>\plusone > \fastsetup{\s!btx:\s!cite:\s!author:inverted} > \else > \fastsetup{\s!btx:\s!cite:\s!author:normal} > \fi > \stopsetups > > > > > ``` > > local function oneauthor(i,last,justone) > > local author = split[i] > > if index then > > ctx_btxstartauthor(i,1,0) > > elseif last then > > ctx_btxstartauthor(i,1,0) > > ctx_btxsetconcat(0) > > if combiner == "invertedfirst" then > > if i == 1 then > > ctx_btxsetauthorvariant("inverted") > > else > > ctx_btxsetauthorvariant("normal") > > end > > else > > ctx_btxsetauthorvariant(combiner) > > end > > else > > local state = author.state or 0 > > ctx_btxstartauthor(i,max,state) > > ctx_btxsetconcat(concatstate(i,max)) > > if combiner == "invertedfirst" then > > if i == 1 then > > ctx_btxsetauthorvariant("inverted") > > else > > ctx_btxsetauthorvariant("normal") > > end > > else > > ctx_btxsetauthorvariant(combiner) > > end > > end > > local initials = author.initials > > if initials and #initials > 0 then > > ctx_btxsetinitials() -- > > (concat(the_initials(initials,symbol)," ")) > > end > > local firstnames = author.firstnames > > if firstnames and #firstnames > 0 then > > ctx_btxsetfirstnames() -- (concat(firstnames," ")) > > end > > local vons = author.vons > > if vons and #vons > 0 then > > ctx_btxsetvons() -- (concat(vons," ")) > > end > > local surnames = author.surnames > > if surnames and #surnames > 0 then > > ctx_btxsetsurnames() -- (concat(surnames," ")) > > end > > local juniors = author.juniors > > if juniors and #juniors > 0 then > > ctx_btxsetjuniors() -- (concat(juniors," ")) > > end > > if not index and i == max then > > if split.others then > > ctx_btxsetoverflow(1) > > else > > local overflow = #split - max > > if overflow > 0 then > > ctx_btxsetoverflow(overflow) > > end > > end > > end > > if combiner == "invertedfirst" then > > if i == 1 then > > ctx_btxsetup("inverted") > > else > > ctx_btxsetup("normal") > > end > > else > > ctx_btxsetup(combiner) > > end > > ctx_btxstopauthor() > > end > > ``` > > > > I'll admit that the addition of entire if-else blocks around whether or > > not the combiner is a specific value may not be the best practice in > > terms of future maintenance (especially if similar index-dependent > > authorconversions are needed in the future). Alternatively, the > > "btxauthor" function could populate a "combiners" array of length "max" > > with a specific authorconversion for each author in the split; for most > > authorconversions, all entries in this array would be the same, but for > > authorconversions like "invertedfirst", the first entry would be > > different from the rest. Then, the "oneauthor" function could just > > reference combiners[i] instead of combiner. > > > > Joey > > > > On Fri, Sep 3, 2021 at 10:48 PM Joey McCollum > > > > wrote: > > > > Hi, > > > > I mentioned this in an earlier e-mail but thought that now might be > > a good time to describe this issue in detail. I'd like to define a > > new authorconversion that renders the first author in a list > > differently than the remaining authors in the list. Specifically, > > I'd like to use the "inverted" authorconversion for the first author > > and the "normal" authorconversion for the rest. > > > > In the newer bibl-bib.lua file, I can see what I might have to > > modify to accomplish this (I added the if combiner == > > "invertedfirst" block): > > > > ``` > > function authors.concat(author,combiner,what,settings) > > if type(combiner) == "string" then > > combiner = authors[combiner or "normal"] or authors.normal > > end > > local split = splitauthors(author) > > local setting = settings[what] > > local etallimit, etaldisplay, etaltext = 1000, 1000, "" > > if setting then > > etallimit = settings.etallimit or 1000 > > etaldisplay = settings.etaldisplay or etallimit > > etalltext = settings.etaltext or "" > > end > > local max = #split > > if max > etallimit and etaldisplay < max then > > max = etaldisplay > > end > > if combiner == "invertedfirst" then > > for i=1,max do > > if i == 1 then > > split[i] = authors.inverted(split[i],settings) > > else > > split[i] = authors.normal(split[i],settings) > > end > > > > end > > else > > for i=1,max do > > split[i] = combiner(split[i],settings) > > end > > end > > local result = bibtexconcat(split,settings) > > if max < #split then > > return result > > else > > return result .. etaltext > > end > > end > > ``` > > > > Unfortunately, this doesn't seem to do anything. It's not clear to > > me how bibl-bib.lua and bibl-bib.mkiv are being used by the other > > publication support modules, if they're being used at all > > (publ-ini.mkiv doesn't appear to register it, anyway). Is there > > another file I'd have to change to make "invertedfirst" a working > > authorconversion? Is there a similar block of code in publ-ini.lua > > where I should be implementing this change instead? > > > > Thanks! > > > > Joey > > > > > > > ___________________________________________________________________________________ > > If your question is of interest to others as well, please add an entry > to the Wiki! > > > > maillist : ntg-context@ntg.nl / > http://www.ntg.nl/mailman/listinfo/ntg-context > > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > > archive : https://bitbucket.org/phg/context-mirror/commits/ > > wiki : http://contextgarden.net > > > ___________________________________________________________________________________ > > > > > -- > > ----------------------------------------------------------------- > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl > ----------------------------------------------------------------- > --000000000000ca2ed705cc094d59 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Good suggestion! I rem= oved my changes to publ-aut.lua for now and tried adding each of the two se= tups you described to publ-imp-author.mkvi (where it seemed to fit best). B= ut simply specifying=C2=A0

```
\definebtx
=C2=A0 [sbl:\s!list:= author]
=C2=A0 [sbl:\s!list]
=C2=A0 [\c!authorconversion=3Dinvertedfi= rst]
```

in my custom rendering file does not access = the invertedfirst setup, regardless of which of the two setups I use. Do I = have to do something different to access it?

Thanks!

On Wed, Sep 15, 2021 at 4:18 AM Han= s Hagen <j.hagen@xs4all.nl> wrote:
On 9/15/2021 5:06 AM, Joey McCollum = via ntg-context wrote:
> All right, I figured out where I needed to make this change for it to =
> take effect. The relevant script is publ-aut.lua. The code I needed to=
> change was for the "oneauthor" function definition, which it= self is
> located in the "btxauthor" function definition. My changes a= re detailed
> below:

did you try to stay at the tex end? like:

% \startsetups \s!btx:\s!cite:\s!author:invertedfirst
%=C2=A0 =C2=A0 =C2=A0\ifnum\currentbtxauthorindex>\plusone
%=C2=A0 =C2=A0 =C2=A0 =C2=A0 \btxsetauthorvariant{inverted}
%=C2=A0 =C2=A0 =C2=A0\else
%=C2=A0 =C2=A0 =C2=A0 =C2=A0 \btxsetauthorvariant{normal}
%=C2=A0 =C2=A0 =C2=A0\fi
%=C2=A0 =C2=A0 =C2=A0\fastsetup{\s!btx:\s!cite:\s!author:\btxauthorvariant}=
% \stopsetups

\startsetups \s!btx:\s!cite:\s!author:invertedfirst
=C2=A0 =C2=A0 =C2=A0\ifnum\currentbtxauthorindex>\plusone
=C2=A0 =C2=A0 =C2=A0 =C2=A0 \fastsetup{\s!btx:\s!cite:\s!author:inverted} =C2=A0 =C2=A0 =C2=A0\else
=C2=A0 =C2=A0 =C2=A0 =C2=A0 \fastsetup{\s!btx:\s!cite:\s!author:normal}
=C2=A0 =C2=A0 =C2=A0\fi
\stopsetups



> ```
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 local function oneauthor(i,last,just= one)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 local author =3D split= [i]
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if index then
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ctx_btxs= tartauthor(i,1,0)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 elseif last then
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ctx_btxs= tartauthor(i,1,0)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ctx_btxs= etconcat(0)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if combi= ner =3D=3D "invertedfirst" then
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 if i =3D=3D 1 then
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 ctx_btxsetauthorvariant("inverted")
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 else
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 ctx_btxsetauthorvariant("normal")
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 end
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 else
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 ctx_btxsetauthorvariant(combiner)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 end
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 else
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 local st= ate =3D author.state or 0
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ctx_btxs= tartauthor(i,max,state)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ctx_btxs= etconcat(concatstate(i,max))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if combi= ner =3D=3D "invertedfirst" then
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 if i =3D=3D 1 then
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 ctx_btxsetauthorvariant("inverted")
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 else
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 ctx_btxsetauthorvariant("normal")
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 end
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 else
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 ctx_btxsetauthorvariant(combiner)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 end
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 end
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 local initials =3D aut= hor.initials
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if initials and #initi= als > 0 then
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ctx_btxs= etinitials() --
> (concat(the_initials(initials,symbol)," "))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 end
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 local firstnames =3D a= uthor.firstnames
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if firstnames and #fir= stnames > 0 then
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ctx_btxs= etfirstnames() -- (concat(firstnames," "))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 end
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 local vons =3D author.= vons
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if vons and #vons >= 0 then
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ctx_btxs= etvons() -- (concat(vons," "))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 end
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 local surnames =3D aut= hor.surnames
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if surnames and #surna= mes > 0 then
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ctx_btxs= etsurnames() -- (concat(surnames," "))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 end
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 local juniors =3D auth= or.juniors
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if juniors and #junior= s > 0 then
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ctx_btxs= etjuniors() -- (concat(juniors," "))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 end
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if not index and i =3D= =3D max then
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if split= .others then
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 ctx_btxsetoverflow(1)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 else
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 local overflow =3D #split - max
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 if overflow > 0 then
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 ctx_btxsetoverflow(overflow)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 end
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 end
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 end
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if combiner =3D=3D &qu= ot;invertedfirst" then
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if i =3D= =3D 1 then
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 ctx_btxsetup("inverted")
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 else
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 ctx_btxsetup("normal")
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 end
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 else
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ctx_btxs= etup(combiner)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 end
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ctx_btxstopauthor() >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 end
> ```
>
> I'll admit that the addition of entire if-else blocks around wheth= er or
> not the combiner is a specific value may not be the best practice in <= br> > terms of future maintenance (especially if similar index-dependent > authorconversions=C2=A0are needed in the future). Alternatively, the <= br> > "btxauthor"=C2=A0function could populate a "combiners&q= uot; array of length "max"
> with a specific authorconversion for each author in the split; for mos= t
> authorconversions, all entries in this array would be the same, but fo= r
> authorconversions like "invertedfirst", the first entry woul= d be
> different from the rest. Then, the "oneauthor" function coul= d just
> reference combiners[i] instead of combiner.
>
> Joey
>
> On Fri, Sep 3, 2021 at 10:48 PM Joey McCollum
> <jmccollum20140511@gmail.com <mailto:jmccollum20140511@gmail.com>> wrote:
>
>=C2=A0 =C2=A0 =C2=A0Hi,
>
>=C2=A0 =C2=A0 =C2=A0I mentioned this in an earlier e-mail=C2=A0but thou= ght that now might be
>=C2=A0 =C2=A0 =C2=A0a good time to describe this issue in detail. I'= ;d like to define a
>=C2=A0 =C2=A0 =C2=A0new authorconversion that renders the first author = in a list
>=C2=A0 =C2=A0 =C2=A0differently than the remaining authors in the=C2=A0= list. Specifically,
>=C2=A0 =C2=A0 =C2=A0I'd like to use the "inverted" author= conversion for the first author
>=C2=A0 =C2=A0 =C2=A0and the "normal" authorconversion for the= rest.
>
>=C2=A0 =C2=A0 =C2=A0In the newer bibl-bib.lua=C2=A0file, I can see what= I might have to
>=C2=A0 =C2=A0 =C2=A0modify to accomplish this (I added the if combiner = =3D=3D
>=C2=A0 =C2=A0 =C2=A0"invertedfirst"=C2=A0 block):
>
>=C2=A0 =C2=A0 =C2=A0```
>=C2=A0 =C2=A0 =C2=A0function authors.concat(author,combiner,what,settin= gs)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if type(combiner) =3D=3D "strin= g" then
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 combiner =3D authors[c= ombiner or "normal"] or authors.normal
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 end
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 local split =3D splitauthors(author)=
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 local setting =3D settings[what]
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 local etallimit, etaldisplay, etalte= xt =3D 1000, 1000, ""
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if setting then
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 etallimit =C2=A0 =3D s= ettings.etallimit =C2=A0 or 1000
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 etaldisplay =3D settin= gs.etaldisplay or etallimit
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 etalltext =C2=A0 =3D s= ettings.etaltext =C2=A0 =C2=A0or ""
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 end
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 local max =3D #split
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if max > etallimit and etaldispla= y < max then
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 max =3D etaldisplay >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 end
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if combiner =3D=3D "invertedfir= st" then
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 for i=3D1,max do
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if i =3D= =3D 1 then
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 split[i] =3D authors.inverted(split[i],settings)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 else
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 split[i] =3D authors.normal(split[i],settings)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 end
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 end
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 else
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 for i=3D1,max do
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 split[i]= =3D combiner(split[i],settings)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 end
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 end
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 local result =3D bibtexconcat(split,= settings)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if max < #split then
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return result
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 else
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return result .. etalt= ext
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 end
>=C2=A0 =C2=A0 =C2=A0end
>=C2=A0 =C2=A0 =C2=A0```
>
>=C2=A0 =C2=A0 =C2=A0Unfortunately, this doesn't seem to do anything= . It's not clear to
>=C2=A0 =C2=A0 =C2=A0me how=C2=A0bibl-bib.lua and bibl-bib.mkiv are bein= g used by the other
>=C2=A0 =C2=A0 =C2=A0publication support modules, if they're being u= sed at all
>=C2=A0 =C2=A0 =C2=A0(publ-ini.mkiv doesn't appear to register it, a= nyway). Is there
>=C2=A0 =C2=A0 =C2=A0another file I'd have to change to make "i= nvertedfirst" a working
>=C2=A0 =C2=A0 =C2=A0authorconversion? Is there a similar block of code = in publ-ini.lua
>=C2=A0 =C2=A0 =C2=A0where I should be implementing this change instead?=
>
>=C2=A0 =C2=A0 =C2=A0Thanks!
>
>=C2=A0 =C2=A0 =C2=A0Joey
>
>
> ______________________________________________________________________= _____________
> If your question is of interest to others as well, please add an entry= to the Wiki!
>
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage=C2=A0 : http://www.pragma-ade.nl / http://context.aanhet.net
> archive=C2=A0 : https://= bitbucket.org/phg/context-mirror/commits/
> wiki=C2=A0 =C2=A0 =C2=A0: http://contextgarden.ne= t
> ______________________________________________________________________= _____________
>


--

-----------------------------------------------------------------
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0Hans Hagen | PRAGMA ADE
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Ridderstraat 27 | 80= 61 GH Hasselt | The Netherlands
=C2=A0 =C2=A0 =C2=A0 =C2=A0 tel: 038 477 53 69 | www.p= ragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
--000000000000ca2ed705cc094d59-- --===============2365768056253094810== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============2365768056253094810==--