Created
March 24, 2010 14:01
-
-
Save ussy/342306 to your computer and use it in GitHub Desktop.
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 my-html-escape (start end) | |
(interactive "r") | |
(save-excursion | |
(save-restriction | |
(narrow-to-region start end) | |
(goto-char (point-min)) | |
(while (re-search-forward "<" nil t) | |
(replace-match "<")) | |
(goto-char (point-min)) | |
(while (re-search-forward ">" nil t) | |
(replace-match ">")) | |
(while (re-search-forward "\"" nil t) | |
(replace-match ""e;")) | |
(while (re-search-forward "&" nil t) | |
(replace-match "&"))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment