Gnus development mailing list
 help / color / mirror / Atom feed
* HTML symbol in slashdot group name
@ 1999-12-06 19:17 Emerick Rogul
  1999-12-12 20:18 ` HTML symbol in slashdot group name [patch] Eric Marsden
  0 siblings, 1 reply; 3+ messages in thread
From: Emerick Rogul @ 1999-12-06 19:17 UTC (permalink / raw)


I saw the following group name in my list of slashdot groups this
morning; this is on a text-based system using gnus v5.8.2.  Is it
possible for gnus to massage the ampersand specifier into an actual
ampersand (or perhaps this just looks right on a windowed system?)

"AT&T to Share Cable Internet with MindSpring"


-Emerick
-- 
-------------------------------------------------------------------------
Emerick Rogul        /\/  "...i saw your girlfriend and she's eating her
emerick@cs.bu.edu    /\/   fingers like they're just another meal."
------------------------------------------------- 'summer babe', pavement


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: HTML symbol in slashdot group name [patch]
  1999-12-06 19:17 HTML symbol in slashdot group name Emerick Rogul
@ 1999-12-12 20:18 ` Eric Marsden
  1999-12-13 15:51   ` Shenghuo ZHU
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Marsden @ 1999-12-12 20:18 UTC (permalink / raw)


>>>>> "er" == Emerick Rogul <emerick@cs.bu.edu> writes:

  er> I saw the following group name in my list of slashdot groups
  er> this morning; this is on a text-based system using gnus v5.8.2.
  er> Is it possible for gnus to massage the ampersand specifier into
  er> an actual ampersand (or perhaps this just looks right on a
  er> windowed system?)

the following patch implements entity decoding for slashdot headers
(in message bodies w3 looks after it).  Larsi, I don't know if this is
the best way of doing things: perhaps decoding should be done only
before display?  Also, `nnslashdot-decode-entities' might be more
appropriate as an extension to `nnweb-decode-entities'.


--- nnslashdot.el.orig	Sun Dec 12 20:40:50 1999
+++ nnslashdot.el	Sun Dec 12 20:50:11 1999
@@ -108,7 +108,7 @@
 	  (goto-char (point-min))
 	  (search-forward "Posted by ")
 	  (when (looking-at "<a[^>]+>\\([^<]+\\)")
-	    (setq from (match-string 1)))
+	    (setq from (nnslashdot-decode-entities (match-string 1))))
 	  (search-forward " on ")
 	  (setq date (nnslashdot-date-to-date
 		      (buffer-substring (point) (1- (search-forward "<")))))
@@ -146,13 +146,14 @@
 		  score (match-string 3))
 	    (when (string-match "^Re: *" subject)
 	      (setq subject (concat "Re: " (substring subject (match-end 0)))))
+            (setq subject (nnslashdot-decode-entities subject))
 	    (forward-line 1)
 	    (if (looking-at
 		 "by <a[^>]+>\\([^<]+\\)</a>[ \t\n]*.*(\\([^)]+\\))")
-		(setq from (concat (match-string 1)
+		(setq from (concat (nnslashdot-decode-entities (match-string 1))
 				   " <" (match-string 2) ">"))
 	      (looking-at "by \\(.+\\) on ")
-	      (setq from (match-string 1)))
+	      (setq from (nnslashdot-decode-entities (match-string 1))))
 	    (goto-char (- (match-end 0) 5))
 	    (search-forward " on ")
 	    (setq date
@@ -206,7 +207,7 @@
 	(goto-char (point-min))
 	(search-forward "Posted by ")
 	(when (looking-at "<a[^>]+>\\([^<]+\\)")
-	  (setq from (match-string 1)))
+	  (setq from (nnslashdot-decode-entities (match-string 1))))
 	(search-forward " on ")
 	(setq date (nnslashdot-date-to-date
 		    (buffer-substring (point) (1- (search-forward "<")))))
@@ -238,12 +239,14 @@
 		score (match-string 3))
 	  (when (string-match "^Re: *" subject)
 	    (setq subject (concat "Re: " (substring subject (match-end 0)))))
+          (setq subject (nnslashdot-decode-entities subject))
 	  (forward-line 1)
 	  (if (looking-at
 	       "by <a[^>]+>\\([^<]+\\)</a>[ \t\n]*.*(\\([^)]+\\))")
-	      (setq from (concat (match-string 1) " <" (match-string 2) ">"))
+	      (setq from (concat (nnslashdot-decode-entities (match-string 1))
+                                 " <" (match-string 2) ">"))
 	    (looking-at "by \\(.+\\) on ")
-	    (setq from (match-string 1)))
+	    (setq from (nnslashdot-decode-entities (match-string 1))))
 	  (goto-char (- (match-end 0) 5))
 	  (search-forward " on ")
 	  (setq date
@@ -372,7 +375,7 @@
 	      (narrow-to-region (point) (search-forward "</story>"))
 	      (goto-char (point-min))
 	      (re-search-forward "<title>\\([^<]+\\)</title>")
-	      (setq description (match-string 1))
+	      (setq description (nnslashdot-decode-entities (match-string 1)))
 	      (re-search-forward "<url>\\([^<]+\\)</url>")
 	      (setq sid (match-string 1))
 	      (string-match "/\\([0-9/]+\\).shtml" sid)
@@ -394,7 +397,7 @@
 		(while (re-search-forward
 			"article.pl\\?sid=\\([^&]+\\).*<b>\\([^<]+\\)</b>" nil t)
 		  (setq sid (match-string 1)
-			description (match-string 2))
+			description (nnslashdot-decode-entities (match-string 2)))
 		  (forward-line 1)
 		  (when (re-search-forward "<b>\\([0-9]+\\)</b>" nil t)
 		    (setq articles (string-to-number (match-string 1))))
@@ -518,6 +521,16 @@
     (dolist (elem nnslashdot-groups)
       (insert (prin1-to-string (car elem))
 	      " " (number-to-string (cadr elem)) " 1 y\n"))))
+
+(defun nnslashdot-decode-entities (str)
+  "Return STR with HTML entities decoded."
+  (let ((buf (get-buffer-create " *slashdot-decode*")))
+    (save-excursion
+      (set-buffer buf)
+      (erase-buffer)
+      (insert str)
+      (nnweb-decode-entities)
+      (buffer-string))))
 
 (defun nnslashdot-lose (why)
   (error "Slashdot HTML has changed; please get a new version of nnslashdot"))


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: HTML symbol in slashdot group name [patch]
  1999-12-12 20:18 ` HTML symbol in slashdot group name [patch] Eric Marsden
