unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16285: 24.3.50; [PATCH] shr: handle <a> tag with blank error.
@ 2013-12-29 13:08 Kenjiro NAKAYAMA
  2014-01-05  9:48 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Kenjiro NAKAYAMA @ 2013-12-29 13:08 UTC (permalink / raw)
  To: 16285

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@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






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

end of thread, other threads:[~2014-01-05 11:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-29 13:08 bug#16285: 24.3.50; [PATCH] shr: handle <a> tag with blank error Kenjiro NAKAYAMA
2014-01-05  9:48 ` Lars Magne Ingebrigtsen
2014-01-05 11:47   ` Kenjiro NAKAYAMA

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).