[org] fix XMPP links

This commit is contained in:
contrapunctus 2021-07-31 14:57:57 +05:30
parent b90362e312
commit ff6207dcef
1 changed files with 19 additions and 9 deletions

View File

@ -2482,19 +2482,29 @@ SLIME opens CLHS links in Firefox, but I'd rather open them in Tor Browser; Tor
'("png" "jpeg" "jpg" "gif" "tiff" "tif" "xbm"
"xpm" "pbm" "pgm" "ppm" "webp") t)))))
;; https://lists.gnu.org/archive/html/emacs-orgmode/2018-02/msg00082.html
(defun my-export-link-helper (link desc format)
(cond
((eq format 'html)
(format "<a href=\"%s\">%s</a>" link desc))
((eq format 'latex)
;; (format "\\href{%s}{%s}" link desc)
(format "\\url{%s}" link))
(t ;; `ascii', `md', `hugo', etc.
(format "[%s](%s)" desc link))))
(defun my-export-gemini-link (link desc format)
"Create export version of LINK and DESC to FORMAT."
(let ((link (concat "gemini:" link)))
(cond
((eq format 'html)
(format "<a href=\"%s\">%s</a>" link desc))
((eq format 'latex)
;; (format "\\href{%s}{%s}" link desc)
(format "\\url{%s}" link))
(t ;; `ascii', `md', `hugo', etc.
(format "[%s](%s)" desc link)))))
(my-export-link-helper link desc format)))
(org-link-set-parameters "gemini" :export #'my-export-gemini-link)
(org-link-set-parameters "xmpp" :export #'my-export-gemini-link)
(defun my-export-xmpp-link (link desc format)
"Create export version of LINK and DESC to FORMAT."
(let ((link (concat "xmpp:" link)))
(my-export-link-helper link desc format)))
(org-link-set-parameters "xmpp" :export #'my-export-xmpp-link)
(defun contrapunctus-disable-nameless-key ()
(define-key nameless-mode-map (kbd "C-c C--") nil)))