tecosaur / lexic

Mirror of https://git.tecosaur.net/tec/lexic
GNU General Public License v3.0
78 stars 10 forks source link

Generic html renderer? #30

Open sarg opened 5 months ago

sarg commented 5 months ago

I've found lexic-format-online-etym, but it misses support of some tags like <ol>, <li> etc. I've achieved somewhat better results using shr.el:

(defun lexic-format-shr (entry &optional _expected-word)
  (with-temp-buffer
    (insert (plist-get entry :info))
    (let ((tree (libxml-parse-html-region (point-min) (point-max))))
      (erase-buffer)
      (shr-insert-document tree))
    (buffer-string)))