Gnus development mailing list
 help / color / mirror / Atom feed
* shr - support for title attribute on <a> elements?
@ 2010-12-04 21:08 Adam Sjøgren
  2010-12-04 21:44 ` [PATCH] (shr-urlify): show title attribute as well as URL, if provided. (shr-tag-a): pass title to shr-urlify Adam Sjøgren
  2010-12-04 21:59 ` Adam Sjøgren
  0 siblings, 2 replies; 8+ messages in thread
From: Adam Sjøgren @ 2010-12-04 21:08 UTC (permalink / raw)
  To: ding

I know that shr handles the title attribute on <img> elements (useful in
the gwene.com.xkcd group), but does shr handle the title attribute on
<a> elements?

I often use the title attribute to indicate the name of the article/page
that a link points to, when the text of the link doesn't do so directly.

I would expect the content of the title attribute to be shown in the
little "mouse over" text that pops up when I place the mouse on a link
and wait a little, but instead the URL of the link is always displayed.

That is also interesting information, of course...

Maybe, if there is a title, show "TITLE (URL)" on the little pop up
text, or perhaps show the URL in the minibuffer and the title in the pop
up?


  Best regards,

    Adam

-- 
 "We get our thursdays from a banana."                        Adam Sjøgren
                                                         asjo@koldfront.dk




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

* [PATCH] (shr-urlify): show title attribute as well as URL, if provided. (shr-tag-a): pass title to shr-urlify.
  2010-12-04 21:08 shr - support for title attribute on <a> elements? Adam Sjøgren
@ 2010-12-04 21:44 ` Adam Sjøgren
  2010-12-04 21:59 ` Adam Sjøgren
  1 sibling, 0 replies; 8+ messages in thread
From: Adam Sjøgren @ 2010-12-04 21:44 UTC (permalink / raw)
  To: ding; +Cc: Adam Sjøgren

Try to put a patch where my mouth is.

---
 lisp/shr.el |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/lisp/shr.el b/lisp/shr.el
