summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Kamat <jaygkamat@gmail.com>2017-09-24 12:11:52 -0400
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2017-09-24 18:33:55 +0200
commit405555ec5cf8d045fbfcf5615d0f9035bc2a8a3f (patch)
tree1a3c2383b44cc76a83f3c64a72f45250ac77d5e1
parent3056abe7816af7f1fb541fe3793bb1b30d6b69ad (diff)
downloadorg-mode-405555ec5cf8d045fbfcf5615d0f9035bc2a8a3f.tar.gz
org-irc.el: Add proper export functions for irc
* lisp/org-irc.el (org-irc-export): Add a new function, org-irc-export, which properly exports irc links to html and markdown * lisp/ox-md.el (org-md-link): Remove workaround to get irc links working properly in ox-md, and use org-irc's export functions instead
-rw-r--r--lisp/org-irc.el15
-rw-r--r--lisp/ox-md.el2
2 files changed, 15 insertions, 2 deletions
diff --git a/lisp/org-irc.el b/lisp/org-irc.el
index 5889f6d..bafb9ce 100644
--- a/lisp/org-irc.el
+++ b/lisp/org-irc.el
@@ -71,7 +71,10 @@
;; Generic functions/config (extend these for other clients)
-(org-link-set-parameters "irc" :follow #'org-irc-visit :store #'org-irc-store-link)
+(org-link-set-parameters "irc"
+ :follow #'org-irc-visit
+ :store #'org-irc-store-link
+ :export #'org-irc-export)
(defun org-irc-visit (link)
"Parse LINK and dispatch to the correct function based on the client found."
@@ -245,6 +248,16 @@ default."
;; no server match, make new connection
(erc-select :server server :port port))))
+(defun org-irc-export (link description format)
+ "Export an IRC link.
+See `org-link-parameters' for details about LINK, DESCRIPTION and
+FORMAT."
+ (let ((desc (or description link)))
+ (pcase format
+ (`html (format "<a href=\"irc:%s\">%s</a>" link desc))
+ (`md (format "[%s](irc:%s)" desc link))
+ (_ nil))))
+
(provide 'org-irc)
;; Local variables:
diff --git a/lisp/ox-md.el b/lisp/ox-md.el
index 5ba52e7..146956e 100644
--- a/lisp/ox-md.el
+++ b/lisp/ox-md.el
@@ -449,7 +449,7 @@ a communication channel."
(t (let* ((raw-path (org-element-property :path link))
(path
(cond
- ((member type '("http" "https" "ftp" "mailto" "irc"))
+ ((member type '("http" "https" "ftp" "mailto"))
(concat type ":" raw-path))
((string= type "file")
(org-export-file-uri (funcall link-org-files-as-md raw-path)))