From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/112698 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Joey McCollum via ntg-context Newsgroups: gmane.comp.tex.context Subject: Implementing a custom authorconversion for bibliographies Date: Fri, 3 Sep 2021 22:48:44 -0400 Message-ID: Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============9174169359453163084==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37144"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Joey McCollum To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sat Sep 04 04:49:25 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 1mMLkD-0009WG-Dm for gctc-ntg-context-518@m.gmane-mx.org; Sat, 04 Sep 2021 04:49:25 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id C407C286E7E; Sat, 4 Sep 2021 04:49:00 +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 IXoCu9kKZjCE; Sat, 4 Sep 2021 04:48:59 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 565C92870BF; Sat, 4 Sep 2021 04:48:59 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id CB1D528704C for ; Sat, 4 Sep 2021 04:48:57 +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 SivCcQmBqVXt for ; Sat, 4 Sep 2021 04:48:56 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.166.177; helo=mail-il1-f177.google.com; envelope-from=jmccollum20140511@gmail.com; receiver= Original-Received: from mail-il1-f177.google.com (mail-il1-f177.google.com [209.85.166.177]) (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 8741E286E7E for ; Sat, 4 Sep 2021 04:48:56 +0200 (CEST) Original-Received: by mail-il1-f177.google.com with SMTP id g8so863792ilc.5 for ; Fri, 03 Sep 2021 19:48:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=oVSx6oAXLYj/lryy6zF6bwfyTHGUHNnQqjjQFuMJ67g=; b=OCnzYlf39/lK4deglVhDMzqFHxaUFG5EaX7KhOvyKTZfD69rh3anKQxqn5idffgu28 YrYEx9hrimJy08Vu36DG/ziRYul4lYbnBxo6k7ot5KYDfRY1h47trbGZiDeX21gUhMtd lZaXmJuP1AbNrtkih1KViGBlUTOFCAVPwCbrBCMw2G1eTgyMaJ2KuFzDoWJSqPbzKT9L MaY8jCGNoSuNxc4+WsHUPA3vAAB11uQuoGm9XuQuasa+zgj6utfjxvlAGjsB1ewXyQ3z K8aQRgJxszPqFdMR31G5WgARobC1I7EBsDttlX6z4TataYvRVOuXa2r4QRs+RWizuSM/ ELKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=oVSx6oAXLYj/lryy6zF6bwfyTHGUHNnQqjjQFuMJ67g=; b=QSuNfcNxDXV5057xcsTyoWx4kaIjrocNBtRLbLbvMIR+6dycImfNZH3ZJCa+MAxxJB D5ZxZJBQqbD3cLAcwq4arbzscAOwAykoA56PH2DCycPZUDY3rH5jQrZWrQHSooWa/s6L vgRn8Oz7zfTtkaQM5ARglCFf6vI8/QuxyJ3Rvtd4dBwUE/41lCsPbtU9Cv+/juOeLrHW zPoX8BddcPwUUYLQF7jCtIPYzISDhZvXkhfmcDYeCC191GeyTaBZyU4O9IO1bwSry55a GB0tKfEqbloJZIeSEqkP2YICvDVdIx1ycCzGwSN0amjvevoUpjm7XaERs/27fK5AmNlu uacg== X-Gm-Message-State: AOAM5339zHHiklUpDG5Yn0Ik3XALXcKqwBwLLgr4akfNnuzZQwvJLzhf C5F2AG/P5yHyolQ1LgehfG/XjoFSlBRj0EUax5BJMlLf6sg= X-Google-Smtp-Source: ABdhPJzZ5dpQJnf+Ni9/rCsIMy40KTxoz+Gmfl9n6Gxezo2Vketq2QSVXxZvEE3Ywd6cIERzzmQfJ7AL5iaQajloRRY= X-Received: by 2002:a05:6e02:dcc:: with SMTP id l12mr1385131ilj.20.1630723734614; Fri, 03 Sep 2021 19:48:54 -0700 (PDT) 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:112698 Archived-At: --===============9174169359453163084== Content-Type: multipart/alternative; boundary="000000000000edb70305cb227438" --000000000000edb70305cb227438 Content-Type: text/plain; charset="UTF-8" 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 --000000000000edb70305cb227438 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

I mentioned this in an earlier e-ma= il=C2=A0but 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 fir= st author in a list differently than the remaining authors in the=C2=A0list= . Specifically, I'd like to use the "inverted" authorconversi= on for the first author and the "normal" authorconversion for the= rest.

In the newer bibl-bib.lua=C2=A0file, I can = see what I might have to modify to accomplish this (I added the=C2=A0 if combiner =3D=3D "invertedfirst"=C2=A0 block):

```
fu= nction authors.concat(author,combiner,what,settings)
=C2=A0 =C2=A0 if ty= pe(combiner) =3D=3D "string" then
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = combiner =3D authors[combiner or "normal"] or authors.normal
= =C2=A0 =C2=A0 end
=C2=A0 =C2=A0 local split =3D splitauthors(author)
= =C2=A0 =C2=A0 local setting =3D settings[what]
=C2=A0 =C2=A0 local etall= imit, etaldisplay, etaltext =3D 1000, 1000, ""
=C2=A0 =C2=A0 i= f setting then
=C2=A0 =C2=A0 =C2=A0 =C2=A0 etallimit =C2=A0 =3D settings= .etallimit =C2=A0 or 1000
=C2=A0 =C2=A0 =C2=A0 =C2=A0 etaldisplay =3D se= ttings.etaldisplay or etallimit
=C2=A0 =C2=A0 =C2=A0 =C2=A0 etalltext = =C2=A0 =3D settings.etaltext =C2=A0 =C2=A0or ""
=C2=A0 =C2=A0 = end
=C2=A0 =C2=A0 local max =3D #split
=C2=A0 =C2=A0 if max > etal= limit and etaldisplay < max then
=C2=A0 =C2=A0 =C2=A0 =C2=A0 max =3D = etaldisplay
=C2=A0 =C2=A0 end
=C2=A0 =C2=A0 if combiner =3D=3D "= invertedfirst" then
=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 if i =3D=3D 1 then
=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 else
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 split[i] =3D author= s.normal(split[i],settings)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 en= d
=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 else
=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 split[i] =3D combiner(split= [i],settings)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 end
=C2=A0 =C2=A0 end
= =C2=A0 =C2=A0 local result =3D bibtexconcat(split,settings)
=C2=A0 =C2= =A0 if max < #split then
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return result=C2=A0 =C2=A0 else
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return result .. etaltex= t
=C2=A0 =C2=A0 end
end
```

Unfortunately, this doesn't= seem to do anything. It's not clear to me how=C2=A0bibl-bib.lua and bi= bl-bib.mkiv are being used by the other publication support modules, if the= y'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 "inver= tedfirst" a working authorconversion? Is there a similar block of code= in publ-ini.lua where I should be implementing this change instead?
<= div>
Thanks!

Joey
--000000000000edb70305cb227438-- --===============9174169359453163084== 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== --===============9174169359453163084==--