index 69973fb..e8522a7 100644
--- a/lisp/shr.el
+++ b/lisp/shr.el
@@ -506,13 +506,14 @@ START, and END."
 
 (autoload 'widget-convert-button "wid-edit")
 
-(defun shr-urlify (start url)
-  (widget-convert-button
-   'url-link start (point)
-   :help-echo url
-   :keymap shr-map
-   url)
-  (put-text-property start (point) 'shr-url url))
+(defun shr-urlify (start url &optional title)
+  (let ((help-text (if title (format "%s (%s)" title url) url)))
+    (widget-convert-button
+     'url-link start (point)
+     :help-echo help-text
+     :keymap shr-map
+     url)
+    (put-text-property start (point) 'shr-url url)))
 
 (defun shr-encode-url (url)
   "Encode URL."
@@ -631,10 +632,11 @@ text will be inserted at start."
 
 (defun shr-tag-a (cont)
   (let ((url (cdr (assq :href cont)))
+        (title (cdr (assq :title cont)))
 	(start (point))
 	shr-start)
     (shr-generic cont)
-    (shr-urlify (or shr-start start) url)))
+    (shr-urlify (or shr-start start) url title)))
 
 (defun shr-tag-object (cont)
   (let ((start (point))
-- 
1.7.2.3




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

* [PATCH] (shr-urlify): show title attribute as well as URL, if provided. (shr-tag-a): pass title to shr-urlify.
  2010-12-04 21:08 shr - support for title attribute on <a> elements? Adam Sjøgren
  2010-12-04 21:44 ` [PATCH] (shr-urlify): show title attribute as well as URL, if provided. (shr-tag-a): pass title to shr-urlify Adam Sjøgren
@ 2010-12-04 21:59 ` Adam Sjøgren
  2010-12-04 22:25   ` Lars Magne Ingebrigtsen
  1 sibling, 1 reply; 8+ messages in thread
From: Adam Sjøgren @ 2010-12-04 21:59 UTC (permalink / raw)
  To: ding; +Cc: Adam Sjøgren

Make the mouse over pop up text of links show the title as well as the URL,
if present.

Signed-off-by: Adam Sjøgren <asjo@koldfront.dk>
---

Let me try again, this time with the email comment in the right place (I hope),
and skipping the extra variable that was just too much indentation change for
very little clarity.

Please disregard my previous attempt: <1291499077-1619-1-git-send-email-asjo@koldfront.dk>


 lisp/shr.el |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/lisp/shr.el b/lisp/shr.el
index 69973fb..5d24479 100644
--- a/lisp/shr.el
+++ b/lisp/shr.el
@@ -506,10 +506,10 @@ START, and END."
 
 (autoload 'widget-convert-button "wid-edit")
 
-(defun shr-urlify (start url)
+(defun shr-urlify (start url &optional title)
   (widget-convert-button
    'url-link start (point)
-   :help-echo url
+   :help-echo (if title (format "%s (%s)" title url) url)
    :keymap shr-map
    url)
   (put-text-property start (point) 'shr-url url))
@@ -631,10 +631,11 @@ text will be inserted at start."
 
 (defun shr-tag-a (cont)
   (let ((url (cdr (assq :href cont)))
+        (title (cdr (assq :title cont)))
 	(start (point))
 	shr-start)
     (shr-generic cont)
-    (shr-urlify (or shr-start start) url)))
+    (shr-urlify (or shr-start start) url title)))
 
 (defun shr-tag-object (cont)
   (let ((start (point))
-- 
1.7.2.3




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

* Re: [PATCH] (shr-urlify): show title attribute as well as URL, if provided. (shr-tag-a): pass title to shr-urlify.
  2010-12-04 21:59 ` Adam Sjøgren
@ 2010-12-04 22:25   ` Lars Magne Ingebrigtsen
  2010-12-04 22:55     ` Adam Sjøgren
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-12-04 22:25 UTC (permalink / raw)
  To: ding

Adam Sjøgren <asjo@koldfront.dk> writes:

> Let me try again, this time with the email comment in the right place
> (I hope), and skipping the extra variable that was just too much
> indentation change for very little clarity.

Thanks; applied.  (But I changed the tooltip to show the URL before the
title to avoid the situation where spammers put a misleading long URL
into the title, pushing the real URL off the screen.)

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




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

* Re: (shr-urlify): show title attribute as well as URL, if provided. (shr-tag-a): pass title to shr-urlify.
  2010-12-04 22:25   ` Lars Magne Ingebrigtsen
@ 2010-12-04 22:55     ` Adam Sjøgren
  2010-12-04 23:00       ` www.gnus.org (Was: (shr-urlify): show title attribute as well as URL, if provided. (shr-tag-a): pass title to shr-urlify.) Adam Sjøgren
  2010-12-04 23:32       ` (shr-urlify): show title attribute as well as URL, if provided. (shr-tag-a): pass title to shr-urlify Lars Magne Ingebrigtsen
  0 siblings, 2 replies; 8+ messages in thread
From: Adam Sjøgren @ 2010-12-04 22:55 UTC (permalink / raw)
  To: ding

On Sat, 04 Dec 2010 23:25:58 +0100, Lars wrote:

> Thanks; applied.  (But I changed the tooltip to show the URL before the
> title to avoid the situation where spammers put a misleading long URL
> into the title, pushing the real URL off the screen.)

Cool! (Ok; super.)

Just to annoy you: there is a slight charset snafu on http://gnus.org/ -
the page is in latin1, but my name is utf-8 encoded, and look funny.


  Best regards,

    Adam

-- 
 "We get our thursdays from a banana."                        Adam Sjøgren
                                                         asjo@koldfront.dk




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

* www.gnus.org (Was: (shr-urlify): show title attribute as well as URL, if provided. (shr-tag-a): pass title to shr-urlify.)
  2010-12-04 22:55     ` Adam Sjøgren
@ 2010-12-04 23:00       ` Adam Sjøgren
  2010-12-04 23:33         ` www.gnus.org Lars Magne Ingebrigtsen
  2010-12-04 23:32       ` (shr-urlify): show title attribute as well as URL, if provided. (shr-tag-a): pass title to shr-urlify Lars Magne Ingebrigtsen
  1 sibling, 1 reply; 8+ messages in thread
From: Adam Sjøgren @ 2010-12-04 23:00 UTC (permalink / raw)
  To: ding

On Sat, 04 Dec 2010 23:55:42 +0100, Adam wrote:

> Just to annoy you: there is a slight charset snafu on http://gnus.org/ -
> the page is in latin1, but my name is utf-8 encoded, and look funny.

While I am at it: perhaps the links to the threads in the Recent Gnus
Threads section should have a target attribute pointing as, say, _top?

(Try clicking one - the gmane interface opens inside the iframe...)


  Best regards,

    Adam

-- 
 "We get our thursdays from a banana."                        Adam Sjøgren
                                                         asjo@koldfront.dk




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

* Re: (shr-urlify): show title attribute as well as URL, if provided. (shr-tag-a): pass title to shr-urlify.
  2010-12-04 22:55     ` Adam Sjøgren
  2010-12-04 23:00       ` www.gnus.org (Was: (shr-urlify): show title attribute as well as URL, if provided. (shr-tag-a): pass title to shr-urlify.) Adam Sjøgren
@ 2010-12-04 23:32       ` Lars Magne Ingebrigtsen
  1 sibling, 0 replies; 8+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-12-04 23:32 UTC (permalink / raw)
  To: ding

asjo@koldfront.dk (Adam Sjøgren) writes:

> Just to annoy you: there is a slight charset snafu on http://gnus.org/ -
> the page is in latin1, but my name is utf-8 encoded, and look funny.

Ok; fixed.

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




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

* Re: www.gnus.org
  2010-12-04 23:00       ` www.gnus.org (Was: (shr-urlify): show title attribute as well as URL, if provided. (shr-tag-a): pass title to shr-urlify.) Adam Sjøgren
@ 2010-12-04 23:33         ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 8+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-12-04 23:33 UTC (permalink / raw)
  To: ding

asjo@koldfront.dk (Adam Sjøgren) writes:

> While I am at it: perhaps the links to the threads in the Recent Gnus
> Threads section should have a target attribute pointing as, say, _top?

Yup.  Fixed.

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




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

end of thread, other threads:[~2010-12-04 23:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-04 21:08 shr - support for title attribute on <a> elements? Adam Sjøgren
2010-12-04 21:44 ` [PATCH] (shr-urlify): show title attribute as well as URL, if provided. (shr-tag-a): pass title to shr-urlify Adam Sjøgren
2010-12-04 21:59 ` Adam Sjøgren
2010-12-04 22:25   ` Lars Magne Ingebrigtsen
2010-12-04 22:55     ` Adam Sjøgren
2010-12-04 23:00       ` www.gnus.org (Was: (shr-urlify): show title attribute as well as URL, if provided. (shr-tag-a): pass title to shr-urlify.) Adam Sjøgren
2010-12-04 23:33         ` www.gnus.org Lars Magne Ingebrigtsen
2010-12-04 23:32       ` (shr-urlify): show title attribute as well as URL, if provided. (shr-tag-a): pass title to shr-urlify Lars Magne Ingebrigtsen

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).