Hi Bastien and Nicolas, > -----Original Message----- > From: Bastien <b...@gnu.org> > Sent: den 22 februari 2020 14:32 > To: Nicolas Goaziou <m...@nicolasgoaziou.fr> > Cc: Gustav Wikström <gus...@whil.se>; email@example.com > Subject: Re: attachment: link type export to HTML invalid attach dir > > [...] > > Nicolas Goaziou <m...@nicolasgoaziou.fr> writes: > > > I'd like to hear from Gustav, too, since this affects the changes he > > introduced. If you are in a hurry, we can also apply it. Up to you. > > I just applied it - Gustav let us know if it fits your needs and if it > does not introduce regressions.
It does work. Thanks. One issue though, with org-attach-expand-links: +(defun org-attach-expand-links (_) + "Expand links in current buffer. +It is meant to be added to `org-export-before-parsing-hook'." + (save-excursion + (while (re-search-forward "attachment:" nil t) + (let ((link (org-element-context))) + (when (and (eq 'link (org-element-type link)) + (string-equal "attachment" + (org-element-property :type link))) + (let* ((description (and (org-element-property :contents-begin link) + (buffer-substring-no-properties + (org-element-property :contents-begin link) + (org-element-property :contents-end link)))) + (file (org-element-property :path link)) + (new-link (org-link-make-string + (concat "attachment:" (org-attach-expand file)) + description))) + (goto-char (org-element-property :end link)) + (skip-chars-backward " \t") + (delete-region (org-element-property :begin link) (point)) Expanding attachment-links in the buffer makes the link type no longer be attachment. I would prefer if we explicitly set the link type to files here instead. Storing intermediate state in an attachment link types makes less sense imo. One issue with the current way it's done is that images are treated differently between attachment links and file links. For HTML exports, file links are wrapped in a div with class figure where expanded attachment links are not. Letting org-attach-expand-links do the full transform to file links would solve that issue. That also means :export is not needed for org-link-set-parameters. Patch attached if you agree to this. > >> Do you want to do this for 9.4 or can it be done later on? > > > > This can be done later on. I don't have time to work on this. Of > > course, if someone wants to do it, that would be great, too. > > Okay, thanks. Noted for Org > 9.4. > > Best, > > -- > Bastien