all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kenjiro NAKAYAMA <nakayamakenjiro@gmail.com>
To: 16285@debbugs.gnu.org
Subject: bug#16285: 24.3.50; [PATCH] shr: handle <a> tag with blank error.
Date: Sun, 29 Dec 2013 22:08:04 +0900	[thread overview]
Message-ID: <877ganst3f.fsf@dhcp-193-97.nrt.redhat.com> (raw)

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






             reply	other threads:[~2013-12-29 13:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-29 13:08 Kenjiro NAKAYAMA [this message]
2014-01-05  9:48 ` bug#16285: 24.3.50; [PATCH] shr: handle <a> tag with blank error Lars Magne Ingebrigtsen
2014-01-05 11:47   ` Kenjiro NAKAYAMA

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=877ganst3f.fsf@dhcp-193-97.nrt.redhat.com \
    --to=nakayamakenjiro@gmail.com \
    --cc=16285@debbugs.gnu.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.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.