Created
December 2, 2018 03:40
-
-
Save MatthewRalston/af689a65c0c9175b9cb7638e64ad6e7e to your computer and use it in GitHub Desktop.
Add popover to HTML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Add this to your favorite html/jekyll configuration elisp file | |
;; Replace $IMG with the relative path to your websites image folder (e.g. img/) | |
(defun add-popover (link imagepath caption linktext) | |
"Generate an html popover. | |
-- Downloads an image file to your website/blog (etc.) image folder. | |
-- Generate a Bootstrap HTML popover link at the cursor position with caption. | |
" | |
(interactive "MImage link:\nFImagepath:\nMCaption:\nMLink text:\n") | |
(url-copy-file link imagepath) | |
(insert (concat (format "<a href=\"#\" title=\"%s\" data-toggle=\"popover\" data-placement=\"auto\" data-trigger=\"hover\" data-html=true data-content='<img src=\"$IMG/%s\"" | |
caption (file-name-nondirectory imagepath)) | |
" height=\"100%\" width=\"100%\" />'>" | |
linktext | |
"</a>"))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment