-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transclusion of [attachment:<file>] links from org-attach? #198
Comments
I do not know a way; I don’t use attachment links. But… isn’t it just a link? Then why not use it as a link? |
The transcluded link won't work. I guess its because [attachment:] is a context-unique link. It means the file relative to the current attachment directory, and the attachment directory is derived from the current context ID. |
Attachment links can be expanded by On the other hand, the real question might be how to treat properties of the transcluded source. Should the properties of the source or the heading that the transcluded region is in be respected? |
This works for me: (defun org-transclusion-content-filter-expand-links (link)
"Convert LINK to an absolute filename.
LINK is assumed to be an Org element. This function does nothing
to LINK if the link is already absolute.
The current buffer is assumed to be the source buffer for the
transclusion."
(when (or
(string-equal "file" (org-element-property :type link))
(string-equal "attachment" (org-element-property :type link)))
(let ((type (org-element-property :type link))
(path (org-element-property :path link)))
(unless (file-name-absolute-p path)
(setq link (org-element-put-property
link :path
(if (string-equal "attachment" type)
(org-attach-expand path)
(expand-file-name
path
(file-name-directory (buffer-file-name (current-buffer)))))))
(if (string-equal "attachment" type)
(setq link (org-element-put-property
link :type "file")))
link)))) |
This may be more or less equivalent to @jtoloe function, but I have this snippet in the gist below to support ID and attachment links with anchors that I've been using for a while. It uses Edit: actually, my gist does something completely different (I misunderstood the question): it adds support for attachment links as the transclusion link, instead of expanding their occurrences within the transcluded content into absolute links. |
Hi, thanks for a great contribution to the Org Mode ecosystem.
I wonder if there is a known way to transclude images included with Attachment links?
I've tried
:expand-links
without luck.Many thanks,
Ash
The text was updated successfully, but these errors were encountered: