emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Citation syntax: a revised proposal


From: Richard Lawrence
Subject: Re: [O] Citation syntax: a revised proposal
Date: Wed, 11 Mar 2015 10:33:52 -0700
User-agent: Notmuch/0.13.2 (http://notmuchmail.org) Emacs/23.4.1 (x86_64-pc-linux-gnu)

Hi Aaron and all,

I cleaned up my efforts a bit and posted them here:

https://github.com/wyleyr/org-citeproc

(This program is just a modified version of John MacFarlane's citeproc
program:

https://github.com/jgm/citeproc/

which reads JSON in a slightly different format, and produces JSON
instead of fully-rendered output.)

I wrote a few functions to produce JSON from (the current implementation
of) citations in Org; these live in json.el.  Note that I haven't been
able to test the new parser because I am on Emacs 23, so these have only
been tested with my hand-constructed Lisp objects, not with parser
output...they might need a little adjusting.  I also haven't done
anything to hook them up to the export process.

Aaron Ecay <address@hidden> writes:

> ... hmm.  Do you mean you’ve written Haskell code?

Yes, but not very much.  As long as I only have to write pure functions,
it seems to go alright. :) 

I went with Haskell purely for practical reasons:
  1) I at least know a little Haskell, and I've been wanting to learn more;
     I don't know Java, Ruby, or JS
  2) I already have the Haskell platform installed, but I don't have
     Java, Ruby, or a JS engine (other than a browser) installed

> 2015ko martxoak 10an, Richard Lawrence-ek idatzi zuen:
>> I have actually been working on the same problem, using citeproc-hs as
>> the CSL processor instead of citeproc-java.
>
> This is an interesting approach.  What version of citeproc-hs are you
> using?  The version under that name is no longer maintained, and I had
> some trouble getting it to build.  

I am in fact using the version under that name (I have not had trouble
installing/building it via cabal).  I went this way because it seemed to
have everything we'd need, and I wanted to avoid a dependency on all of
pandoc.  Maybe this was shortsighted of me, though...  

> The pandoc fork (under the name pandoc-citeproc) seemed to me to lack
> command-line functionality.  (But I only looked briefly and could have
> missed something.)

Well, pandoc-citeproc does read and produce JSON at the command line,
but it takes (and returns) a complete pandoc document.

I think what I've got would be pretty easy to port to pandoc-citeproc,
if maintenance of citeproc-hs is an issue.  If a full dependency on
pandoc is OK, we could also just use Pandoc's rendering functions for
the various backends we wish to support.

>> My approach to the problems you mention has been the following:
>>   1) Generate JSON from citation objects on the Org side.
>>   2) Pass that JSON to the processor via stdin.
>>   3) Pass the output format, the CSL file, and the bibliography database
>>      to the processor via command line arguments.
>>   4) Return, to stdout, the formatted citations and the bibliography.
>>      These are formatted such that there is one citation or entry per line,
>>      and a recognizable separator separates the citations from the
>>      bibliography.
>>
>> This allows passing formatting options for individual citations via the
>> JSON object for that citation, so it allows citeproc-hs to do more of
>> the work of formatting citations.
>>
>> (See http://gsl-nagoya-u.net/http/pub/citeproc-doc.html#citation-data-object
>> for documentation of the citation data JSON format.)
>
> Very interesting.  But it looks like the CSL standard does not
> differentiate parenthesized/not and capitalized/not citations, whereas
> biblatex (taken as the best representative of the latex family of
> citation processors) does.  

Yikes, really?  Surely the CSL standard has something to say about this.
It seems like it would be pretty useless otherwise, and there are all
those options for representing names...

Anyway, whether it's standard or not, citeproc-hs has an `authorInText'
option for citations, which I am using to capture the
parenthetical-vs-in-text distinction.  I haven't thought about
capitalization, though.

>> I don't know whether this will ultimately be a good design, but the way
>> I am picturing it right now is that exporting citations will work sort
>> of like footnotes: the exporter will gather them all together as they
>> are encountered, then generate the JSON and run a single call to the CSL
>> processor at the end of the export process.  It can then replace the
>> citations in the document with the result from the CSL processor, and
>> insert the bibliography at the end of the document.
>
> My code does something similar.  It processes all citations at the
> beginning of export and stashes the data in the info plist, so that
> it’s available to transcoders during the “main” export process.

Ah, that sounds like a much better idea than what I was thinking of.

Best,
Richard



reply via email to

[Prev in Thread] Current Thread [Next in Thread]