emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp ChangeLog xml.el net/newst-backend.el


From: Ulf Jasper
Subject: [Emacs-diffs] emacs/lisp ChangeLog xml.el net/newst-backend.el
Date: Sun, 06 Dec 2009 18:13:24 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Ulf Jasper <u11>        09/12/06 18:13:23

Modified files:
        lisp           : ChangeLog xml.el 
        lisp/net       : newst-backend.el 

Log message:
        Fixed Bug#5008.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.16841&r2=1.16842
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/xml.el?cvsroot=emacs&r1=1.64&r2=1.65
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/net/newst-backend.el?cvsroot=emacs&r1=1.15&r2=1.16

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16841
retrieving revision 1.16842
diff -u -b -r1.16841 -r1.16842
--- ChangeLog   6 Dec 2009 15:34:59 -0000       1.16841
+++ ChangeLog   6 Dec 2009 18:13:19 -0000       1.16842
@@ -1,3 +1,15 @@
+2009-12-06  Ulf Jasper  <address@hidden>
+
+       * xml.el (xml-substitute-numeric-entities): Moved
+       newsticker--decode-numeric-entities in newst-backend.el to
+       xml-substitute-numeric-entities in xml.el. (Bug#5008)
+
+       * net/newst-backend.el (newsticker--parse-generic-feed)
+       (newsticker--parse-generic-items)
+       (newsticker--decode-numeric-entities): Moved
+       newsticker--decode-numeric-entities in newst-backend.el to
+       xml-substitute-numeric-entities in xml.el. (Bug#5008)
+
 2009-12-06  Daniel Colascione  <address@hidden>
 
        * progmodes/js.el (js--js-not): Add null to the list of values.

Index: xml.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/xml.el,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -b -r1.64 -r1.65
--- xml.el      5 Jan 2009 03:19:57 -0000       1.64
+++ xml.el      6 Dec 2009 18:13:23 -0000       1.65
@@ -823,6 +823,25 @@
                              "")
                   (substring string point))))))
 
+(defun xml-substitute-numeric-entities (string)
+  "Substitute SGML numeric entities by their respective utf characters.
+This function replaces numeric entities in the input STRING and
+returns the modified string.  For example \"&#42;\" gets replaced
+by \"*\"."
+  (if (and string (stringp string))
+      (let ((start 0))
+        (while (string-match "&#\\([0-9]+\\);" string start)
+          (condition-case nil
+              (setq string (replace-match
+                            (string (read (substring string
+                                                     (match-beginning 1)
+                                                     (match-end 1))))
+                            nil nil string))
+            (error nil))
+          (setq start (1+ (match-beginning 0))))
+        string)
+    nil))
+
 ;;*******************************************************************
 ;;**
 ;;**  Printing a tree.

Index: net/newst-backend.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/newst-backend.el,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- net/newst-backend.el        4 Dec 2009 19:27:47 -0000       1.15
+++ net/newst-backend.el        6 Dec 2009 18:13:23 -0000       1.16
@@ -7,7 +7,7 @@
 ;; Filename:    newst-backend.el
 ;; URL:         http://www.nongnu.org/newsticker
 ;; Keywords:    News, RSS, Atom
-;; Time-stamp:  "4. Dezember 2009, 20:08:17 (ulf)"
+;; Time-stamp:  "5. Dezember 2009, 13:21:27 (ulf)"
 
 ;; ======================================================================
 
@@ -1408,9 +1408,9 @@
         (position 0)
         (something-was-added nil))
     ;; decode numeric entities
-    (setq title (newsticker--decode-numeric-entities title))
-    (setq desc  (newsticker--decode-numeric-entities desc))
-    (setq link  (newsticker--decode-numeric-entities link))
+    (setq title (xml-substitute-numeric-entities title))
+    (setq desc  (xml-substitute-numeric-entities desc))
+    (setq link  (xml-substitute-numeric-entities link))
     ;; remove whitespace from title, desc, and link
     (setq title (newsticker--remove-whitespace title))
     (setq desc (newsticker--remove-whitespace desc))
@@ -1462,10 +1462,10 @@
             (when (or (> (length title) 0)
                       (> (length desc) 0))
               ;; decode numeric entities
-              (setq title (newsticker--decode-numeric-entities title))
+              (setq title (xml-substitute-numeric-entities title))
               (when desc
-                (setq desc  (newsticker--decode-numeric-entities desc)))
-              (setq link (newsticker--decode-numeric-entities link))
+                (setq desc  (xml-substitute-numeric-entities desc)))
+              (setq link (xml-substitute-numeric-entities link))
               ;; remove whitespace from title, desc, and link
               (setq title (newsticker--remove-whitespace title))
               (setq desc (newsticker--remove-whitespace desc))
@@ -1517,24 +1517,6 @@
 ;; ======================================================================
 ;;; Misc
 ;; ======================================================================
-(defun newsticker--decode-numeric-entities (string)
-  "Decode SGML numeric entities by their respective utf characters.
-This function replaces numeric entities in the input STRING and
-returns the modified string.  For example \"&#42;\" gets replaced
-by \"*\"."
-  (if (and string (stringp string))
-      (let ((start 0))
-        (while (string-match "&#\\([0-9]+\\);" string start)
-          (condition-case nil
-              (setq string (replace-match
-                            (string (read (substring string
-                                                     (match-beginning 1)
-                                                     (match-end 1))))
-                            nil nil string))
-            (error nil))
-          (setq start (1+ (match-beginning 0))))
-        string)
-    nil))
 
 (defun newsticker--remove-whitespace (string)
   "Remove leading and trailing whitespace from STRING."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]