[gnus git] branch master updated: m0-7-96-g6ef0ffd =1= Support #anchors
Lars Magne Ingebrigtsen <[email protected]>
| Newsgroups | gmane.emacs.gnus.cvs |
|---|---|
| Message-ID | <[email protected]> |
via 6ef0ffdc7ea83a4a06849bc560e282aca5222c51 (commit)
from b0596d0e30e0e8ec1c36b70921b7cae9003de5e9 (commit)
- Log -----------------------------------------------------------------
commit 6ef0ffdc7ea83a4a06849bc560e282aca5222c51
Author: Lars Magne Ingebrigtsen <[email protected]>
Date: Sun Jun 16 20:14:40 2013 +0200
Support #anchors
* eww.el (eww-render): Go to the correct ID when given URLs ending with
#id.
(shr-descend): Allow marking elements that have certain IDs.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 02da057..004b5a3 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,10 +1,14 @@
2013-06-16 Lars Magne Ingebrigtsen <[email protected]>
+ * eww.el (eww-render): Go to the correct ID when given URLs ending with
+ #id.
+
* shr.el (shr-tag-li): Don't require a new paragraph, since other
browsers don't.
(shr-expand-url): Respect #anchor links.
(shr-parse-base): Chop off the anchor before using.
(shr-descend): Respect display: none.
+ (shr-descend): Allow marking elements that have certain IDs.
* eww.el (eww-tag-textarea): Use `text' instead of `editable-field'.
diff --git a/lisp/eww.el b/lisp/eww.el
index cca59f9..aa23e97 100644
--- a/lisp/eww.el
+++ b/lisp/eww.el
@@ -72,6 +72,9 @@
(when redirect
(setq url redirect)))
(let* ((headers (eww-parse-headers))
+ (shr-target-id
+ (and (string-match "#\\(.*\\)" url)
+ (match-string 1 url)))
(content-type
(mail-header-parse-content-type
(or (cdr (assoc "content-type" headers))
@@ -92,8 +95,14 @@
(eww-display-image))
(t
(eww-display-raw charset)))
+ (cond
+ (point
+ (goto-char point))
+ (shr-target-id
+ (let ((point (next-single-property-change
+ (point-min) 'shr-target-id)))
(when point
- (goto-char point)))
+ (goto-char (1+ point)))))))
(kill-buffer data-buffer))))
(defun eww-parse-headers ()
diff --git a/lisp/shr.el b/lisp/shr.el
index 82c5dd2..53f6e0c 100644
--- a/lisp/shr.el
+++ b/lisp/shr.el
@@ -123,6 +123,7 @@ cid: URL as the argument.")
(defvar shr-base nil)
(defvar shr-ignore-cache nil)
(defvar shr-external-rendering-functions nil)
+(defvar shr-target-id nil)
(defvar shr-map
(let ((map (make-sparse-keymap)))
@@ -321,6 +322,9 @@ size, and full-buffer size."
(if (fboundp function)
(funcall function (cdr dom))
(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))
;; If style is set, then this node has set the color.
(when style
(shr-colorize-region start (point)
-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.
Summary of changes:
lisp/ChangeLog | 4 ++++
lisp/eww.el | 13 +++++++++++--
lisp/shr.el | 4 ++++
3 files changed, 19 insertions(+), 2 deletions(-)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".
The branch, master has been updated
hooks/post-receive
--
Gnus Project