Function: eww--walk-readability
eww--walk-readability is a byte-compiled function defined in
eww.el.gz.
Signature
(eww--walk-readability NODE CALLBACK &optional NOSCORE)
Documentation
Walk through all children of NODE to score readability.
After scoring, call CALLBACK with the node and score. If NOSCORE is non-nil, don't actually compute a score; just call the callback.
Source Code
;; Defined in /usr/src/emacs/lisp/net/eww.el.gz
(defun eww--walk-readability (node callback &optional noscore)
"Walk through all children of NODE to score readability.
After scoring, call CALLBACK with the node and score. If NOSCORE is
non-nil, don't actually compute a score; just call the callback."
(let ((score nil))
(unless noscore
(cond
((stringp node)
(setq score (eww--string-count-words node)
noscore t))
((memq (dom-tag node) '(head comment script style template))
(setq score -2
noscore t))
((eq (dom-tag node) 'meta)
(setq score -1
noscore t))
((eq (dom-tag node) 'img)
(setq score 2
noscore t))
((eq (dom-tag node) 'a)
(setq score (- (eww--dom-count-words node))
noscore t))
(t
(setq score -1))))
(when (consp node)
(dolist (elem (dom-children node))
(let ((subscore (eww--walk-readability elem callback noscore)))
(when (and (not noscore) subscore)
(incf score subscore)))))
(funcall callback node score)
score))