aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGia Thanh Vuong <thanhvg@gmail.com>2019-08-29 15:11:55 -0600
committerGia Thanh Vuong <thanhvg@gmail.com>2019-08-29 15:11:55 -0600
commit20b1b1728bbca07443bb252fff5b3ddc63882e30 (patch)
tree7bf5c687a9f1d69febb2d2ca6072ecac6e18a6ba
parenta085abf870d630f50e2fc0b76ee90695481e8fb4 (diff)
improve cut off link mapper
-rw-r--r--hnreader.el18
1 files changed, 8 insertions, 10 deletions
diff --git a/hnreader.el b/hnreader.el
index d5190e8..ac89419 100644
--- a/hnreader.el
+++ b/hnreader.el
@@ -290,16 +290,14 @@ third one is 80.")
"Map node to node.
IT is an element in the DOM tree. Map to different IT when it is
a, img or pre. Othewise just copy"
- (cond
- ((and (listp it)
- (listp (cdr it))) ;; check for list but not cons
- (cond
- ((and (equal (car it) 'a)
- (not (dom-by-tag it 'img))) ;; bail out if img
- ;; (dom-attr it 'href)
- `(span nil ,(dom-attr it 'href)))
- (t (mapcar #'hnreader--it-to-it it))))
- (t it)))
+ (if (and (listp it)
+ (listp (cdr it))) ;; check for list but not cons
+ (if (and (equal (car it) 'a)
+ (not (dom-by-tag it 'img))) ;; bail out if img
+ ;; (dom-attr it 'href)
+ `(span nil ,(dom-attr it 'href))
+ (mapcar #'hnreader--it-to-it it))
+ it))
(defun hnreader--get-comment (comment-dom)
"Get comment dom from COMMENT-DOM."