Add function for inserting local image with proper export path

This commit is contained in:
mez 2025-08-18 21:53:37 +01:00
parent fd515b5266
commit 02b0369d87

View file

@ -0,0 +1,21 @@
(defun dwuser ()
"Insert HTML link to a DW personal account"
(interactive)
(setq theuser (read-string "DW username: "))
(setq userdisplay (subst-char-in-string ?- ?_ theuser))
(setq userlink (subst-char-in-string ?_ ?- theuser))
(insert (concat "<a href=\"https://" userlink ".dreamwidth.org/profile\">~</a><a href=\"https://" userlink ".dreamwidth.org\">" userdisplay "</a>")))
(defun dwcomm ()
"Insert HTML link to a DW community"
(interactive)
(setq theuser (read-string "DW comm name: "))
(setq userdisplay (subst-char-in-string ?- ?_ theuser))
(setq userlink (subst-char-in-string ?_ ?- theuser))
(insert (concat "<a href=\"https://" userlink ".dreamwidth.org/profile\">/</a><a href=\"https://" userlink ".dreamwidth.org\">" userdisplay "</a>")))
(defun orgimg ()
"Insert an image and link to its external location"
(interactive)
(setq thefile (read-string "Image file name: "))
(insert "#+ATTR_HTML: :src /dw/" thefile "\n#+ATTR_HTML: :class noteimg\n[[file:~/Documents/drive/org/journal/media/" thefile "]]"))