From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: Re: Understand the source of "Unable to resolve link" Date: Sun, 04 Feb 2018 20:42:05 +0000 Message-ID: References: <87k1vsiv7t.fsf@nicolasgoaziou.fr> <87fu6giuna.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="94eb2c0873ce31502f056468fbd2" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56004) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eiR7D-0003mP-C0 for emacs-orgmode@gnu.org; Sun, 04 Feb 2018 15:42:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eiR7C-00046F-Dz for emacs-orgmode@gnu.org; Sun, 04 Feb 2018 15:42:19 -0500 Received: from mail-yw0-x230.google.com ([2607:f8b0:4002:c05::230]:34346) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eiR7C-000462-8k for emacs-orgmode@gnu.org; Sun, 04 Feb 2018 15:42:18 -0500 Received: by mail-yw0-x230.google.com with SMTP id t201so17066122ywf.1 for ; Sun, 04 Feb 2018 12:42:17 -0800 (PST) In-Reply-To: <87fu6giuna.fsf@nicolasgoaziou.fr> 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: Nicolas Goaziou Cc: emacs-org list --94eb2c0873ce31502f056468fbd2 Content-Type: text/plain; charset="UTF-8" On Sun, Feb 4, 2018 at 11:31 AM Nicolas Goaziou wrote: > Note that you cannot simply copy "http" or "https" types. As default > type links, they are hard-coded in every export back-end. It means they > do not have to set any :export property. > > As a user, if you want to export a "gopher" link type, you need to > implement a function exporting it, and register it as the :export value. > Thank you. This works. (defun org-link-gopher-export-link (link desc format) "Create export version of LINK and DESC to FORMAT." (let ((link (concat "gopher:" link))) (cond ((eq format 'html) (format "%s" link desc)) ((eq format 'latex) (format "\\href{%s}{%s}" link desc)) (t ;`ascii', `md', `hugo', etc. (format "[%s](%s)" desc link))))) (org-link-set-parameters "gopher" :export #'org-link-gopher-export-link) -- Kaushal Modi --94eb2c0873ce31502f056468fbd2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sun, Feb 4,= 2018 at 11:31 AM Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
Note that you cannot simply copy "http" or "https&qu= ot; types. As default
type links, they are hard-coded in every export back-end. It means they
do not have to set any :export property.

As a user, if you want to export a "gopher" link type, you need t= o
implement a function exporting it, and register it as the :export value.

Thank you.

This works.<= br>
(defun org-link-gopher-export-link (link desc format)
=C2=A0 &quo= t;Create export version of LINK and DESC to FORMAT."
=C2=A0 (let ((= link (concat "gopher:" link)))
=C2=A0=C2=A0=C2=A0 (cond
=C2= =A0=C2=A0=C2=A0=C2=A0 ((eq format 'html)
=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 (format "<a href=3D\"%s\">%s</a>" link = desc))
=C2=A0=C2=A0=C2=A0=C2=A0 ((eq format 'latex)
=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 (format "\\href{%s}{%s}" link desc))
=C2=A0= =C2=A0=C2=A0=C2=A0 (t=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;`ascii', `md',= `hugo', etc.
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (format "[%s](%s)&= quot; desc link)))))
(org-link-set-parameters "gopher" :export= #'org-link-gopher-export-link)
--

Kaushal Modi

--94eb2c0873ce31502f056468fbd2--