■掲示板に戻る■ 全部 1- 101- 201- 301- 401- 501- 601- 701- 801- 901- 1001- 最新50
レス数が1000を超えています。残念ながら全部は表示しません。 |
Navi2ch for Emacs (part 7)
- 257 :66 :02/09/26 18:49
- ハートを表示しよう第2弾です。
(defun navi2ch-entity-ucs-to-str (entity)
(save-match-data
(let (c code)
(when (string-match "?\\([0-9]+\\);?" entity)
(setq code (string-to-int (match-string 1 entity)))
(cond
((fboundp 'ucs-to-char)
(setq c (ucs-to-char code)))
((and (fboundp 'unicode-to-char) navi2ch-on-xemacs)
(setq c (unicode-to-char code)))
((and (fboundp 'decode-char) navi2ch-on-emacs21)
(setq c (decode-char 'ucs code)))))
(if (or (not (integerp c)) (< c 0))
(setq c ?〓))
(char-to-string c))))
(defun navi2ch-article-replace-entity ()
(save-excursion
(goto-char (point-min))
(while (re-search-forward "?[0-9]+;?" nil t)
(replace-match (navi2ch-entity-ucs-to-str (match-string 0))))))
(add-hook 'navi2ch-article-arrange-message-hook
'navi2ch-article-replace-entity)
本体に組み込むなら、
navi2ch-replace-html-tag-regexp-alistで
("?[0-9]+;?" . navi2ch-entity-ucs-to-str)
と指定できるようにnavi2ch-replace-html-tag-to-stringを
改造するのがいいのかな。
掲示板に戻る 全部 前100 次100 最新50read.cgi ver5.26+ (01/10/21-)