aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/net
diff options
context:
space:
mode:
authorUlf Jasper2009-12-06 18:13:19 +0000
committerUlf Jasper2009-12-06 18:13:19 +0000
commit571855b6310390faa67d00bef0b0bc7aa118348f (patch)
tree4d21b17a290bb167d03fdd829927730e5e078053 /lisp/net
parentb857059c0aaae85bff9c897b97dcba532e93e40a (diff)
downloademacs-571855b6310390faa67d00bef0b0bc7aa118348f.tar.gz
emacs-571855b6310390faa67d00bef0b0bc7aa118348f.zip
Fixed Bug#5008.
Diffstat (limited to 'lisp/net')
-rw-r--r--lisp/net/newst-backend.el32
1 files changed, 7 insertions, 25 deletions
diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el
index 24c4c89fb84..ae028516fb8 100644
--- a/lisp/net/newst-backend.el
+++ b/lisp/net/newst-backend.el
@@ -7,7 +7,7 @@
7;; Filename: newst-backend.el 7;; Filename: newst-backend.el
8;; URL: http://www.nongnu.org/newsticker 8;; URL: http://www.nongnu.org/newsticker
9;; Keywords: News, RSS, Atom 9;; Keywords: News, RSS, Atom
10;; Time-stamp: "4. Dezember 2009, 20:08:17 (ulf)" 10;; Time-stamp: "5. Dezember 2009, 13:21:27 (ulf)"
11 11
12;; ====================================================================== 12;; ======================================================================
13 13
@@ -1408,9 +1408,9 @@ description, link, and extra elements resp."
1408 (position 0) 1408 (position 0)
1409 (something-was-added nil)) 1409 (something-was-added nil))
1410 ;; decode numeric entities 1410 ;; decode numeric entities
1411 (setq title (newsticker--decode-numeric-entities title)) 1411 (setq title (xml-substitute-numeric-entities title))
1412 (setq desc (newsticker--decode-numeric-entities desc)) 1412 (setq desc (xml-substitute-numeric-entities desc))
1413 (setq link (newsticker--decode-numeric-entities link)) 1413 (setq link (xml-substitute-numeric-entities link))
1414 ;; remove whitespace from title, desc, and link 1414 ;; remove whitespace from title, desc, and link
1415 (setq title (newsticker--remove-whitespace title)) 1415 (setq title (newsticker--remove-whitespace title))
1416 (setq desc (newsticker--remove-whitespace desc)) 1416 (setq desc (newsticker--remove-whitespace desc))
@@ -1462,10 +1462,10 @@ argument, which is one of the items in ITEMLIST."
1462 (when (or (> (length title) 0) 1462 (when (or (> (length title) 0)
1463 (> (length desc) 0)) 1463 (> (length desc) 0))
1464 ;; decode numeric entities 1464 ;; decode numeric entities
1465 (setq title (newsticker--decode-numeric-entities title)) 1465 (setq title (xml-substitute-numeric-entities title))
1466 (when desc 1466 (when desc
1467 (setq desc (newsticker--decode-numeric-entities desc))) 1467 (setq desc (xml-substitute-numeric-entities desc)))
1468 (setq link (newsticker--decode-numeric-entities link)) 1468 (setq link (xml-substitute-numeric-entities link))
1469 ;; remove whitespace from title, desc, and link 1469 ;; remove whitespace from title, desc, and link
1470 (setq title (newsticker--remove-whitespace title)) 1470 (setq title (newsticker--remove-whitespace title))
1471 (setq desc (newsticker--remove-whitespace desc)) 1471 (setq desc (newsticker--remove-whitespace desc))
@@ -1517,24 +1517,6 @@ argument, which is one of the items in ITEMLIST."
1517;; ====================================================================== 1517;; ======================================================================
1518;;; Misc 1518;;; Misc
1519;; ====================================================================== 1519;; ======================================================================
1520(defun newsticker--decode-numeric-entities (string)
1521 "Decode SGML numeric entities by their respective utf characters.
1522This function replaces numeric entities in the input STRING and
1523returns the modified string. For example \"*\" gets replaced
1524by \"*\"."
1525 (if (and string (stringp string))
1526 (let ((start 0))
1527 (while (string-match "&#\\([0-9]+\\);" string start)
1528 (condition-case nil
1529 (setq string (replace-match
1530 (string (read (substring string
1531 (match-beginning 1)
1532 (match-end 1))))
1533 nil nil string))
1534 (error nil))
1535 (setq start (1+ (match-beginning 0))))
1536 string)
1537 nil))
1538 1520
1539(defun newsticker--remove-whitespace (string) 1521(defun newsticker--remove-whitespace (string)
1540 "Remove leading and trailing whitespace from STRING." 1522 "Remove leading and trailing whitespace from STRING."