From 872e2bea0220b36a6dc9a4fdd8c08b1fde3cf61f Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 15 Jan 2015 15:14:12 -0200 Subject: Add support for another type of comment on sx--link-to-data --- sx.el | 21 +++++++++++++-------- 1 file 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 -- cgit v1.2.3