emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: Joseph Vidal-Rosset <joseph@vidal-rosset.net>
Cc: org-mode-email <emacs-orgmode@gnu.org>,
	Ivan Tadeu Ferreira Antunes Filho <ivanaf@mit.edu>
Subject: Re: citeproc-org and org-ref 3
Date: Thu, 02 Dec 2021 12:35:47 -0500	[thread overview]
Message-ID: <m2v906q58e.fsf@andrew.cmu.edu> (raw)
In-Reply-To: <0d4028ea-8ed6-22f3-023b-20b2df18406c@vidal-rosset.net>

Glad to hear it is working again for you! Best wishes,

Joseph Vidal-Rosset <joseph@vidal-rosset.net> writes:

> Dear all,
>
>
> I just succeeded in solving my problem.
>
> l-210-235 of myblogexporter.el, I changed the code for:
>
> (defun org-export-head-export-headers (directory-name backend)
>    "Exports each heading to directory-name using backend"
>    (if (equal backend "html")
>        (org-export-head--run-on-each-heading
>         #'(lambda ()
>             (org-set-property
>              "EXPORT_FILE_NAME"
>              (concat directory-name (org-export-head--escaped-headline)))
>             (deactivate-mark)
>             (let ((org-export-before-parsing-hook
> '(org-ref-csl-preprocess-buffer)))
>                  (cl-letf (((symbol-function 'org-export-get-reference)
> (symbol-function 'org-export-get-reference-custom)))
>                    (if org-export-head-click-toc-h2
>                        (cl-letf ((
>                                   ;(symbol-function 'org-html-toc)
>                                   (symbol-function
> 'org-export-head--custom-toc)))
>                          (org-html-export-to-html nil t)))))
>             (set-buffer-modified-p t)) "-noexport-noreexport"))
>    (if (equal backend "pdf")
>        (org-export-head--run-on-each-heading
>         #'(lambda ()
>             (org-set-property
>              "EXPORT_FILE_NAME"
>              (concat directory-name (org-export-head--escaped-headline)))
>             (deactivate-mark)
>             (org-latex-export-to-pdf nil t)
>             (set-buffer-modified-p t)) "-noexport-noreexport")))
>
> and it works with org-ref 3.
>
> Best wishes,  I attach myblogexporter.el
>
> Jo.
>
> Le 02/12/2021 à 14:17, Joseph Vidal-Rosset a écrit :
>> Dear John (cc. Ivan),
>>
>> First, thanks for your help and for your patience, that's very kind of you.
>>
>> The good news is that indeed, org-ref 3 exports nicely the  html
>> bibliography with my CSL file, it works well with your org file and your
>> bibliography. My error was simple: I did not use the specific org-ref
>> keys but the ordinary h-o keys.. A stupid mistake.
>>
>> The bad news is that this new function for exporting with org-ref 3 is
>> not included in org-export-head, a nice org mode to blog exporter, made
>> by Ivan Tadeu Ferreira Antunes Filho, which converts each header to a
>> different file, I find this exporter very convenient. I had no problem
>> with this org-ref 2 to use this blog-exporter, but it org-ref 3 is
>> unfortunately not still adapted to its use. Nevertheless, I believe that
>> it should be possible to find the lines to include this function
>> (let  ((org-export-before-parsing-hook '(org-ref-csl-preprocess-buffer)))
>>       (org-open-file  (org-html-export-to-html)))
>> in org-export-head. I tried, but without success, because I am simply
>> not expert enough. I see the best, that is to export both with org-ref 3
>> (i.e. "r h") and org-export-head, but I am unable to code it.
>>
>> No doubt that it should be for you and Ivan a piece of cake, but please
>> do it only if you think that it is interesting and if you find the time
>> to do it.
>>
>> Best wishes,
>>
>> Jo.
>>
>> PS in attachment, myblogexporter.el in my ~/.emacs.d/personal  (usual
>> path with Prelude Emacs).
>>
>> Le 01/12/2021 à 23:16, John Kitchin a écrit :
>>>
>>> Joseph Vidal-Rosset <joseph@vidal-rosset.net> writes:
>>>
>>>> Dear Andras,
>>>>
>>>> You are very probably right. I will have a look on this entry in my
>>>> default bibliography file.
>>>>
>>>> The code
>>>>
>>>> (let  ((org-export-before-parsing-hook '(org-ref-csl-preprocess-buffer)))
>>>>           (org-open-file  (org-html-export-to-html)))
>>>>
>>>> put in .emacs.d/personal/preload/myorgexport.el
>>>>
>>> This code should not go in your init file. It is executed each time, and
>>> not what you want. I usually put it a src block at the end in a section
>>> tagged noexport and run it from there.
>>>
>>> Alternatively, if this is the only preprocessing you do, I think you can
>>> do C-c C-e rh to export to html (this runs the org-ref html exporter.
>>>
>>> Finally, if you really want something in your init file it should be
>>> like this:
>>>
>>> (defun my-html ()
>>>     (interactive)
>>>     (let  ((org-export-before-parsing-hook '(org-ref-csl-preprocess-buffer)))
>>>       (org-open-file  (org-html-export-to-html))))
>>>
>>> and then later you run it with M-x my-html
>>>
>>>
>>>> provokes the request of opening a html file, when emacs --daemon is
>>>> started; therefore I conclude that it should not be used as I did...
>>>>
>>>> Anyway, every  tentative  to export in a bibliography in html fails at
>>>> the moment, even with a new bibliography file...  :(
>>>
>>> See of the one at
>>> https://github.com/jkitchin/org-ref/blob/master/examples/basic-csl.org
>>> works. The bib file is in
>>> https://github.com/jkitchin/org-ref/blob/master/org-ref.bib.
>>>
>>>
>>>
>>>>
>>>> Best wishes,
>>>>
>>>> Le 01/12/2021 à 17:33, András Simonyi a écrit :
>>>>> Dear Joseph,
>>>>>
>>>>> based on the error message there seems to be a problem with the
>>>>> 'curley-nil-on-bennet-spinoz' bibliography entry, is it possible that
>>>>> it contains a 'year = nil' row? If yes then I don't think that is
>>>>> well-formed, at least citeproc-el cannot currently parse it. Anyhow,
>>>>> apparently I need to improve/add citeproc-el error messages about
>>>>> bib(la)tex parsing, because several parsing problems have surfaced
>>>>> lately and the current error messages aren't helpful at all.
>>>>>
>>>>> best wishes,
>>>>> András
>>>>>
>>>>> On Wed, 1 Dec 2021 at 16:50, Joseph Vidal-Rosset
>>>>> <joseph@vidal-rosset.net> wrote:
>>>>>>
>>>>>> Dear John,
>>>>>>
>>>>>> I must say that to export references in html with org-ref 3, I meet a
>>>>>> lot of problems (with LaTeX, it's fine).
>>>>>>
>>>>>> I am using prelude emacs and  GNU Emacs 29.0.50 .
>>>>>>
>>>>>> Starting emacs --daemon, the code
>>>>>>
>>>>>> (let  ((org-export-before-parsing-hook '(org-ref-csl-preprocess-buffer)))
>>>>>>         (org-open-file  (org-html-export-to-html)))
>>>>>>
>>>>>> in my setup provokes this unwanting effect:
>>>>>>
>>>>>> [Prelude] Loading personal configuration files in
>>>>>> /home/joseph/.emacs.d/personal/preload...
>>>>>> Loading /home/joseph/.emacs.d/personal/preload/myorgexport.el (source)...
>>>>>> Output file:
>>>>>>
>>>>>> and with Enter :
>>>>>>
>>>>>> [Prelude] Loading personal configuration files in
>>>>>> /home/joseph/.emacs.d/personal/preload...
>>>>>> Loading /home/joseph/.emacs.d/personal/preload/myorgexport.el (source)...
>>>>>> Output file:
>>>>>> Warning (initialization): An error occurred while loading
>>>>>> ‘/home/joseph/.emacs.d/init.el’:
>>>>>>
>>>>>> Wrong type argument: stringp, nil
>>>>>>
>>>>>> To ensure normal operation, you should investigate and remove the
>>>>>> cause of the error in your initialization file.  Start Emacs with
>>>>>> the ‘--debug-init’ option to view a complete error backtrace. Disable
>>>>>> showing Disable logging
>>>>>> Starting Emacs daemon.
>>>>>>
>>>>>> With --debug-init, I get:
>>>>>>
>>>>>> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>>>>>>       string-to-number(nil)
>>>>>>       citeproc-bt--to-csl-date("nil" nil)
>>>>>>       citeproc-blt-entry-to-csl((("Url" .
>>>>>> "http://dx.doi.org/10.1163/9789004246638_005") ("Doi" .
>>>>>> "10.1163/9789004246638_005") ("Date_added" . "Mon May 16 19:09:37 2016")
>>>>>> ("Booktitle" . "Spinoza: Issues and Directions") ("Series" . "Spinoza:
>>>>>> Issues and Directions") ("Year" . "nil") ("Publisher" . "Brill Academic
>>>>>> Publishers") ("Pages" . "39-52") ("Author" . "Edwin Curley") ("Title" .
>>>>>> "ON BENNETTS SPINOZA: THE ISSUE OF TELEOLOGY") ("=type=" . "InBook")
>>>>>> ("=key=" . "curley-nil-on-bennet-spinoz")) nil nil)
>>>>>>       #f(compiled-function (key entry) #<bytecode
>>>>>> -0x7fcb46b5c8e80b3>)("curley-nil-on-bennet-spinoz" (("Url" .
>>>>>> "http://dx.doi.org/10.1163/9789004246638_005") ("Doi" .
>>>>>> "10.1163/9789004246638_005") ("Date_added" . "Mon May 16 19:09:37 2016")
>>>>>> ("Booktitle" . "Spinoza: Issues and Directions") ("Series" . "Spinoza:
>>>>>> Issues and Directions") ("Year" . "nil") ("Publisher" . "Brill Academic
>>>>>> Publishers") ("Pages" . "39-52") ("Author" . "Edwin Curley") ("Title" .
>>>>>> "ON BENNETTS SPINOZA: THE ISSUE OF TELEOLOGY") ("=type=" . "InBook")
>>>>>> ("=key=" . "curley-nil-on-bennet-spinoz")))
>>>>>>       maphash(#f(compiled-function (key entry) #<bytecode
>>>>>> -0x7fcb46b5c8e80b3>) #<hash-table equal 665/730 0x156f8acb26b7>)
>>>>>>       citeproc-hash-itemgetter-from-any(("~/Dropbox/Orgzly/reforg.bib"))
>>>>>>       org-ref-process-buffer(html)
>>>>>>       org-ref-csl-preprocess-buffer(html)
>>>>>>       run-hook-with-args(org-ref-csl-preprocess-buffer html)
>>>>>>       org-export-as(html nil nil nil (:output-file "~/test.html"))
>>>>>>       org-export-to-file(html "~/test.html" nil nil nil nil nil)
>>>>>>       org-html-export-to-html()
>>>>>>       (org-open-file (org-html-export-to-html))
>>>>>>       (let ((org-export-before-parsing-hook
>>>>>> '(org-ref-csl-preprocess-buffer))) (org-open-file
>>>>>> (org-html-export-to-html)))
>>>>>>       eval-buffer(#<buffer  *load*-634240> nil
>>>>>> "/home/joseph/.emacs.d/personal/preload/myorgexport..." nil t)  ;
>>>>>> Reading at buffer position 3196
>>>>>>
>>>>>> load-with-code-conversion("/home/joseph/.emacs.d/personal/preload/myorgexport..."
>>>>>> "/home/joseph/.emacs.d/personal/preload/myorgexport..." nil nil)
>>>>>>       load("/home/joseph/.emacs.d/personal/preload/myorgexport...")
>>>>>>       mapc(load ("/home/joseph/.emacs.d/personal/preload/myorgexport..."))
>>>>>>       (progn (message "[Prelude] Loading personal configuration files in
>>>>>> ..." prelude-personal-preload-dir) (mapc 'load (directory-files
>>>>>> prelude-personal-preload-dir 't "^[^#.].*el$")))
>>>>>>       (if (file-exists-p prelude-personal-preload-dir) (progn (message
>>>>>> "[Prelude] Loading personal configuration files in ..."
>>>>>> prelude-personal-preload-dir) (mapc 'load (directory-files
>>>>>> prelude-personal-preload-dir 't "^[^#.].*el$"))))
>>>>>>       eval-buffer(#<buffer  *load*> nil "/home/joseph/.emacs.d/init.el" nil
>>>>>> t)  ; Reading at buffer position 4489
>>>>>>       load-with-code-conversion("/home/joseph/.emacs.d/init.el"
>>>>>> "/home/joseph/.emacs.d/init.el" t t)
>>>>>>       load("/home/joseph/.emacs.d/init" noerror nomessage)
>>>>>>       startup--load-user-init-file(#f(compiled-function () #<bytecode
>>>>>> 0xec639179d6199fa>) #f(compiled-function () #<bytecode
>>>>>> -0x1f3c686ddc0dc635>) t)
>>>>>>       command-line()
>>>>>>       normal-top-level()
>>>>>>
>>>>>> It's too complicated for me.
>>>>>> org-ref version 2 with citeproc-org by Andras worked well, but now I am
>>>>>> afraid that to downgrade to org-ref 2 is not necessarily the best
>>>>>> solution. I am lost.
>>>>>>
>>>>>> Best wishes, and thanks for your help.
>>>>>>
>>>>>> Jo.
>>>>>>
>>>>>>
>>>>>> Le 30/11/2021 à 18:31, John Kitchin a écrit :
>>>>>>> See https://www.youtube.com/watch?v=rRR-5NSpKyE
>>>>>>> <https://www.youtube.com/watch?v=rRR-5NSpKyE> for an overview of what to
>>>>>>> do. basically you need a csl file that provides the style you want, and
>>>>>>> you specify it like this in the org file or in default settings. You may
>>>>>>> also need a locale file if you are not blogging in english.
>>>>>>>
>>>>>>> #+csl-style: apa-5th-edition.csl
>>>>>>>
>>>>>>> #+csl-locale: en-US
>>>>>>>
>>>>>>>
>>>>>>> You can find a basic example org file for html export with CSL at
>>>>>>> https://github.com/jkitchin/org-ref/blob/master/examples/basic-csl.org
>>>>>>> <https://github.com/jkitchin/org-ref/blob/master/examples/basic-csl.org>
>>>>>>>
>>>>>>> Here is a minimal way to export your blog file I suppose.
>>>>>>>
>>>>>>> (let  ((org-export-before-parsing-hook '(org-ref-csl-preprocess-buffer)))
>>>>>>>       (org-open-file  (org-html-export-to-html)))
>>>>>>>
>>>>>>>
>>>>>>> John
>>>>>>>
>>>>>>> -----------------------------------
>>>>>>> Professor John Kitchin (he/him/his)
>>>>>>> Doherty Hall A207F
>>>>>>> Department of Chemical Engineering
>>>>>>> Carnegie Mellon University
>>>>>>> Pittsburgh, PA 15213
>>>>>>> 412-268-7803
>>>>>>> @johnkitchin
>>>>>>> http://kitchingroup.cheme.cmu.edu <http://kitchingroup.cheme.cmu.edu>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Nov 30, 2021 at 12:16 PM András Simonyi
>>>>>>> <andras.simonyi@gmail.com <mailto:andras.simonyi@gmail.com>> wrote:
>>>>>>>
>>>>>>>        Dear Joseph,
>>>>>>>
>>>>>>>        unfortunately, my note on the `citeproc-org` page has become kind of
>>>>>>>        misleading and has to be updated because org-ref didn't switch to the
>>>>>>>        new org-cite citation syntax after all, although this was the plan for
>>>>>>>        a while. I think if you wish to use org-ref 3 then you should simply
>>>>>>>        remove citeproc-org entirely -- if I understand correctly the latest
>>>>>>>        version of org-ref supports the old syntax as well and is capable of
>>>>>>>        CSL-based export (among others) on its own.
>>>>>>>
>>>>>>>        best regards,
>>>>>>>        András
>>>>>>>
>>>>>>>        On Tue, 30 Nov 2021 at 18:00, Joseph Vidal-Rosset
>>>>>>>        <joseph@vidal-rosset.net <mailto:joseph@vidal-rosset.net>> wrote:
>>>>>>>         >
>>>>>>>         >
>>>>>>>         > Dear John, and dear Andras,
>>>>>>>         >
>>>>>>>         > Having updated my org-ref to the last version, I see that the html
>>>>>>>         > export of bibliography does not work any longer for my blog.
>>>>>>>         >
>>>>>>>         > Reading Andras's note here
>>>>>>>         > https://github.com/andras-simonyi/citeproc-org
>>>>>>>        <https://github.com/andras-simonyi/citeproc-org>
>>>>>>>         > I confess that I am lost.
>>>>>>>         >
>>>>>>>         > What have I to do to not waste too much time with this problem?
>>>>>>>         >
>>>>>>>         > Best wishes,
>>>>>>>         >
>>>>>>>         > Jo.
>>>>>>>         >
>>>>>>>
>>>>>>
>>>
>>>
>>> --
>>> 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
>>> Pronouns: he/him/his
>>>
>
> [2. text/x-emacs-lisp; myblogexporter.el]...


-- 
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
Pronouns: he/him/his


  reply	other threads:[~2021-12-02 17:40 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-30 17:00 citeproc-org and org-ref 3 Joseph Vidal-Rosset
2021-11-30 17:16 ` András Simonyi
2021-11-30 17:24   ` Joseph Vidal-Rosset
2021-11-30 17:31   ` John Kitchin
2021-11-30 18:15     ` Joseph Vidal-Rosset
2021-12-01 15:49     ` Joseph Vidal-Rosset
2021-12-01 16:33       ` András Simonyi
2021-12-01 16:48         ` Joseph Vidal-Rosset
2021-12-01 22:16           ` John Kitchin
2021-12-02 13:17             ` Joseph Vidal-Rosset
2021-12-02 15:56               ` Joseph Vidal-Rosset
2021-12-02 17:35                 ` John Kitchin [this message]
2021-12-03  8:04                   ` Joseph Vidal-Rosset
2021-12-03 15:24                     ` John Kitchin
2021-12-03 16:48                       ` Joseph Vidal-Rosset
2021-12-03 17:13                         ` John Kitchin
2021-12-04 14:23                           ` Max Nikulin
2021-12-04 14:45                           ` Joseph Vidal-Rosset
2021-12-04 15:07                             ` John Kitchin
2021-12-04 15:31                               ` Joseph Vidal-Rosset
2021-12-01 22:08         ` 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=m2v906q58e.fsf@andrew.cmu.edu \
    --to=jkitchin@andrew.cmu.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=ivanaf@mit.edu \
    --cc=joseph@vidal-rosset.net \
    /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).