emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Akira Kyle <akira@akirakyle.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] ox-html.el: Fix relative links with :html-link-use-abs-url
Date: Sat, 17 Jun 2023 13:01:06 -0600	[thread overview]
Message-ID: <m2sfapx66v.fsf@akirakyle.com> (raw)

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


I'm pretty sure this fixes a bug and that the intended behavior is 
that when publishing with, say, ~:html-link-use-abs-url t~ and 
~:html-link-home mysite.com~, one would expect a link like 
~[[file:my/page.org]]~ to be exported to ~mysite.com/my/page.com~.

I may have have misunderstood something though.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-html-link-Fix-relative-links-with-html-link-use-.patch --]
[-- Type: text/x-patch, Size: 1068 bytes --]

From e9b8b782dbf956c855e2e3cdec5b9e8aa47d47c1 Mon Sep 17 00:00:00 2001
From: Akira Kyle <akira@akirakyle.com>
Date: Mon, 27 Feb 2023 12:12:32 -0700
Subject: [PATCH] org-html-link: Fix relative links with :html-link-use-abs-url

* lisp/ox-html.el (org-html-link): When publishing relative links with
both :html-link-use-abs-url and :html-link-home, ensure the correct
link is constructed.
---
 lisp/ox-html.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index b519402b1..27da1cc30 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -3227,7 +3227,7 @@ INFO is a plist holding contextual information.  See
 			     (org-trim (plist-get info :html-link-home)))))
 	      (when (and home
 			 (plist-get info :html-link-use-abs-url)
-			 (file-name-absolute-p raw-path))
+			 (not (file-name-absolute-p raw-path)))
 		(setq raw-path (concat (file-name-as-directory home) raw-path))))
 	    ;; Maybe turn ".org" into ".html".
 	    (setq raw-path (funcall link-org-files-as-html-maybe raw-path info))
-- 
2.41.0


             reply	other threads:[~2023-06-17 19:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-17 19:01 Akira Kyle [this message]
2023-06-18 11:25 ` [PATCH] ox-html.el: Fix relative links with :html-link-use-abs-url Ihor Radchenko
2023-07-10  8:18 ` 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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2sfapx66v.fsf@akirakyle.com \
    --to=akira@akirakyle.com \
    --cc=emacs-orgmode@gnu.org \
    /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 public 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).