Skip to content

Commit

Permalink
Translate HTML entities in titles
Browse files Browse the repository at this point in the history
Titles may contain HTML entities such as '>'.
See HackerNews/API#20.

* hackernews.el (hackernews--render-item): Pass title through
xml-substitute-special.
  • Loading branch information
basil-conto committed Jan 17, 2021
1 parent c793275 commit 5cddc2d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions hackernews.el
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,8 @@ This is for compatibility with various Emacs versions.
'type type 'font-lock-face face
'id id 'help-echo url 'shr-url url)))

(autoload 'xml-substitute-special "xml")

(defun hackernews--render-item (item)
"Render Hacker News ITEM in current buffer.
The user options `hackernews-score-format',
Expand All @@ -536,6 +538,7 @@ their respective URLs."
(item-url (cdr (assq 'url item)))
(descendants (cdr (assq 'descendants item)))
(comments-url (hackernews--comments-url id)))
(setq title (xml-substitute-special title))
(insert
(format-spec hackernews-item-format
`((?s . ,(propertize (format hackernews-score-format score)
Expand Down

0 comments on commit 5cddc2d

Please sign in to comment.