emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Joost Kremers <joostkremers@fastmail.fm>
To: Titus von der Malsburg <malsburg@posteo.de>
Cc: Org Mode List <emacs-orgmode@gnu.org>
Subject: Re: CSL-JSON support for =parsebib=
Date: Fri, 07 May 2021 14:34:25 +0200	[thread overview]
Message-ID: <875yzuwv4z.fsf@fastmail.fm> (raw)
In-Reply-To: <875yzuk9qd.fsf@posteo.de>

Hi Titus,

On Fri, May 07 2021, Titus von der Malsburg wrote:
> I’m the maintainer of bibtex-completion, helm-bibtex, and ivy-bibtex. My name is
> actually Titus, not Theo ;)

:$ (I do apologise!)

> Regarding the symbols vs. string issue: I don’t have a strong opinion, but
> personally tend to favor a conservative solution that avoids braking changes.
> First, it’s difficult to predict how switching to symbols is going to affect
> other software including custom code written by users. Second, JSON key names
> can contain spaces and other weird stuff.

Apparently, =json-parse-{buffer|string}= then gives you a symbol with a space in it...

> So strings are perhaps a more natural
> choice anyway. (It appears that you can actually configure the JSON parser to
> use strings instead of symbols. See variable `json-key-type`.)

This works for the Elisp library =json.el=, but Emacs 27 can be compiled with
native JSON support, which, however, doesn't provide this option, unfortunately.

> Finally,
> it’s not necessarily clear that avoiding the conversion to strings saves
> sufficiently many CPU cycles to justify the effort.

I can simply try it out. Shouldn't be difficult to code up.

> Regarding support for CSL-JSON: bibtex-completion is currently very
> BibTeX-oriented and uses fairly low-level parsing functions from parsebib. We
> could add similar support for CSL-JSON

I'm afraid that won't be possible, because the CLS-JSON support in parsebib
isn't low-level. ;-) There's basically just a single function that gives you all
the entries in the buffer and that's it.

> Some rough ideas for such an API (just for illustration):
> - A function that returns all entries in a .bib or CSL-JSON file.

Those already exist... ;-) For JSON, that's basically the only option, because
the actual parsing isn't handled by parsebib. For BibTeX, such a function has
existed for some time now.

> - A function that returns an entry with a specific key (or multiple entries).

That would be easy to support, but IMHO is better handled in bibtex-completion:
just parse the buffer and then call =gethash= on the resulting hash table. Or
what use-case do you have in mind?

> - Functions for resolving strings and cross-references.

This, too, is something that parsebib already does.

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 already using it...


-- 
Joost Kremers
Life has its moments


  reply	other threads:[~2021-05-07 13:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-07  9:17 CSL-JSON support for =parsebib= Joost Kremers
2021-05-07 11:52 ` Bruce D'Arcus
2021-05-07 12:29 ` Titus von der Malsburg
2021-05-07 12:34   ` Joost Kremers [this message]
2021-05-07 13:33     ` Titus von der Malsburg
2021-05-07 14:47       ` Joost Kremers
2021-05-07 16:22         ` Titus von der Malsburg
2021-05-08  9:51           ` András Simonyi
2021-05-08 15:51             ` Joost Kremers
2021-05-07 13:03   ` Bruce D'Arcus
  -- strict thread matches above, loose matches on Subject: below --
2021-05-08 11:57 Denis Maier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875yzuwv4z.fsf@fastmail.fm \
    --to=joostkremers@fastmail.fm \
    --cc=emacs-orgmode@gnu.org \
    --cc=malsburg@posteo.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).