From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/112863 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 13:01:35 -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="===============1920888727391228755==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28640"; 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 19:02:30 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 1mQYIo-0007Iu-Fo for gctc-ntg-context-518@m.gmane-mx.org; Wed, 15 Sep 2021 19:02:30 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id A70022873E2; Wed, 15 Sep 2021 19:01:56 +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 SC3HwtOFnM73; Wed, 15 Sep 2021 19:01:54 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id A16952875DF; Wed, 15 Sep 2021 19:01:54 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 4009F2875AF for ; Wed, 15 Sep 2021 19:01:52 +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 kA95oSwbFLUg for ; Wed, 15 Sep 2021 19:01:50 +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 6665D2873E2 for ; Wed, 15 Sep 2021 19:01:50 +0200 (CEST) Original-Received: by mail-io1-f46.google.com with SMTP id g9so4325757ioq.11 for ; Wed, 15 Sep 2021 10:01:50 -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=uazcFHQhxPquDw6N3PZbioY0DIVZSKx9ENpsHdXvbF4=; b=g3T3bLzZV8R0Yu9Cry0XiFKeayaCKqtGucqFsNF/U7sdvXyYe7p7XFiu8DJ0+n0lSf vMDM+MqIPtX0CvpoAll8V48B8R7anh1WSudlrJI3BZOpatIqcHvm/IdbQ4azNLi/vM2g eIU0x1gb4tLNgK0m4PyNdRxW2NSg6Dh1XDVZnJSg8OdU/mGyyB2d6WRYWFlg5ljfvKLK vL+CG5Z5Tv2/MjQDwS/gHEP71V3twajK4/N3DVtsX4TyJ4z3hep9fqzDd1spPNc6Uwbx 8WucBKm0fmNRyFCkiUhi+TTNCptSiv2iDWIIo+sNnoM+tAwryA+WcFCqndFtR4ylYvi2 /1sg== 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=uazcFHQhxPquDw6N3PZbioY0DIVZSKx9ENpsHdXvbF4=; b=lpLNKLPhPgVUP1ExNsdlJx5pnukKEMhIa1Rd6LeoIjUqq2jQfqmh0A72rNQebEEjGP ayOoFAVItUKphWu9/eSsMQoRQbaCgllSMV4NaAUdZ6x22hoEuXVPgsfIBsR0XTqEEtSy 1mRYi6QOXVG4VqrClxB5rc1/NMO6p0XRh9DHG7gylvG/UmkUdHnxXibSSWgPJhEifDt8 k9FJXV9NI0e/BekDJhqpkYrJLUNbEMLHo3kSYLmRfwzrKz/A6Cj1LSSlYmo1dFf1lD6B heHIwqGn0K2BSDjMuD+oqWLx8DcykrQplidlFeF7lOonyfJPibGrUbDvKUtnChJ2zJ9Y Wt2g== X-Gm-Message-State: AOAM531z5CyVDq917uHr04R9QLFAg3wF6eeD/2Ee7rTsbpnaqt+ACNlp 3NAKAO1z3+JqZ++cOexHERjbbaKzAp7e5k7z3XE= X-Google-Smtp-Source: ABdhPJxsegHHSLKSnWy3Pojp3aVvxWwQoov0PRyyFDgbwboTrnmqCxszMw3r6OtL+gYsb+j8dkDiPQYF0nb6C7cfre0= X-Received: by 2002:a05:6602:340a:: with SMTP id n10mr861620ioz.188.1631725308821; Wed, 15 Sep 2021 10:01:48 -0700 (PDT) In-Reply-To: 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:112863 Archived-At: --===============1920888727391228755== Content-Type: multipart/alternative; boundary="00000000000067460e05cc0ba75b" --00000000000067460e05cc0ba75b Content-Type: text/plain; charset="UTF-8" Looks like it was just a small oversight on my part; I had to make sure I added a corresponding \s!btx:\s!list:\s!author:invertedfirst setup for list entries. Here's what finally works: ``` \startsetups \s!btx:\s!cite:\s!author:invertedfirst \ifnum\currentbtxauthorindex>\plusone \fastsetup{\s!btx:\s!cite:\s!author:normal} \else \fastsetup{\s!btx:\s!cite:\s!author:inverted} \fi \stopsetups ... \startsetups \s!btx:\s!list:\s!author:invertedfirst \ifnum\currentbtxauthorindex>\plusone \fastsetup{\s!btx:\s!list:\s!author:normal} \else \fastsetup{\s!btx:\s!list:\s!author:inverted} \fi \stopsetups ``` Thanks again, Hans! Joey On Wed, Sep 15, 2021 at 10:13 AM Joey McCollum wrote: > 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 >> ----------------------------------------------------------------- >> > --00000000000067460e05cc0ba75b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Looks like it was just a small oversight on my part; I had= to make sure I added a corresponding=C2=A0\s!btx:\s!list:\s!author:inverte= dfirst setup for list entries. Here's what finally works:

```\startsetups \s!btx:\s!cite:\s!author:invertedfirst
=C2=A0 =C2=A0 \ifnu= m\currentbtxauthorindex>\plusone
=C2=A0 =C2=A0 =C2=A0 =C2=A0 \fastset= up{\s!btx:\s!cite:\s!author:normal}
=C2=A0 =C2=A0 \else
=C2=A0 =C2=A0= =C2=A0 =C2=A0 \fastsetup{\s!btx:\s!cite:\s!author:inverted}
=C2=A0 =C2= =A0 \fi
\stopsetups

...

\sta= rtsetups \s!btx:\s!list:\s!author:invertedfirst
=C2=A0 =C2=A0 \ifnum\cur= rentbtxauthorindex>\plusone
=C2=A0 =C2=A0 =C2=A0 =C2=A0 \fastsetup{\s= !btx:\s!list:\s!author:normal}
=C2=A0 =C2=A0 \else
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 \fastsetup{\s!btx:\s!list:\s!author:inverted}
=C2=A0 =C2=A0 \= fi
\stopsetups
```

Thanks again, Hans!
=

Joey

On Wed, Sep 15, 2021 at 10:13 AM Joey McCollu= m <jmccollum20140511@gmai= l.com> wrote:
Good suggestion! = I removed my changes to publ-aut.lua for now and tried adding each of the t= wo setups you described to publ-imp-author.mkvi (where it seemed to fit bes= t). But simply specifying=C2=A0

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

in my custom rendering file does not ac= cess 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 A= M Hans Hagen <j.hagen@xs4all.nl> wrote:
On 9/15/2021 5:06 AM, Joey McCo= llum 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
-----------------------------------------------------------------
--00000000000067460e05cc0ba75b-- --===============1920888727391228755== 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== --===============1920888727391228755==--