diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-01-07 22:14:51 -0200 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-01-07 22:16:38 -0200 |
commit | 9344809abe4b6b1b73038bd02b466900f1340bc3 (patch) | |
tree | 3e8da62b2812160482fb57d2e423a7aaa896de10 | |
parent | b5cc49f539aab7a1685bbcbdb089916ecfd5476f (diff) |
Enable raw links. Fix #214
-rw-r--r-- | sx-question-print.el | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sx-question-print.el b/sx-question-print.el index 02e14c8..d74a162 100644 --- a/sx-question-print.el +++ b/sx-question-print.el @@ -331,9 +331,13 @@ E.g.: (defconst sx-question-mode--link-regexp ;; Done at compile time. - (rx "[" (group-n 1 (1+ (not (any "]")))) "]" - (or (and "(" (group-n 2 (1+ (not (any ")")))) ")") - (and "[" (group-n 3 (1+ (not (any "]")))) "]"))) + (rx (or (and "[" (group-n 1 (1+ (not (any "]")))) "]" + (or (and "(" (group-n 2 (1+ (not (any ")")))) ")") + (and "[" (group-n 3 (1+ (not (any "]")))) "]"))) + (group-n 4 (and (or (and "http" (opt "s") "://") "") + (+ (any alnum "_%")) + "." + (+ (any alnum "/._%&#?=;")))))) "Regexp matching markdown links.") (defun sx-question-mode--fill-and-fontify (text) @@ -377,6 +381,7 @@ E.g.: (while (search-forward-regexp sx-question-mode--link-regexp nil t) (let* ((text (match-string-no-properties 1)) (url (or (match-string-no-properties 2) + (match-string-no-properties 4) (sx-question-mode-find-reference (match-string-no-properties 3) text))) @@ -384,7 +389,7 @@ E.g.: (when (stringp url) (replace-match "") (sx-question-mode--insert-link - (if sx-question-mode-pretty-links text full-text) + (or (if sx-question-mode-pretty-links text full-text) url) url)))))) (defun sx-question-mode--insert-link (text url) |