emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Append value of #+HTML_LINK_HOME to links relative with paths
@ 2013-06-27 17:00 Bastien
  2013-07-01 14:11 ` Bastien
  0 siblings, 1 reply; 2+ messages in thread
From: Bastien @ 2013-06-27 17:00 UTC (permalink / raw)
  To: emacs-orgmode

[-- 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-07-01 14:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-27 17:00 [PATCH] Append value of #+HTML_LINK_HOME to links relative with paths Bastien
2013-07-01 14:11 ` Bastien

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).