From: Ihor Radchenko <yantar92@gmail.com>
To: reza <reza@housseini.me>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: Internal link to resulting image from source block
Date: Thu, 04 Aug 2022 10:37:53 +0800 [thread overview]
Message-ID: <87mtckhgxq.fsf@localhost> (raw)
In-Reply-To: <01020182658e20e8-67e349b2-0f8b-457a-89ac-8242af01ff94-000000@eu-west-1.amazonses.com>
reza <reza@housseini.me> writes:
> Hi List
>
> I'm exporting a plantuml figure to HTML like
>
> #+name: html transformation
> #+begin_src plantuml :file img/transformation-html.svg :exports results
> file org
> file html
> org -> html : org-html-publish-to-html
> #+end_src
>
> Now I want to include an internal link to this figure with ~[[html
> transformation]]~ but when I export I always get "Unable to resolve
> link". Any idea what I'm doing wrong?
Nothing really wrong on your side. It is probably an omission on the Org
side.
Executing the above code produces
#+RESULTS: html transformation
[[file:img/transformation-html.svg]]
However, it is currently impossible to link to such results paragraph by
itself - only to the parent src block. Since you are using :exports
results, the export code does not "see" the src block; only the results
block which cannot be referenced. Hence, the error.
They way to work around the problem is providing explicit name anchor to
the results block:
------------
#+name: html transformation
#+begin_src plantuml :file img/transformation-html.svg :exports results :mkdirp yes
file org
file html
org -> html : org-html-publish-to-html
#+end_src
#+name: html transformation result
#+RESULTS: html transformation
[[file:img/transformation-html.svg]]
Now I want to include an internal link to this figure with [[html
transformation result]]. This works now.
------------
Though I do agree that the current behaviour is not intuitive in this
specific scenario. When a user provides :exports results, it would make
sense to inherit all the affiliated keywords, including #+name and
possibly various #+attr_* to the results of evaluation.
On the other hand, inheriting may be tricky. I can imagine situations
when such inheritance is not desired and a user actually prefers to
state the results keywords manually.
I am not sure what would be the best way to handle the situation at hand
while not breaking the other :exports variants.
Best,
Ihor
next prev parent reply other threads:[~2022-08-04 2:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <56e1e299-b04d-0b01-7dec-564207d4484a@housseini.me>
2022-08-03 21:13 ` Internal link to resulting image from source block reza
2022-08-04 2:37 ` Ihor Radchenko [this message]
[not found] ` <032306dd-7465-fdfd-b6c1-0bd82b662370@housseini.me>
2022-08-04 17:21 ` reza
2022-08-05 1:48 ` Ihor Radchenko
[not found] ` <cb227c57-2e08-78d5-f1b4-e70d0c58bf16@housseini.me>
2022-08-05 6:34 ` reza
2022-08-05 10:15 ` [PATCH] org-export: Make results of named code blocks a valid link Ihor Radchenko
[not found] ` <2af7a860-bb5f-a639-291a-ba7f7d38aa20@housseini.me>
2022-08-08 10:59 ` reza
2022-08-08 12:21 ` Ihor Radchenko
2022-08-22 12:01 ` Ihor Radchenko
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mtckhgxq.fsf@localhost \
--to=yantar92@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=reza@housseini.me \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.