@ 1999-12-13 15:51   ` Shenghuo ZHU
  0 siblings, 0 replies; 3+ messages in thread
From: Shenghuo ZHU @ 1999-12-13 15:51 UTC (permalink / raw)


>>>>> "ecm" == Eric Marsden <emarsden@mail.dotcom.fr> writes:

>>>>> "er" == Emerick Rogul <emerick@cs.bu.edu> writes:
er> I saw the following group name in my list of slashdot groups
er> this morning; this is on a text-based system using gnus v5.8.2.
er> Is it possible for gnus to massage the ampersand specifier into
er> an actual ampersand (or perhaps this just looks right on a
er> windowed system?)

ecm> the following patch implements entity decoding for slashdot
ecm> headers (in message bodies w3 looks after it).  Larsi, I don't
ecm> know if this is the best way of doing things: perhaps decoding
ecm> should be done only before display?  Also,
ecm> `nnslashdot-decode-entities' might be more appropriate as an
ecm> extension to `nnweb-decode-entities'.

Applied.

[...]


-- 
Shenghuo


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-12-13 15:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-06 19:17 HTML symbol in slashdot group name Emerick Rogul
1999-12-12 20:18 ` HTML symbol in slashdot group name [patch] Eric Marsden
1999-12-13 15:51   ` Shenghuo ZHU

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).