aboutsummaryrefslogtreecommitdiff
path: root/sx.el
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2015-01-15 15:14:12 -0200
committerArtur Malabarba <bruce.connor.am@gmail.com>2015-01-15 15:14:12 -0200
commit872e2bea0220b36a6dc9a4fdd8c08b1fde3cf61f (patch)
tree81bebc9de4cbcaf9a02dc1787b3cd4e3ac176ffa /sx.el
parent679894374c9c537ec4404b80d2828ef123695391 (diff)
Add support for another type of comment on sx--link-to-data
Diffstat (limited to 'sx.el')
-rw-r--r--sx.el21
1 files changed, 13 insertions, 8 deletions
diff --git a/sx.el b/sx.el
index ab39202..785e0c4 100644
--- a/sx.el
+++ b/sx.el
@@ -93,14 +93,19 @@ with a `link' property)."
(let ((result (list (cons 'site_par (sx--site link)))))
;; Try to strip a question or answer ID
(when (cond ;; Comment
- ((string-match ;; From inbox items
- (rx "/posts/comments/"
- ;; Comment ID
- (group-n 1 (+ digit))
- ;; Optional stuff at the end
- (or (and (any "?#") (* any)) "")
- string-end)
- link)
+ ((or ;; If there's a #commentNUMBER_NUMBER at the end, we
+ ;; know it's a comment with that ID.
+ (string-match (rx "#comment" (group-n 1 (+ digit))
+ "_" (+ digit) string-end)
+ link)
+ ;; From inbox items
+ (string-match (rx "/posts/comments/"
+ ;; Comment ID
+ (group-n 1 (+ digit))
+ ;; Optional stuff at the end
+ (or (and (any "?#") (* any)) "")
+ string-end)
+ link))
(push '(type . comment) result))
;; Answer
((or ;; If there's a #NUMBER at the end, we know it's an