Gnus development mailing list
 help / color / mirror / Atom feed
From: "Adam Sjøgren" <asjo@koldfront.dk>
To: ding@gnus.org
Cc: "Adam Sjøgren" <asjo@koldfront.dk>
Subject: [PATCH] (shr-urlify): show title attribute as well as URL, if provided. (shr-tag-a): pass title to shr-urlify.
Date: Sat,  4 Dec 2010 22:59:41 +0100	[thread overview]
Message-ID: <1291499981-1868-1-git-send-email-asjo@koldfront.dk> (raw)
In-Reply-To: <87ei9xjlfj.fsf@topper.koldfront.dk>

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




  parent reply	other threads:[~2010-12-04 21:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1291499981-1868-1-git-send-email-asjo@koldfront.dk \
    --to=asjo@koldfront.dk \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).