gpt4 book ai didi

html - 是否有用于 html 转义的 Emacs 包?

转载 作者:行者123 更新时间:2023-12-01 06:19:23 25 4
gpt4 key购买 nike

例子:

<p>Um diese App verwenden zu können, benötigen Sie JavaScript.</p>

应替换为:

<p>Um diese App verwenden zu k&ouml;nnen, ben&ouml;tigen Sie JavaScript.</p>

是否存在对区域执行此类替换的现有函数或包?

最佳答案

评论后编辑,谢谢。

在此处下载文件 html2uml.el:

http://bazaar.launchpad.net/~a-roehler/s-x-emacs-werkstatt/trunk/view/head:/html2uml.el

请在此处提交 WRT 实体错误或缺失的报告:

https://bugs.launchpad.net/s-x-emacs-werkstatt

现在的代码:

(defvar ar-html2uml
'(
("&nbsp;" " ")
("&iexcl;" "¡")
("&cent;" "¢")
("&pound;" "£")
("&curren;" "\x{00A4}")
("&yen;" "¥")
("&brvbar;" "\x{00A6}")
("&sect;" "§")
("&uml;" "\x{00A8}")
("&copy;" "©")
("&ordf;" "ª")
("&laquo;" "«")
("&not;" "¬")
("&shy;" "­")
("&reg;" "®")
("&macr;" "¯")
("&deg;" "°")
("&plusmn;" "±")
("&sup2;" "²")
("&sup3;" "³")
("&acute;" "\x{00B4}")
("&micro;" "µ")
("&para;" "¶")
("&middot;" "·")
("&cedil;" "\x{00B8}")
("&sup1;" "¹")
("&ordm;" "º")
("&raquo;" "»")
("&frac14;" "\x{00BC}")
("&frac12;" "\x{00BD}")
("&frac34;" "\x{00BE}")
("&iquest;" "¿")
("&Agrave;" "À")
("&Aacute;" "Á")
("&Acirc;" "Â")
("&Atilde;" "Ã")
("&Auml;" "Ä")
("&Aring;" "Å")
("&AElig;" "Æ")
("&Ccedil;" "Ç")
("&Egrave;" "È")
("&Eacute;" "É")
("&Ecirc;" "Ê")
("&Euml;" "Ë")
("&Igrave;" "Ì")
("&Iacute;" "Í")
("&Icirc;" "Î")
("&Iuml;" "Ï")
("&ETH;" "Ð")
("&Ntilde;" "Ñ")
("&Ograve;" "Ò")
("&Oacute;" "Ó")
("&Ocirc;" "Ô")
("&Otilde;" "Õ")
("&Ouml;" "Ö")
("&times;" "×")
("&Oslash;" "Ø")
("&Ugrave;" "Ù")
("&Uacute;" "Ú")
("&Ucirc;" "Û")
("&Uuml;" "Ü")
("&Yacute;" "Ý")
("&THORN;" "Þ")
("&szlig;" "ß")
("&agrave;" "à")
("&aacute;" "á")
("&acirc;" "â")
("&atilde;" "ã")
("&auml;" "ä")
("&aring;" "å")
("&aelig;" "æ")
("&ccedil;" "ç")
("&egrave;" "è")
("&eacute;" "é")
("&ecirc;" "ê")
("&euml;" "ë")
("&igrave;" "ì")
("&iacute;" "í")
("&icirc;" "î")
("&iuml;" "ï")
("&eth;" "ð")
("&ntilde;" "ñ")
("&ograve;" "ò")
("&oacute;" "ó")
("&ocirc;" "ô")
("&otilde;" "õ")
("&ouml;" "ö")
("\&Ouml;" "Ö")
("&divide;" "÷")
("&oslash;" "ø")
("&ugrave;" "ù")
("&uacute;" "ú")
("&ucirc;" "û")
("&uuml;" "ü")
("&yacute;" "ý")
("&thorn;" "þ")
("&yuml;" "ÿ")
))

(defun ar-uml2html ()
"Translate chars into html entities"
(interactive "*")
(let ((liste ar-html2uml)
case-fold-search erg)
(dolist (ele liste)
(goto-char (point-min))
(while (search-forward (cadr ele) nil t 1)
(setq erg (car ele))
;; Replacing with code starting from & upcases
;; Emacs bug?
(replace-match "")
(insert erg)))))

(defun ar-html2uml ()
"Translate html entities into text"
(interactive "*")
(let ((liste ar-html2uml))
(dolist (ele liste)
(goto-char (point-min))
(while (search-forward (car ele) nil t 1)
(replace-match "")
(insert (cadr ele))))))

关于html - 是否有用于 html 转义的 Emacs 包?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24085067/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com