emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Problems with attachment links in exported files
@ 2021-01-03  9:12 Pablo Palazon
  2021-01-03 20:46 ` Kyle Meyer
  0 siblings, 1 reply; 3+ messages in thread
From: Pablo Palazon @ 2021-01-03  9:12 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1311 bytes --]

Hi everyone!

I've had a trouble with attachment type link on exporting. I configured
org-attach directory and using org-id and it works great on emacs, all
those links work great. I can see any attach linked on org notes, but in
exported files all those links point to local directory instead of the
right attached folder.

I read this article (
https://vxlabs.com/2020/07/25/emacs-lisp-function-convert-attachment-to-file/)
which talks about that "org-attach-export-link" function will be removed.
I've tried to convert attachment to file links, and it works fine. But I'd
prefer to use attachment links instead of converting them.

I also read this thread (
https://lists.libreplanet.org/archive/html/emacs-orgmode/2020-02/msg00784.html),
but I'm quite sure if all these changes all actually implemented on
org-mode. I tried to use

(add-hook 'org-export-before-parsing-hook 'org-attach-expand-links)

And it works except for inline images, but I don't understand why is not on
org-mode repository code.

Thanks you in advance!. Best regards!

P.D.: I also tried to look up more information about this problem on this
list, I couldn't find anything on the list searcher.
https://lists.gnu.org/archive/cgi-bin/namazu.cgi?query=attachment&submit=Search%21&idxname=emacs-orgmode&max=20&result=normal&sort=score

[-- Attachment #2: Type: text/html, Size: 1948 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problems with attachment links in exported files
  2021-01-03  9:12 Problems with attachment links in exported files Pablo Palazon
@ 2021-01-03 20:46 ` Kyle Meyer
  2021-01-03 21:53   ` Pablo Palazon
  0 siblings, 1 reply; 3+ messages in thread
From: Kyle Meyer @ 2021-01-03 20:46 UTC (permalink / raw)
  To: Pablo Palazon; +Cc: emacs-orgmode

Pablo Palazon writes:

> Hi everyone!
>
> I've had a trouble with attachment type link on exporting. I configured
> org-attach directory and using org-id and it works great on emacs, all
> those links work great. I can see any attach linked on org notes, but in
> exported files all those links point to local directory instead of the
> right attached folder.
>
[...]
> I tried to use
>
> (add-hook 'org-export-before-parsing-hook 'org-attach-expand-links)
>
> And it works except for inline images, but I don't understand why is not on
> org-mode repository code.

Hmm, I'm not sure what you mean by the last part.  The snippet you show
is in the Org repo, specifically in org-attach.el:

  https://code.orgmode.org/bzg/org-mode/src/release_9.4.4/lisp/org-attach.el#L750

I'm not an org-attach user, so I might be missing something obvious, but
I wasn't able to trigger the issue with inline links.  Here's what I
tried using the default configuration on the master branch (c3888a8b7):

  (require 'org-attach)
  (let ((default-directory (make-temp-file "org-attach-export-test-" t)))
    (with-current-buffer (find-file-noselect "scratch.org")
      (insert "* h1\n\n")
      (org-attach-url
       "https://orgmode.org/worg/images/agenda/org-agenda-colorized-blocks.png")
      (insert "attachment:org-agenda-colorized-blocks.png")
      (org-open-file (org-html-export-to-html))))

That output includes

    <img
    src="file:///tmp/org-attach-export-test-Surcu0/data/ad/4bdf8f-a28e-4621-a1e4-dc772ed6d531/org-agenda-colorized-blocks.png"
    alt="org-agenda-colorized-blocks.png" />

and the image is rendered inline.

Could you provide a minimal reproducer for the issue you see?


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problems with attachment links in exported files
  2021-01-03 20:46 ` Kyle Meyer
@ 2021-01-03 21:53   ` Pablo Palazon
  0 siblings, 0 replies; 3+ messages in thread
From: Pablo Palazon @ 2021-01-03 21:53 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2135 bytes --]

Thanks Kyle!, While I was reading your message I checked that my org-mode
version was outdated. I configured org-mode repository, but I didn't
install the latest org-mode version. So I'm sorry for that. I've tried your
snippet, and it works perfectly. Thank you for you time, I appreciate it.

On Sun, Jan 3, 2021 at 9:46 PM Kyle Meyer <kyle@kyleam.com> wrote:

> Pablo Palazon writes:
>
> > Hi everyone!
> >
> > I've had a trouble with attachment type link on exporting. I configured
> > org-attach directory and using org-id and it works great on emacs, all
> > those links work great. I can see any attach linked on org notes, but in
> > exported files all those links point to local directory instead of the
> > right attached folder.
> >
> [...]
> > I tried to use
> >
> > (add-hook 'org-export-before-parsing-hook 'org-attach-expand-links)
> >
> > And it works except for inline images, but I don't understand why is not
> on
> > org-mode repository code.
>
> Hmm, I'm not sure what you mean by the last part.  The snippet you show
> is in the Org repo, specifically in org-attach.el:
>
>
> https://code.orgmode.org/bzg/org-mode/src/release_9.4.4/lisp/org-attach.el#L750
>
> I'm not an org-attach user, so I might be missing something obvious, but
> I wasn't able to trigger the issue with inline links.  Here's what I
> tried using the default configuration on the master branch (c3888a8b7):
>
>   (require 'org-attach)
>   (let ((default-directory (make-temp-file "org-attach-export-test-" t)))
>     (with-current-buffer (find-file-noselect "scratch.org")
>       (insert "* h1\n\n")
>       (org-attach-url
>        "
> https://orgmode.org/worg/images/agenda/org-agenda-colorized-blocks.png")
>       (insert "attachment:org-agenda-colorized-blocks.png")
>       (org-open-file (org-html-export-to-html))))
>
> That output includes
>
>     <img
>
> src="file:///tmp/org-attach-export-test-Surcu0/data/ad/4bdf8f-a28e-4621-a1e4-dc772ed6d531/org-agenda-colorized-blocks.png"
>     alt="org-agenda-colorized-blocks.png" />
>
> and the image is rendered inline.
>
> Could you provide a minimal reproducer for the issue you see?
>

[-- Attachment #2: Type: text/html, Size: 3059 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-03 21:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-03  9:12 Problems with attachment links in exported files Pablo Palazon
2021-01-03 20:46 ` Kyle Meyer
2021-01-03 21:53   ` Pablo Palazon

Code repositories for project(s) associated with this 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).