fxbois / web-mode

web template editing mode for emacs
https://web-mode.org
GNU General Public License v3.0
1.64k stars 260 forks source link

A method to extend web-mode-html-entities #1254

Closed kationscramblowitch closed 2 years ago

kationscramblowitch commented 2 years ago

Hello. So, I've recently started implementing a function to decode html-encoded strings. I didn't go too far into it, as I've found a better alternative for my task, but in the process I've been disappointed with how little entities there are in web-mode-html-entities. I've fetched my own collection via this.

(defvar html-entities-data
      (request "https://html.spec.whatwg.org/entities.json"
    :type "GET"
    :parser
    (lambda ()
      (let ((json-object-type 'hash-table))
        (json-read)))
  :success
  (cl-function
   (lambda (&key data &allow-other-keys)
     (set 'html-entities-data data)))))

I know I'm not doing a very good job here, as the request should be in a update-html-entities function, but regardless I've thought that perhaps you'll not mind expanding the list of entities? It's your choice.

fxbois commented 2 years ago

your method is perfect for anyone needing a full coverage. I might accept new entities case by case but will never put all the entities in the source code. Thank you for your contribution