From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id QL2SBYZflmCHYQAAgWs5BA (envelope-from ) for ; Sat, 08 May 2021 11:53:10 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id SKCKAIZflmCiMQAAbx9fmQ (envelope-from ) for ; Sat, 08 May 2021 09:53:10 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 2A8E127DD7 for ; Sat, 8 May 2021 11:53:09 +0200 (CEST) Received: from localhost ([::1]:49462 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lfJe0-0006Js-BU for larch@yhetil.org; Sat, 08 May 2021 05:53:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51514) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lfJd1-0006J4-7g for emacs-orgmode@gnu.org; Sat, 08 May 2021 05:52:08 -0400 Received: from mail-io1-xd35.google.com ([2607:f8b0:4864:20::d35]:39659) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lfJcv-0001L5-5N for emacs-orgmode@gnu.org; Sat, 08 May 2021 05:52:06 -0400 Received: by mail-io1-xd35.google.com with SMTP id k25so10286793iob.6 for ; Sat, 08 May 2021 02:52:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=6lqOBlM3yXLgWps43bndmJWcc1pahkiB6sebntUBQvA=; b=b+jFlcSIlCHsSVS4c4whu6qf6gL13VOLHL+xN1fSkV1jF6irZn7x2z0ELnOlzfpIZl LX8S4pmvL7l+3MHGv+bMXoTr7/eTMrwHBtzRt50eQF3d4pjJEWEERPxm9ZQAYZqJG7sM oQB6sXZUFIOhIekOLKBf95/Z28aPQKsS7Oz0N5SECv53lcyiwgEkJrF5jOcnAnnJvuco wxCsHF9EwblOIv/aRwg+zzk0YkW0zDRe5eGYNK6yerXhrD4ZlKvULLQbxLJTGvgC6A5P IbWMv8X6Lr0SviBWcI5LYkTq5sB6N/sFbP74RzZLDaJxYb/EgIHPfQQi1q6YrsWoPBUQ 5f0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=6lqOBlM3yXLgWps43bndmJWcc1pahkiB6sebntUBQvA=; b=NRVvwUj2N1LYXaDsvCzgkGjaEdgL9lE+wiCIBKB1MtITKBDSS5T+kRnxGoBCimfWi4 N8FMplHyT5eXUeUzqaEb22aV3nOIi+3nnm2C5tpLRna/bfQtxhx+Bi64Vp4s5XI33Ac5 chw2wxBZVm9uD/f/0d0ux2oBXQcrFTSV9QeoiHAulWgIIXoLqOnbbLP+XbV9BPOmgGqB UayJCnFl3r0lxn4WOhG9KvhdyGY7hpY9zXgigfn10Ud2dbpe/8t/8EgouYzhFfLWI+0W xgEAB+XPUBeL/WdsIWsmlJRnqNva2jZYbSEl2OVT5dRco6g7MnMNh932VMsVitSG2+cl B2NA== X-Gm-Message-State: AOAM5318usixae9KIIa/2tj7ePXvN6P/B06DtFOsI9EFd+GY/eLelaGF 7x7s2JsWrQgYKELkegBAtxG3SGqP6pmJgpNK3qo= X-Google-Smtp-Source: ABdhPJwfI66OyK8A/0k8tHVPg/qAmte7NpKNUYoxb/hUYXNWedG3BUz7mlZdspF/c0p9eN/avQaTa7wjjO2NgPCDPRw= X-Received: by 2002:a05:6602:164c:: with SMTP id y12mr8796384iow.78.1620467518899; Sat, 08 May 2021 02:51:58 -0700 (PDT) MIME-Version: 1.0 References: <87fsyy6at8.fsf@fastmail.fm> <875yzuk9qd.fsf@posteo.de> <875yzuwv4z.fsf@fastmail.fm> <87tuneis8a.fsf@posteo.de> <8735uywosb.fsf@fastmail.fm> <8735uyikdq.fsf@posteo.de> In-Reply-To: <8735uyikdq.fsf@posteo.de> From: =?UTF-8?Q?Andr=C3=A1s_Simonyi?= Date: Sat, 8 May 2021 11:51:47 +0200 Message-ID: Subject: Re: CSL-JSON support for =parsebib= To: Titus von der Malsburg Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::d35; envelope-from=andras.simonyi@gmail.com; helo=mail-io1-xd35.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Joost Kremers , emacs-orgmode list Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1620467589; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=6lqOBlM3yXLgWps43bndmJWcc1pahkiB6sebntUBQvA=; b=LTm23vN34/BAth8P4G9Ro6gSPGraTZcZTED/GJzyxKqwpiJMEgTI723jYkb7T86wALaSEy uKTtrrCDscUmOxyr6Frl2dpu4ppJSN/M/KVLj8pZhwOWcXbcsGclQcjwVe5Hhu/qlK8QEm nT+qwFKrlumAZUFZc2oyoFoKlZYOrT4hy9+oOhG99cE4+zpV+EgRTR4O5b57rPhzSaAiNV VMO2wxGWijEOxhMlOQCROl6dZB51eOuIolIO362mROyehIx8xGfkF0o5FhH3Zz4YGG62Jj OCl8oiXc+nzb/Ekkw0IhRYI8C9FyUhogV98CyGTFPN64Rs8jZuk3o0/UNMZcVA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1620467589; a=rsa-sha256; cv=none; b=osarigS6n73ggHCQmzKDu5CcW7EmmrHRofpHIk16/wSNTasRXZxF2u/ZW+PengW/82k6gb QHsDMfwrRtBNC4s4UJ6jW7ttfmm0Bs7ORnZpOM8JfJebi2A9+wfGjj/+1z67ybzwIkMlCc EZohrcZy1nZDl3dqXhDqVjw7NZy08QJFA4Us0XzriO6A7XWCGCRzQdY7rENuL9pc4cwedW L889953oHkMq1pkjZFHT2bxlvMKVby7TCpu/o9U2rOQWen4O6aFaFelxFu5WAYxGbetlv6 8rCKCR8VgQo7d6aah7c6SJpssJDpE7MKGmgGoo8hmAq/1KnRSmcYmrvD0dtCBQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=b+jFlcSI; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -3.15 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=b+jFlcSI; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 2A8E127DD7 X-Spam-Score: -3.15 X-Migadu-Scanner: scn0.migadu.com X-TUID: zJvj2wz0lC76 Dear All, this is just to +1 this on my part as well. Although unadvertised, citeproc-org basically already supports CSL-JSON bibliographies, and it would be fantastic if other components of the Emacs citation/bibliography infrastructure also did. BTW, would CSL-JSON support in =3Dparsebib=3D mean that there is hope for having CSL-support in Ebib too? best regards, Andr=C3=A1s On Fri, 7 May 2021 at 18:23, Titus von der Malsburg wr= ote: > > > On 2021-05-07 Fri 16:47, Joost Kremers wrote: > > On Fri, May 07 2021, Titus von der Malsburg wrote: > >>> Apparently, =3Djson-parse-{buffer|string}=3D then gives you a symbol = with a space > >>> in it... > >> > >> I now see that symbol names =E2=80=9Ccan contain any characters whatev= er=E2=80=9D [1]. But many > >> characters need to be escaped (like spaces) which isn=E2=80=99t pretty= . > > > > Agreed. But if you pass such a symbol to =3Dsymbol-name=3D or to =3D(fo= rmat "%s")=3D, > > the escape character is removed, so when it comes to displaying those s= ymbols to > > users, it shouldn't matter much. > > > > Note, though, that the keys in CSL-JSON don't seem to contain any space= s or > > other weird characters. There are just lower case a-z and dash, that's = all. > > I agree that weird characters are unlikely going to be an issue. Nonethe= less, strings seem slightly more future-proof. Funky unicode stuff is now = appearing everywhere (I=E2=80=99ve seen emoji being used for variable names= ) and the situation could be different a couple of years down the line. > > >>> This works for the Elisp library =3Djson.el=3D, but Emacs 27 can be c= ompiled with > >>> native JSON support, which, however, doesn't provide this option, > >>> unfortunately. > >> > >> I see. In this case it might make sense to propose string keys as a fe= ature for > >> json.c. The key is a string anyway at some point during parsing, so av= oiding the > >> conversion to symbol may actually be the best way to speed things up. > > > > True. I'll ask on emacs-devel. Personally, I'd prefer strings, too, but= I'm a > > bit hesitant about doing the conversion myself, esp. given that in Ebib= , all the > > keys would need to be converted back before I can save a file. > > Sure, converting all keys in parsebib is not attractive. > > >>> That would be easy to support, but IMHO is better handled in > >>> bibtex-completion: > >>> just parse the buffer and then call =3Dgethash=3D on the resulting ha= sh table. Or > >>> what use-case do you have in mind? > >> > >> One use case: bibtex-completion drops fields that aren=E2=80=99t neede= d early on to save > >> memory and CPU cycles. (Some people work with truly enormous bibliogra= phies, > >> like crypto.bib with ~60K entries.) But this means that we sometimes h= ave to > >> read an individual entry again if we need more fields that were droppe= d earlier. > >> In this case I=E2=80=99d like to be able to read just one entry withou= t having to > >> reparse the complete bibliography. > > > > Makes sense. For .bib sources, this should be fairly easy to do. For .j= son, I > > can't really say how easy it would be. It's not difficult to find the e= ntry key > > in the buffer, but from there you'd have to be able to find the start o= f the > > entry in order to parse it. Currently, I don't know how to do that. > > Not a big deal. Since it=E2=80=99s just about individual entries and the= code isn=E2=80=99t super central, we can easily hack something. > > >>>> - Functions for resolving strings and cross-references. > > [...] > >>> parsebib has a lower-level API and a higher-level API, and the latter= does > >>> essentially what you suggest here. I thought bibtex-completion was al= ready > >>> using it... > >> > >> Nope. I think the high-level API didn=E2=80=99t exist when I wrote my = code in 2014. > > > > No, it didn't. I seem to remember, though, that you gave me the idea fo= r the > > higher-level API, which is probably why I assumed you were using it. > > > > So that part of =3Dparsebib=3D hasn't been tested much... (Ebib doesn't= use it, > > either). If you do decide to start using it, please test it and report = any > > issues you find. And let me know if I can help with testing. > > The organically grown parsing code in the Bibtex completion has been bugg= ing me for a while. So I'm keen on rewriting this. But I may not get to i= t until the summer. I'll keep you posted when I start working on it. > > Titus > >