From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: Conditional link export? Date: Sun, 22 Nov 2015 18:08:50 -0500 Message-ID: References: <87ziyri8lk.fsf@gmail.com> <878u6buupy.fsf@gmail.com> <87d1vmgdt6.fsf@gmail.com> <87fv0hubym.fsf@gmail.com> <874mgwd1mi.fsf@gmail.com> <87h9kw8t1t.fsf@nicolasgoaziou.fr> <87h9kwbkv2.fsf@gmail.com> <871tc08rcc.fsf@nicolasgoaziou.fr> <87mvuoa4gy.fsf@gmail.com> <87k2ps79xv.fsf@nicolasgoaziou.fr> <8737wg6zi3.fsf@nicolasgoaziou.fr> <87io4tpsu2.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58490) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0dkk-0001oY-IU for emacs-orgmode@gnu.org; Sun, 22 Nov 2015 18:09:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a0dkf-0005xd-I7 for emacs-orgmode@gnu.org; Sun, 22 Nov 2015 18:09:02 -0500 Received: from mail-qg0-x22c.google.com ([2607:f8b0:400d:c04::22c]:34284) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0dkf-0005xJ-F3 for emacs-orgmode@gnu.org; Sun, 22 Nov 2015 18:08:57 -0500 Received: by qgeb1 with SMTP id b1so105822002qge.1 for ; Sun, 22 Nov 2015 15:08:56 -0800 (PST) In-reply-to: <87io4tpsu2.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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nicolas Goaziou Cc: "emacs-orgmode@gnu.org" That gets closer! Thanks. It ends up having a duplicate link if you evaluate the inline src in the org buffer, which outputs an org-link, and then evaluate it again during the export. The :results raw keeps putting new output inline. I think I lean more towards modifying the export behavior of a link to accomplish this goal. It ends up having the same effect as far as I can tell, with shorter syntax in the org document. Nicolas Goaziou writes: > Hello, > >> I gave this a try. The idea is to have a function that exports >> differently in different backends in inline src. I don't need this, but >> I thought it would be interesting to try as it would enable one thing to >> transform to many different representations that doesn't go through the >> new link approach, filter mechanism or the derived backend mechanism. >> >> #+BEGIN_SRC emacs-lisp >> (setq org-export-babel-evaluate 'inline-only) >> >> (defun foo (arg1 arg2) >> (cond >> ((eq 'html org-export-current-backend) >> (format "%s" arg1 arg2)) >> (t >> (format "[[%s:%s][%s]]" arg1 arg2 arg2)))) >> #+END_SRC >> >> src_emacs-lisp[:results raw]{(foo "info" "org")} [[info:org][org]] >> >> exports like this: >> >>

>> <a href="http://some.place/info">org</a> org >>

>> >> It looks like the angle brackets get escaped. I am not sure if there is >> a way to avoid that without a filter or additional function. Otherwise, >> it would work I think. Any thoughts? > > ":results raw" means results are inserted as raw Org text. This is the > same as writing text in an Org document before exporting it. As > a consequence, these results are escaped during the export process. > > You could wrap the results in an export snippet, e.g., > > (format "@@html:%s@@" arg1 arg2) > > > 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