Commit 1c4b1e61 authored by Lars Magne Ingebrigtsen's avatar Lars Magne Ingebrigtsen
Browse files

* net/shr.el (shr-tag-a): Support zero-length <a name="foo"> elements.

parent 11bade0a
2013-12-16 Lars Magne Ingebrigtsen <larsi@gnus.org>
* net/shr.el (shr-tag-a): Support zero-length <a name="foo"> elements.
* net/eww.el (eww-display-html): If we can't find the anchor we're
looking for, then go to point-min.
......
......@@ -269,11 +269,11 @@ word(s) will be searched for via `eww-search-prefix'."
(point
(goto-char point))
(shr-target-id
(goto-char (point-min))
(let ((point (next-single-property-change
(point-min) 'shr-target-id)))
(goto-char (if point
(1+ point)
(point-min)))))
(when point
(goto-char point))))
(t
(goto-char (point-min)))))
(setq eww-current-url url
......
......@@ -1078,6 +1078,14 @@ ones, in case fg and bg are nil."
(start (point))
shr-start)
(shr-generic cont)
(when (and shr-target-id
(equal (cdr (assq :name (cdr dom))) shr-target-id))
;; We have a zero-length <a name="foo"> element, so just
;; insert... something.
(when (= start (point))
(shr-ensure-newline)
(insert " "))
(put-text-property start (1+ start) 'shr-target-id shr-target-id))
(when (and url
(not shr-inhibit-decoration))
(shr-urlify (or shr-start start) (shr-expand-url url) title))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment