org-e-html: Honor `org-e-html-link-org-files-as-html'

This commit is contained in:
Jambunathan K 2012-06-02 20:25:41 +05:30
parent 1d7e78ebf8
commit ca6f523ff5
1 changed files with 14 additions and 1 deletions

View File

@ -2499,8 +2499,21 @@ INFO is a plist holding contextual information. See
((member type '("http" "https" "ftp" "mailto"))
(concat type ":" raw-path))
((string= type "file")
;; Extract just the file path and strip all other
;; components.
(when (string-match "\\(.+\\)::.+" raw-path)
(setq raw-path (match-string 1 raw-path)))
;; If the link points to "*.org" file, rewrite it as
;; though it were a link to the corresponding
;; "*.html" file, if needed.
(when (and org-e-html-link-org-files-as-html
(string= ".org" (downcase (file-name-extension
raw-path "."))))
(setq raw-path (concat
(file-name-sans-extension raw-path) "."
(plist-get info :html-extension))))
;; If file path is absolute, prepend it with protocol
;; component - "file://".
(if (not (file-name-absolute-p raw-path)) raw-path
(concat "file://" (expand-file-name raw-path))))
(t raw-path)))