emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: Richard Lawrence <richard.lawrence@berkeley.edu>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: More questions about CSL and org-mode
Date: Tue, 08 Dec 2015 06:41:04 -0500	[thread overview]
Message-ID: <m28u55cgmn.fsf@andrew.cmu.edu> (raw)
In-Reply-To: <874mfuuj7l.fsf@berkeley.edu>


>> On export the in-text citations are transformed to unique text blobs,
>> e.g. uuids, and the document exported. The only important features of
>> these blobs is that they do not get changed on export, and they are
>> unique because we replace them later.
>>
>> The strings in the bibliography entry are "exported" to convert the
>> org-markup to the output format. The in-text citations, expanded
>> bibliography and style are sent to the citation processor, which outputs
>> replacements and a formatted bibliography in the desired output format.
>>
>> Finally, you replace each uuid with the appropriate replacement, and
>> insert the bibliography where it belongs. That should be the final
>> document.
>
> IIUC, the problem with this approach is that it will not work well when
> the citation style is note-based rather than inline.  The main
> motivation for going "back to Org" is that note-based styles require the
> document structure to change as a result of citation processing: new
> footnotes have to be inserted, and existing ones have to be renumbered.
> That is relatively hard to do if the rest of the document is already in
> the target format (except with LaTeX).  By doing citation processing
> early in the export process and converting the results to Org, we can
> rely on Org's footnote processing to handle this later in the export
> process.

I guess I don't understand what note-based citations look like, or why
you would have to renumber footnotes in this process. Does the order
change for some reason? Even if it does, it sounds like this might just
require another pass of calculations to figure out how to replace
things.

Any chance you could send me a document with note-based citations?

One place where text-based replacement doesn't work I guess is outputs
that aren't plain text based. Maybe, for example, to ODT where the
output creates multiple xml files in a zip file?

> As far as I can see, if it weren't for note-based styles, this approach
> would work fine.  (Indeed, it is pretty much what the existing org-cite
> code does, except that the mapping between citations and their
> replacements is done with Lisp data structures rather than via string
> replacement in the output buffer.  I stopped work on that right about
> the time I realized the existing approach wouldn't work very well with
> note-based styles.)
>
> But given the problem about nested formatting, going back to Org at the
> level of text replacements doesn't work.  In other words: both of the
> simple-minded approaches (process citations directly to text in the
> target format, or process them to Org text, then let Org convert them to
> the target format) face problems.
>
> I think probably what we'll have to do to accommodate both note-based
> styles and the possibility of nested formatting is to get the results of
> citation processing in some unambiguous format like HTML or JSON, then
> parse it, and then use the result to directly modify the parse tree for
> the Org document before continuing the export process.  I can't see an
> easier way...can anyone else?

Like getting an xml citation, and then using xslt to translate it to the
format you want? Or something equivalent? Your translation would still
have to be clever to avoid nested syntax, which I guess requires some
recursive parsing of the output.

Modifying the parse tree is more elegant than the replacement text idea.
I have to learn how to do this one day ;)

>
> Best,
> Richard

--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

  reply	other threads:[~2015-12-08 11:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-06 21:25 More questions about CSL and org-mode John Kitchin
2015-12-06 23:24 ` Richard Lawrence
2015-12-06 23:45   ` Richard Lawrence
2015-12-07 11:56     ` John Kitchin
2015-12-07 19:55       ` Richard Lawrence
2015-12-08 11:41         ` John Kitchin [this message]
2015-12-07 16:18   ` John Kitchin

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=m28u55cgmn.fsf@andrew.cmu.edu \
    --to=jkitchin@andrew.cmu.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=richard.lawrence@berkeley.edu \
    /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).