diff --git a/ox-plumhtml-tests.el b/ox-plumhtml-tests.el
index c53d8e0..84b8304 100644
--- a/ox-plumhtml-tests.el
+++ b/ox-plumhtml-tests.el
@@ -61,6 +61,11 @@
"
mwee
"
"* mwee" '(:export-header-ids t)))
+(ert-deftest link-without-content ()
+ (should-render-as
+ "https://flanchan.moe
"
+ "[[https://flanchan.moe]]"))
+
;; Links and IDs
(ert-deftest link ()
(should-render-as
diff --git a/ox-plumhtml.el b/ox-plumhtml.el
index b09b0e8..c46db3e 100644
--- a/ox-plumhtml.el
+++ b/ox-plumhtml.el
@@ -3,7 +3,7 @@
;; Author: Plum
;; Created: June 2020
-;; Package-Version: 1.2.0
+;; Package-Version: 1.2.1
;; Keywords: files
;; URL: https://words.plum.moe/ox-plumhtml.html
;; Package-Requires: ((emacs "26.1") (ox-slimhtml "0.4.5"))
@@ -120,20 +120,18 @@ INFO is a plist holding contextual information."
(cond
((ox-slimhtml--immediate-child-of-p link 'link)
(org-element-property :raw-link link))
- ((not contents)
- (format "%s" (org-element-property :path link)))
(t (let ((link-type (org-element-property :type link))
(href (org-element-property :raw-link link))
(attributes (if (ox-slimhtml--immediate-child-of-p link 'paragraph)
(ox-slimhtml--attr (org-export-get-parent link))
""))
- (element "%s"))
+ (element "%s")
+ (path (or (org-element-property :path link) "")))
(cond
((string= "file" link-type)
(let ((html-extension (or (plist-get info :html-extension) ""))
(use-abs-url (plist-get info :html-link-use-abs-url))
- (link-org-files-as-html (plist-get info :html-link-org-as-html))
- (path (or (org-element-property :path link) "")))
+ (link-org-files-as-html (plist-get info :html-link-org-as-html)))
(format element
(concat (if (and use-abs-url (file-name-absolute-p path)) "file:" "")
(if (and link-org-files-as-html (string= "org" (downcase (or (file-name-extension path) ""))))
@@ -142,12 +140,15 @@ INFO is a plist holding contextual information."
(file-name-sans-extension path))
path))
attributes contents)))
+ ((and (string= "fuzzy" link-type)
+ (not contents))
+ (format "%s" path))
((and (string= "fuzzy" link-type)
(plist-get info :export-header-ids))
(format "%s"
(org-export-get-reference (org-export-resolve-fuzzy-link link info) info)
attributes contents))
- (t (format element href attributes contents)))))))
+ (t (format element href attributes (or contents href))))))))
;; org-export backend and export/publish functions
(org-export-define-derived-backend 'plumhtml