From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: [PATCH] Append value of #+HTML_LINK_HOME to links relative with paths Date: Thu, 27 Jun 2013 19:00:12 +0200 Message-ID: <87obaro5er.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37533) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsFZt-0003s6-V6 for emacs-orgmode@gnu.org; Thu, 27 Jun 2013 13:03:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UsFYU-0001ha-Mz for emacs-orgmode@gnu.org; Thu, 27 Jun 2013 13:01:49 -0400 Received: from plane.gmane.org ([80.91.229.3]:42697) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsFYU-0001hS-Gf for emacs-orgmode@gnu.org; Thu, 27 Jun 2013 13:00:22 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UsFYR-0003pT-JT for emacs-orgmode@gnu.org; Thu, 27 Jun 2013 19:00:19 +0200 Received: from 78.250.243.101 ([78.250.243.101]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 27 Jun 2013 19:00:19 +0200 Received: from bzg by 78.250.243.101 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 27 Jun 2013 19:00:19 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain 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! --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=ox-html-prepend-html-link-home.patch 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. --=-=-= Content-Type: text/plain -- Bastien --=-=-=--