aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanh Vuong <thanhvg@gmail.com>2019-08-25 00:27:03 -0600
committerThanh Vuong <thanhvg@gmail.com>2019-08-25 00:27:03 -0600
commitcdfe13e7ac022dd112e007c42a0e49636935eee9 (patch)
treeb0b0bb7f2a3933b8fd3afd307afebf69835d99bb
parente2c0f0e2de6bf480c7ad3a617fc0cddbe6852bcc (diff)
improve parse /past route
-rw-r--r--hnreader.el17
1 files changed, 13 insertions, 4 deletions
diff --git a/hnreader.el b/hnreader.el
index a2fd302..65b6d49 100644
--- a/hnreader.el
+++ b/hnreader.el
@@ -90,10 +90,19 @@ third one is 80.")
(defun hnreader--past-time-top-links (node-list)
"Get date, month and year links from NODE-LIST."
- (seq-reduce (lambda (acc it)
- (concat acc (hnreader--get-time-top-link it) " "))
- node-list
- "Go back to a "))
+ (if (= 3 (length node-list))
+ (concat (seq-reduce (lambda (acc it)
+ (concat acc (hnreader--get-time-top-link it) " "))
+ node-list
+ "- Go back to a "))
+ (concat (seq-reduce (lambda (acc it)
+ (concat acc (hnreader--get-time-top-link it) " "))
+ (seq-take node-list 3)
+ "- Go back to a ")
+ (seq-reduce (lambda (acc it)
+ (concat acc (hnreader--get-time-top-link it) " "))
+ (seq-drop node-list 3)
+ "- Go forward to a "))))
(defun hnreader--get-route-top-info (dom)
"Get top info of route like title, date of hn routes such as front, past from DOM."