Earl Chase <[email protected]> writes:

> This patch is for a very confusing edge case that came up when I was
> working on a verbatim link export option for ox-md. I was trying to see
> what part of org-html-link's code needed to be extracted for `org-md-link'.
> For a link like:
>
> [[/tmp/tmp-orgtest/emacs][Emacs]]
>
> you would expect org-html-link
> to return:
>
> <a href=\"file:///tmp/tmp-orgtest/emacs">Contributing to Org</a>
> ...
> <a 
> href=\"https://www.example.com/file:///en/install-emacs-on-android\";>install
> Emacs</a></p>.

Thanks!

> Subject: [PATCH] lisp/ox-html.el: Fix org-html-link file path creation bug
>
> * lisp/ox-html.el (org-html-link): Use
> `org-html--create-file-link-path' in order
> to create the link path of a file link.
> (org-html--create-file-link-path): Create the
> path of a file link.
>
> * testing/lisp/test-ox-html.el
> (ox-html/test-org-html-link-use-abs-url): New
> tests for `org-html-link'.

It is not clear what kind of bug the commit is fixing. It would be nice
to provide a brief description of the bug in question.

> +(defun org-html--create-file-link-path (raw-path info)
> +  "Convert RAW-PATH into a HTML file link path.
> +During publishing, turn absolute file names
> +belonging to base directory into relative
> +file names.  Otherwise,      append `file' protocol
> +to absolute file name.  INFO should be the
> +export options, as a plist."

You are using very small fill-column. This looks strange.
Also, so many spaces after "Otherwise".

> +(ert-deftest ox-html/test-org-html-link-use-abs-url ()
> +  "Test `org-html-link-use-abs-url'."
> ...
> +    ;; file is not in publishing directory
> +    (ert-with-temp-directory test-dir

ert-with-temp-directory and ert-with-temp-file are not available in Emacs 28.

> +             (test-info (list :base-directory test-dir
> +                              :test-home test-home))

What is :test-home?

> +    ;; with `org-html-link-use-abs-url'

You never let-bind  `org-html-link-use-abs-url'. Is it intentional?

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to