emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: Conditional link export?
Date: Sun, 22 Nov 2015 18:08:50 -0500	[thread overview]
Message-ID: <m2io4tws1p.fsf@andrew.cmu.edu> (raw)
In-Reply-To: <87io4tpsu2.fsf@nicolasgoaziou.fr>

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 "<a href=\"http://some.place/%s\">%s</a>" 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:
>>
>> <p>
>> &lt;a href="<a href="http://some.place/info">http://some.place/info</a>"&gt;org&lt;/a&gt; <a href="org">org</a>
>> </p>
>>
>> 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:<a href=\"http://some.place/%s\">%s</a>@@" 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

  parent reply	other threads:[~2015-11-22 23:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-06 13:02 Conditional link export? Oleh Krehel
2015-11-06 13:24 ` Aaron Ecay
2015-11-06 13:26   ` Aaron Ecay
2015-11-07 13:05   ` Oleh Krehel
2015-11-07 14:21     ` Aaron Ecay
2015-11-07 16:23       ` Achim Gratz
2015-11-08 14:09       ` Oleh Krehel
2015-11-08 14:27         ` Nicolas Goaziou
2015-11-08 14:56           ` Oleh Krehel
2015-11-08 15:04             ` Nicolas Goaziou
2015-11-08 15:35               ` Oleh Krehel
2015-11-08 16:06                 ` Nicolas Goaziou
     [not found]                   ` <m2k2ps9x9o.fsf@andrew.cmu.edu>
     [not found]                     ` <8737wg6zi3.fsf@nicolasgoaziou.fr>
     [not found]                       ` <m2ziy6vsw2.fsf@andrew.cmu.edu>
     [not found]                         ` <87io4tpsu2.fsf@nicolasgoaziou.fr>
2015-11-22 23:08                           ` John Kitchin [this message]
2015-11-08 18:03         ` Aaron Ecay
2015-11-06 13:28 ` 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=m2io4tws1p.fsf@andrew.cmu.edu \
    --to=jkitchin@andrew.cmu.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    /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).