From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Lawrence Subject: Re: Some projects Date: Mon, 26 Oct 2015 15:23:50 -0700 Message-ID: <87ziz5z2tl.fsf@berkeley.edu> References: <87wpub9jts.fsf@nicolasgoaziou.fr> <877fmazh2f.fsf@gmail.com> <87fv0x1t49.fsf@berkeley.edu> <87vb9tcx5c.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47798) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZqqBJ-0001k0-F1 for emacs-orgmode@gnu.org; Mon, 26 Oct 2015 18:23:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZqqBG-0008G1-4e for emacs-orgmode@gnu.org; Mon, 26 Oct 2015 18:23:57 -0400 Received: from plane.gmane.org ([80.91.229.3]:51207) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZqqBF-0008Fv-UH for emacs-orgmode@gnu.org; Mon, 26 Oct 2015 18:23:54 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1ZqqBE-00044w-SK for emacs-orgmode@gnu.org; Mon, 26 Oct 2015 23:23:53 +0100 Received: from c-67-169-117-151.hsd1.ca.comcast.net ([67.169.117.151]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 26 Oct 2015 23:23:52 +0100 Received: from richard.lawrence by c-67-169-117-151.hsd1.ca.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 26 Oct 2015 23:23:52 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi Nicolas and all, Nicolas Goaziou writes: > Richard Lawrence writes: > >> Yes, this is my understanding, too. In particular, there does not seem >> to be an Elisp CSL library, and it would be a lot of work to write >> one. > > Here is a genuine question: what is the difficult part, or if there is > none, the longer parts of the work? AFAIU, CSL is XML and we can use > libxml for the low-level parsing. I can't speak to how difficult it would really be. But I do think it would be a lot of work, and tedious, unglamorous work at that. Essentially it means implementing the CSL specification: http://docs.citationstyles.org/en/stable/specification.html The specification describes the XML format for CSL styles, which IIUC are something like XSLT programs: they describe how to transform an input document tree into an output document tree. So, implementing CSL is something like implementing a very special-purpose declarative programming language, which has to handle declarations about every detail of citation formatting (where to put periods, how to capitalize names like "von Neumann", whether to use "&" or a translation of "and" for the current locale, etc.). Lisp is a good language to do this kind of thing in, but parsing the XML is surely the easy part. > Could you give some examples of the UI offered by the citeproc-hs > library? The library I ended up wrapping is actually pandoc-citeproc, which is a fork of citeproc-hs (which seems to be unmaintained). pandoc-citeproc essentially exports one main function, processCites. This function transforms a Pandoc data structure containing Citation nodes into another Pandoc where the citations have been rendered into the text and the bibliography is appended at the end of the document. processCites also requires a list of references (read from a bibliography database, e.g. .bib files, via the readBiblioFile function) and a CSL style (read from a file via the readCSLFile function). So basically, the pandoc-citeproc API consists of these three functions: processCites, readBiblioFile, and readCSLFile. Best, Richard