aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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