2017-06-08 11:47:56 +02:00
|
|
|
;;; lang/html/autoload/evil.el -*- lexical-binding: t; -*-
|
2022-08-12 20:29:19 +02:00
|
|
|
;;;###if (modulep! :editor evil)
|
2017-02-19 18:57:16 -05:00
|
|
|
|
2017-04-22 21:45:14 -04:00
|
|
|
;;;###autoload (autoload '+web:encode-html-entities "lang/web/autoload/evil" nil t)
|
2019-12-20 23:04:07 -05:00
|
|
|
(evil-define-operator +web:encode-html-entities (beg end &optional bang input)
|
2019-05-01 19:12:52 -04:00
|
|
|
"Encodes HTML entities in INPUT or the selected region."
|
2019-12-20 23:04:07 -05:00
|
|
|
(interactive "<r><!><a>")
|
2017-02-19 18:57:16 -05:00
|
|
|
(cond (input
|
2019-12-20 23:04:07 -05:00
|
|
|
(let ((result (+web-encode-entities input)))
|
|
|
|
(if bang
|
|
|
|
(kill-new result)
|
|
|
|
(insert result))))
|
2017-02-19 18:57:16 -05:00
|
|
|
((and beg end)
|
2017-04-22 21:45:14 -04:00
|
|
|
(+web/encode-entities-region beg end))))
|
2017-02-19 18:57:16 -05:00
|
|
|
|
2017-04-22 21:45:14 -04:00
|
|
|
;;;###autoload (autoload '+web:decode-html-entities "lang/web/autoload/evil" nil t)
|
2019-12-20 23:04:07 -05:00
|
|
|
(evil-define-operator +web:decode-html-entities (beg end &optional bang input)
|
2019-05-01 19:12:52 -04:00
|
|
|
"Decodes HTML entities in INPUT or the selected region."
|
2019-12-20 23:04:07 -05:00
|
|
|
(interactive "<r><!><a>")
|
2017-02-19 18:57:16 -05:00
|
|
|
(cond (input
|
2019-12-20 23:04:07 -05:00
|
|
|
(let ((result (+web-decode-entities input)))
|
|
|
|
(if bang
|
|
|
|
(kill-new result)
|
|
|
|
(insert result))))
|
2017-02-19 18:57:16 -05:00
|
|
|
((and beg end)
|
2017-04-22 21:45:14 -04:00
|
|
|
(+web/decode-entities-region beg end))))
|