GNU bug report logs - #16285
24.3.50; [PATCH] shr: handle <a> tag with blank error.

Previous Next

Package: emacs;

Reported by: Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>

Date: Sun, 29 Dec 2013 13:09:02 UTC

Severity: minor

Tags: fixed, patch

Found in version 24.3.50

Fixed in version 24.4

Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 16285 in the body.
You can then email your comments to 16285 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#16285; Package emacs. (Sun, 29 Dec 2013 13:09:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 29 Dec 2013 13:09:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50; [PATCH] shr: handle <a> tag with blank error.
Date: Sun, 29 Dec 2013 22:08:04 +0900
If there is <a> tag with blank, the internal link will fail.
Please reproduce the bug by following HTML.
(Internal link "section1" can not jump to internal link.)
I am not sure following patch is the best fix. Please review and
install it to the official tree if appreciated.

~~~~~~~~~~~~~~~
<html>
<head><title>INTERNAL LINK TEST</title></head>
<body>
<li><a href="#section1">section1</a></li>
<br>
  --- TEST ---
<br>
<a id="section1"></a>link test
</body>
</html>
~~~~~~~~~~~~~~~


Signed-off-by: Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>

          * net/eww.el (shr-descend): Handle <a> tag with blank error.
          
---
 lisp/net/shr.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 1604ebb..20dd31f 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -380,7 +380,11 @@ size, and full-buffer size."
        (shr-generic (cdr dom)))
       (when (and shr-target-id
                 (equal (cdr (assq :id (cdr dom))) shr-target-id))
-       (put-text-property start (1+ start) 'shr-target-id shr-target-id))
+       (let ((result (ignore-errors
+                       (put-text-property start (1+ start) 'shr-target-id shr-target-id)
+                       t)))
+         (unless result
+           (put-text-property start (1- start) 'shr-target-id shr-target-id))))
       ;; If style is set, then this node has set the color.
       (when style
        (shr-colorize-region start (point)
-- 
1.8.3.1





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16285; Package emacs. (Sun, 05 Jan 2014 09:49:02 GMT) Full text and rfc822 format available.

Message #8 received at 16285 <at> debbugs.gnu.org (full text, mbox):

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>
Cc: 16285 <at> debbugs.gnu.org
Subject: Re: bug#16285: 24.3.50; [PATCH] shr: handle <a> tag with blank error.
Date: Sun, 05 Jan 2014 10:48:18 +0100
Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com> writes:

>           * net/eww.el (shr-descend): Handle <a> tag with blank error.

I've now fixed this in a different manner.  Your patch would have bugged
out if the empty anchor was the first element in the buffer, so I just
made it insert a "*" if we have an empty anchor.

The anchoring mechanism should perhaps be implemented in a different
way -- markers instead of text properties, for instance?  That way
zero-length anchors would be no problem.  Rewriting it in that way
should probably wait until after the feature freeze, though.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Magne Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 05 Jan 2014 09:49:04 GMT) Full text and rfc822 format available.

bug marked as fixed in version 24.4, send any further explanations to 16285 <at> debbugs.gnu.org and Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com> Request was from Lars Magne Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 05 Jan 2014 09:49:06 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16285; Package emacs. (Sun, 05 Jan 2014 11:48:01 GMT) Full text and rfc822 format available.

Message #15 received at 16285 <at> debbugs.gnu.org (full text, mbox):

From: Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>
To: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Cc: Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>, 16285 <at> debbugs.gnu.org
Subject: Re: bug#16285: 24.3.50; [PATCH] shr: handle <a> tag with blank error.
Date: Sun, 05 Jan 2014 20:47:12 +0900
> I've now fixed this in a different manner.  Your patch would have bugged
> out if the empty anchor was the first element in the buffer, so I just
> made it insert a "*" if we have an empty anchor.

Thanks!

> The anchoring mechanism should perhaps be implemented in a different
> way -- markers instead of text properties, for instance?  That way

The markers is good idea. Inserting "*" is not bad,
but if it is possible, markers is good.

Kenjiro

larsi <at> gnus.org writes:

> Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com> writes:
>
>>           * net/eww.el (shr-descend): Handle <a> tag with blank error.
>
> I've now fixed this in a different manner.  Your patch would have bugged
> out if the empty anchor was the first element in the buffer, so I just
> made it insert a "*" if we have an empty anchor.
>
> The anchoring mechanism should perhaps be implemented in a different
> way -- markers instead of text properties, for instance?  That way
> zero-length anchors would be no problem.  Rewriting it in that way
> should probably wait until after the feature freeze, though.





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 02 Feb 2014 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 108 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.