emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bastien <bzg@gnu.org>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Append value of #+HTML_LINK_HOME to links relative with paths
Date: Thu, 27 Jun 2013 19:00:12 +0200	[thread overview]
Message-ID: <87obaro5er.fsf@bzg.ath.cx> (raw)

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

Hi all,

the attached patch appends the value of #+HTML_LINK_HOME
to links with relative paths in the HTML export.

I need this for RSS feeds, in which relative paths are not
allowed.

This should not break anything, but I'd be glad if someone
can test this heavily against his HTML publishing setup.

Thanks!


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ox-html-prepend-html-link-home.patch --]
[-- Type: text/x-patch, Size: 1282 bytes --]

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index c0509ff..b4000b4 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -2485,7 +2485,8 @@ standalone images, do the following.
 DESC is the description part of the link, or the empty string.
 INFO is a plist holding contextual information.  See
 `org-export-data'."
-  (let* ((link-org-files-as-html-maybe
+  (let* ((home (org-trim (plist-get info :html-link-home)))
+	 (link-org-files-as-html-maybe
 	  (function
 	   (lambda (raw-path info)
 	     "Treat links to `file.org' as links to `file.html', if needed.
@@ -2511,9 +2512,12 @@ INFO is a plist holding contextual information.  See
 		  (funcall link-org-files-as-html-maybe raw-path info))
 	    ;; If file path is absolute, prepend it with protocol
 	    ;; component - "file://".
-	    (when (file-name-absolute-p raw-path)
-	      (setq raw-path
-		    (concat "file://" (expand-file-name raw-path))))
+	    (cond ((file-name-absolute-p raw-path)
+		   (setq raw-path
+			 (concat "file://" (expand-file-name
+					    raw-path))))
+		  (home
+		   (setq raw-path (concat (file-name-as-directory home) raw-path))))
 	    ;; Add search option, if any.  A search option can be
 	    ;; relative to a custom-id or a headline title.  Any other
 	    ;; option is ignored.

[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


-- 
 Bastien

             reply	other threads:[~2013-06-27 17:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-27 17:00 Bastien [this message]
2013-07-01 14:11 ` [PATCH] Append value of #+HTML_LINK_HOME to links relative with paths Bastien

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=87obaro5er.fsf@bzg.ath.cx \
    --to=bzg@gnu.org \
    --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).