Created
June 12, 2019 15:22
-
-
Save nothingrealhappen/22f84c15b61f5e1cac1b22879a48825b to your computer and use it in GitHub Desktop.
Create amp-image shortcode by emacs shortcut
This file contains hidden or 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
(defun insertAmpImage () | |
(interactive) | |
( | |
let ((url (read-string "Enter url:"))) | |
(message "detecting") | |
(insert | |
(apply 'format | |
(append | |
'(" | |
#+begin_export html | |
{{%%amp-image layout=\"responsive\" src=%S alt=\"\" width=%S height=%S %%}} | |
#+end_export") | |
(append | |
(list url) | |
(split-string (shell-command-to-string (concat "identify -ping -format '%w %h' " url))) | |
) | |
) | |
) | |
) | |
(message "Done") | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment