* org export to org
@ 2015-01-28 22:43 John Kitchin
2015-01-29 4:26 ` Nick Dokos
2015-01-29 18:34 ` Nicolas Goaziou
0 siblings, 2 replies; 5+ messages in thread
From: John Kitchin @ 2015-01-28 22:43 UTC (permalink / raw)
To: Org-Mode mailing list
All the discussion about citations has gotten me thinking. It is easy
enough to export cite links to the pandoc format, including pre and post
text. I have done a proof of concept of this in a markdown export.
I would like to do an org export to org, with the goal of the exported
org document to no longer have cite:KEY1,KEY2 but rather [@KEY1; @KEY2]. So far my
investigations of exporting org to org have not led anywhere; the links are
untouched, even with an org format option in the link definition.
Are links ignored in an org export to org? If not, is there some trick
to converting them to another format?
Thanks!
--
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: org export to org
2015-01-28 22:43 org export to org John Kitchin
@ 2015-01-29 4:26 ` Nick Dokos
2015-01-29 14:17 ` John Kitchin
2015-01-29 18:34 ` Nicolas Goaziou
1 sibling, 1 reply; 5+ messages in thread
From: Nick Dokos @ 2015-01-29 4:26 UTC (permalink / raw)
To: emacs-orgmode
John Kitchin <johnrkitchin@gmail.com> writes:
> All the discussion about citations has gotten me thinking. It is easy
> enough to export cite links to the pandoc format, including pre and post
> text. I have done a proof of concept of this in a markdown export.
>
> I would like to do an org export to org, with the goal of the exported
> org document to no longer have cite:KEY1,KEY2 but rather [@KEY1; @KEY2]. So far my
> investigations of exporting org to org have not led anywhere; the links are
> untouched, even with an org format option in the link definition.
>
> Are links ignored in an org export to org? If not, is there some trick
> to converting them to another format?
>
ox-org.el defines the org backend with (link . org-org-identity) -
actually just about everything is tied to org-org-identity (with a few
exceptions of course). Maybe you can derive a backend which munges links
appropriately (for some value of "appropriately")?
--
Nick
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: org export to org
2015-01-29 4:26 ` Nick Dokos
@ 2015-01-29 14:17 ` John Kitchin
0 siblings, 0 replies; 5+ messages in thread
From: John Kitchin @ 2015-01-29 14:17 UTC (permalink / raw)
To: Nick Dokos; +Cc: emacs-orgmode
Thanks for the tip.
Today what I tried for this worked fine. This will export an org file to
an org file, but transform all the cite type links into pandoc format,
including pre/post text if you put that in the link description with ::
as a separator. Then you could run that org file through pandoc. It
looks like this would work for any export that can use pandoc citations,
with a simple redefinition of the derived backend.
#+BEGIN_SRC emacs-lisp
(defun pandoc-cite-format (link contents info)
(if (-contains? org-ref-cite-types (org-element-property :type link))
(cond
;; link with description
((org-element-property :contents-begin link)
(let* ((contents (buffer-substring
(org-element-property :contents-begin link)
(org-element-property :contents-end link)))
(split (split-string contents "::"))
(pre-text (nth 0 split))
(post-text (nth 1 split)))
(concat
"[@" (org-element-property :path link)
(when pre-text (concat ", " pre-text))
(when post-text (concat ", " post-text))
"]"
)
))
;; plain citations
(t
(concat "["
(mapconcat (lambda (key) (concat "@" key))
(split-string (org-element-property :path link) ",")
"; ")
"]")))
;; not a cite link. just return the original link
(org-org-identity link contents info)))
(org-export-define-derived-backend 'pandoc-org 'org
:translate-alist '((link . pandoc-cite-format)))
(find-file (org-export-to-file 'pandoc-org "org-to-org.org"))
#+END_SRC
Nick Dokos writes:
> John Kitchin <johnrkitchin@gmail.com> writes:
>
>> All the discussion about citations has gotten me thinking. It is easy
>> enough to export cite links to the pandoc format, including pre and post
>> text. I have done a proof of concept of this in a markdown export.
>>
>> I would like to do an org export to org, with the goal of the exported
>> org document to no longer have cite:KEY1,KEY2 but rather [@KEY1; @KEY2]. So far my
>> investigations of exporting org to org have not led anywhere; the links are
>> untouched, even with an org format option in the link definition.
>>
>> Are links ignored in an org export to org? If not, is there some trick
>> to converting them to another format?
>>
>
> ox-org.el defines the org backend with (link . org-org-identity) -
> actually just about everything is tied to org-org-identity (with a few
> exceptions of course). Maybe you can derive a backend which munges links
> appropriately (for some value of "appropriately")?
--
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: org export to org
2015-01-28 22:43 org export to org John Kitchin
2015-01-29 4:26 ` Nick Dokos
@ 2015-01-29 18:34 ` Nicolas Goaziou
2015-01-29 22:00 ` John Kitchin
1 sibling, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2015-01-29 18:34 UTC (permalink / raw)
To: John Kitchin; +Cc: Org-Mode mailing list
Hello,
John Kitchin <johnrkitchin@gmail.com> writes:
> Are links ignored in an org export to org? If not, is there some trick
> to converting them to another format?
I added the possibility to handle custom link export functions in `org'
export back-end.
Thanks for suggesting it.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: org export to org
2015-01-29 18:34 ` Nicolas Goaziou
@ 2015-01-29 22:00 ` John Kitchin
0 siblings, 0 replies; 5+ messages in thread
From: John Kitchin @ 2015-01-29 22:00 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: Org-Mode mailing list, John Kitchin
Cool! Thanks!
Nicolas Goaziou writes:
> Hello,
>
> John Kitchin <johnrkitchin@gmail.com> writes:
>
>> Are links ignored in an org export to org? If not, is there some trick
>> to converting them to another format?
>
> I added the possibility to handle custom link export functions in `org'
> export back-end.
>
> Thanks for suggesting it.
>
>
> Regards,
--
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-01-29 22:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-28 22:43 org export to org John Kitchin
2015-01-29 4:26 ` Nick Dokos
2015-01-29 14:17 ` John Kitchin
2015-01-29 18:34 ` Nicolas Goaziou
2015-01-29 22:00 ` John Kitchin
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).