mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-10 13:40:36 -08:00
Fix problem in HTML with bracketed characters
* lisp/textmodes/sgml-mode.el (sgml-tag-syntax-table): Use bracket syntax for all Unicode bracket characters (bug#43941).
This commit is contained in:
parent
31d40cab78
commit
8f2f91f7ac
2 changed files with 40 additions and 2 deletions
|
|
@ -190,8 +190,19 @@ This takes effect when first loading the `sgml-mode' library.")
|
|||
"Syntax table used in SGML mode. See also `sgml-specials'.")
|
||||
|
||||
(defconst sgml-tag-syntax-table
|
||||
(let ((table (sgml-make-syntax-table sgml-specials)))
|
||||
(dolist (char '(?\( ?\) ?\{ ?\} ?\[ ?\] ?$ ?% ?& ?* ?+ ?/))
|
||||
(let ((table (sgml-make-syntax-table sgml-specials))
|
||||
brackets)
|
||||
(map-char-table
|
||||
(lambda (key value)
|
||||
(setq brackets (cons (list
|
||||
(if (consp key)
|
||||
(list (car key) (cdr key))
|
||||
key)
|
||||
value)
|
||||
brackets)))
|
||||
(unicode-property-table-internal 'paired-bracket))
|
||||
(setq brackets (delete-dups (flatten-tree brackets)))
|
||||
(dolist (char (append brackets (list ?$ ?% ?& ?* ?+ ?/)))
|
||||
(modify-syntax-entry char "." table))
|
||||
(unless (memq ?' sgml-specials)
|
||||
;; Avoid that skipping a tag backwards skips any "'" prefixing it.
|
||||
|
|
|
|||
|
|
@ -204,5 +204,32 @@ The point is set to the beginning of the buffer."
|
|||
(should (= 1 (- (car (syntax-ppss (1- (point-max))))
|
||||
(car (syntax-ppss (point-max))))))))
|
||||
|
||||
(ert-deftest sgml-test-brackets ()
|
||||
"Test fontification of apostrophe preceded by paired-bracket character."
|
||||
(let (brackets results)
|
||||
(map-char-table
|
||||
(lambda (key value)
|
||||
(setq brackets (cons (list
|
||||
(if (consp key)
|
||||
(list (car key) (cdr key))
|
||||
key)
|
||||
value)
|
||||
brackets)))
|
||||
(unicode-property-table-internal 'paired-bracket))
|
||||
(setq brackets (delete-dups (flatten-tree brackets)))
|
||||
(setq brackets (append brackets (list ?$ ?% ?& ?* ?+ ?/)))
|
||||
(with-temp-buffer
|
||||
(while brackets
|
||||
(let ((char (string (pop brackets))))
|
||||
(insert (concat "<p>" char "'s</p>\n"))))
|
||||
(html-mode)
|
||||
(font-lock-ensure (point-min) (point-max))
|
||||
(goto-char (point-min))
|
||||
(while (not (eobp))
|
||||
(goto-char (next-single-char-property-change (point) 'face))
|
||||
(let ((val (get-text-property (point) 'face)))
|
||||
(when val
|
||||
(should-not (eq val 'font-lock-string-face))))))))
|
||||
|
||||
(provide 'sgml-mode-tests)
|
||||
;;; sgml-mode-tests.el ends here
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue