[ol-conlang] Add conlang-md formating for dictionary links

This commit is contained in:
Lucien Cartier-Tilet 2022-06-22 11:07:13 +02:00
parent d319a68bde
commit c4e794498e
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA

View File

@ -34,7 +34,7 @@
(require 'ol) (require 'ol)
(require 'org-element) (require 'org-element)
(defun org-link-conlang-open (path arg) (defun org-link-conlang-open (path _arg)
"Open a conlang dictionary link. "Open a conlang dictionary link.
PATH is the path to a word or a language, as a string." PATH is the path to a word or a language, as a string."
(let* ((destructured-path (split-string path ":")) (let* ((destructured-path (split-string path ":"))
@ -86,6 +86,15 @@ containing the export paramenters."
(if (not desc) (if (not desc)
(format "@uref{%s}" generic-uri) (format "@uref{%s}" generic-uri)
(format "@urif{%s, %s}" generic-uri desc))) (format "@urif{%s, %s}" generic-uri desc)))
(`conlang-md
(format "<Dictionary lang=\"%s\" %s%s/>"
language
(if word
(format "word=\"%s\" " word)
"")
(if desc
(format "desc=\"%s\" " desc)
"")))
(_ generic-uri)))) (_ generic-uri))))
(org-link-set-parameters "conlang" (org-link-set-parameters "conlang"