From mboxrd@z Thu Jan 1 00:00:00 1970 From: Milan Zimmermann Subject: Re: Handling custom link types for html export in v 9.0 - Replacement for deprecated `org-add-link-type`? Date: Tue, 18 Apr 2017 21:50:43 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42809) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d0fhy-0004uu-Hf for emacs-orgmode@gnu.org; Tue, 18 Apr 2017 22:51:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d0fhx-00012W-77 for emacs-orgmode@gnu.org; Tue, 18 Apr 2017 22:51:06 -0400 Received: from mail-oi0-x229.google.com ([2607:f8b0:4003:c06::229]:35968) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d0fhx-00012M-1o for emacs-orgmode@gnu.org; Tue, 18 Apr 2017 22:51:05 -0400 Received: by mail-oi0-x229.google.com with SMTP id r203so13053802oib.3 for ; Tue, 18 Apr 2017 19:51:04 -0700 (PDT) In-Reply-To: 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" To: emacs-orgmode@gnu.org Great, thanks very much John. As a minor note I had to make a slight change (org-link-set-parameters "img" :follow 'org-custom-link-img-follow ; my old code :export 'org-custom-link-img-export) ; my old code And then it works equivalent with the previous version in 8. Thanks Milan PS (There is another note which is for a new thread: both in 8 and 9, while they export what I need, actually do not display the image in org buffer. The reason seem to be the org-display-inline-images is only looking for the "file" link but I need to debug that first) On Tue, Apr 18, 2017 at 9:00 AM, John Kitchin wrote: > You can find a many examples of the new link syntax here: > http://kitchingroup.cheme.cmu.edu/blog/2016/11/04/New-link-features-in-org-9/ > > You will probably be able to reuse much of your old code and this: > > (org-link-set-parameters > "img" > :follow (your-old-follow-code) > :export (your-old-export-code)) > > Milan Zimmermann writes: > >> Hi: >> >> I have a question about how to define custom link type, which before >> 9.0 used the (9.0) deprecated `org-add-link-type`. >> >> 1. Let me first provide the context: >> >> There is often a need to generate, for org links export/publish to >> Html, elements where img src URL starts with a slash, like this >> >> >> >> The only way that was possible before v9, for this to be exported from >> a link such as >> >> [[/images/a.jgp]] >> >> was to use a method described in >> >> http://stackoverflow.com/questions/14684263/how-to-org-mode-image-absolute-path-of-export-html >> >> - Basically, the solution described there is >> >> a) define a custom link type such as "img" >> b) in org, use [[img:images/a.jpg]] >> c) define two functions handling the img link in org and on >> export/publish, and call (org-add-link-type "img" >> 'org-custom-link-img-follow 'org-custom-link-img-export) >> >> 2. The problem and question >> >> In org 9.0, we get `org-add-link-type ... This function is obsolete >> since Org 9.0 use `org-link-set-parameters' instead. >> >> My problem is I have no idea how to, in a practical sense, use >> `org-link-set-parameters` to define a custom link type "img" and >> handle it's image handling in both org buffer and Html publish. >> >> My question is, are there any links and examples how one would do the >> above in 9.0? >> >> Thanks >> Milan > > > -- > 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