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.
(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
(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))))