From a11d7997aa61f6e5bcb5fb6974c25b914b3bd001 Mon Sep 17 00:00:00 2001 From: Sean Allred Date: Wed, 7 Jan 2015 00:58:56 -0500 Subject: Use `data' branch for bot data --- bot/sx-bot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/sx-bot.sh b/bot/sx-bot.sh index 6a5df17..22c7284 100755 --- a/bot/sx-bot.sh +++ b/bot/sx-bot.sh @@ -1,6 +1,6 @@ #!/usr/bin/bash -DESTINATION_BRANCH=gh-pages +DESTINATION_BRANCH=data function notify-done { local title -- cgit v1.2.3 From 95e9f6069ba328249c0e8ac86efdc888437ac187 Mon Sep 17 00:00:00 2001 From: Sean Allred Date: Wed, 7 Jan 2015 16:00:59 -0500 Subject: Hotfix Travis/Gitter integration It was broken when the repository URL changed -- I just never noticed until now. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d00ab46..067fa62 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,7 +31,7 @@ script: notifications: webhooks: urls: - - https://webhooks.gitter.im/e/07063bd143e35f54b1e8 + - https://webhooks.gitter.im/e/77b562dfc62ea5cd545a on_success: change # options: [always|never|change] default: always on_failure: always # options: [always|never|change] default: always on_start: false # default: false -- cgit v1.2.3 From 1534c4c690697b6ec23dca29dc94837705fe5fc5 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 7 Jan 2015 21:40:32 -0200 Subject: Really fix filling --- sx-question-print.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sx-question-print.el b/sx-question-print.el index e2db76f..1e25d67 100644 --- a/sx-question-print.el +++ b/sx-question-print.el @@ -462,9 +462,11 @@ font-locking." (defun sx-question-mode--skip-references () "If there's a reference ahead, skip it and return non-nil." - (while (looking-at-p (format sx-question-mode--reference-regexp ".+")) + (forward-line 0) + (when (looking-at-p (format sx-question-mode--reference-regexp ".+")) ;; Returns non-nil - (forward-line 1))) + (forward-paragraph 1) + t)) (provide 'sx-question-print) ;;; sx-question-print.el ends here -- cgit v1.2.3 From cd0c7c622865d0ab3b628a96d93537bcfe0e76d9 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 7 Jan 2015 21:48:49 -0200 Subject: Test fill-and-fontify --- test/test-printing.el | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/test/test-printing.el b/test/test-printing.el index 2857cb7..c477b28 100644 --- a/test/test-printing.el +++ b/test/test-printing.el @@ -71,3 +71,59 @@ after being run through `sx-question--tag-format'." (sx--user-@name '((display_name . "ĤÞßĐŁŘĞĜÝŸÑŃŚŞŠŜŻŹŽÇĆČĈÙÚÛÜŬŮÒÓÔÕÖØŐÐÌÍÎÏıÈÉÊËĘÀÅÁÂÄÃÅĄĴ"))) "@HTHssDLRGGYYNNSSSSZZZCCCCUUUUUUOOOOOOOOIIIIiEEEEEAAAAAAAAJ"))) +(ert-deftest sx-question-mode--fill-and-fontify () + "Check complicated questions are filled correctly." + (should + (equal + (sx-question-mode--fill-and-fontify + "Creating an account on a new site requires you to log into that site using *the same credentials you used on existing sites.* For instance, if you used the Stack Exchange login method, you'd... + +1. Click the \"Log in using Stack Exchange\" button: + + ![][1] + +2. Enter your username and password (yes, even if you *just did this* to log into, say, Stack Overflow) and press the \"Log In\" button: + + ![][2] + +3. Confirm the creation of the new account: + + ![][3] + + some code block + some code block + some code block + some code block + some code block + some code block + + [1]: http://i.stack.imgur.com/ktFTs.png + [2]: http://i.stack.imgur.com/5l2AY.png + [3]: http://i.stack.imgur.com/22myl.png") + "Creating an account on a new site requires you to log into that site +using *the same credentials you used on existing sites.* For instance, +if you used the Stack Exchange login method, you'd... + +1. Click the \"Log in using Stack Exchange\" button: + + ![][1] + +2. Enter your username and password (yes, even if you *just did this* + to log into, say, Stack Overflow) and press the \"Log In\" button: + + ![][2] + +3. Confirm the creation of the new account: + + ![][3] + + some code block + some code block + some code block + some code block + some code block + some code block + + [1]: http://i.stack.imgur.com/ktFTs.png + [2]: http://i.stack.imgur.com/5l2AY.png + [3]: http://i.stack.imgur.com/22myl.png"))) -- cgit v1.2.3 From b5cc49f539aab7a1685bbcbdb089916ecfd5476f Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 7 Jan 2015 22:14:29 -0200 Subject: Change regexps to defconst --- sx-question-print.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sx-question-print.el b/sx-question-print.el index e2db76f..02e14c8 100644 --- a/sx-question-print.el +++ b/sx-question-print.el @@ -322,14 +322,14 @@ where `value' is given `face' as its face. 'face 'markdown-list-face) "String to be displayed as the bullet of markdown list items.") -(defvar sx-question-mode--reference-regexp +(defconst sx-question-mode--reference-regexp (rx line-start (0+ blank) "[%s]:" (0+ blank) (group-n 1 (1+ (not blank)))) "Regexp used to find the url of labeled links. E.g.: [1]: https://...") -(defvar sx-question-mode--link-regexp +(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 ")")))) ")") -- cgit v1.2.3 From 9344809abe4b6b1b73038bd02b466900f1340bc3 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 7 Jan 2015 22:14:51 -0200 Subject: Enable raw links. Fix #214 --- sx-question-print.el | 13 +++++++++---- 1 file 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) -- cgit v1.2.3 From c54fba393ee1b8fa62708c27f7ea1940d90d1859 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 7 Jan 2015 22:33:55 -0200 Subject: Add latex-mode and c-mode --- sx-babel.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sx-babel.el b/sx-babel.el index 4386172..e115817 100644 --- a/sx-babel.el +++ b/sx-babel.el @@ -34,6 +34,12 @@ ;; @TODO: Make shell-mode work here. Currently errors because it ;; needs a process. `sh-mode' isn't as nice. (,(rx (or "$ " "# ")) sh-mode) + ;; Not sure if leaving out "[{" might lead to false positives. + (,(rx "\\" (+ alnum) (any "[{")) latex-mode) + ;; Right now, this will match a lot of stuff. Once we are capable + ;; of determining major-mode from tags, site, and comments, this + ;; will work as a last case fallback. + (,(rx (or (and "int" (+ space) "main" (* space) "("))) c-mode) ) "List of cons cells determining which major-mode to use when. Each car is a rule and each cdr is a major-mode. The first rule -- cgit v1.2.3 From 2278f45dfc4a21dd1a9c8757d0539e6c460ac43d Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 7 Jan 2015 22:51:25 -0200 Subject: Use http instead of https for our data requests --- sx-request.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sx-request.el b/sx-request.el index f892367..9a788ca 100644 --- a/sx-request.el +++ b/sx-request.el @@ -217,8 +217,8 @@ Currently returns nil." ;;; Our own generated data -(defvar sx-request--data-url-format - "https://raw.githubusercontent.com/vermiculus/sx.el/data/data/%s.el" +(defconst sx-request--data-url-format + "http://raw.githubusercontent.com/vermiculus/sx.el/data/data/%s.el" "Url of the \"data\" directory inside the SX `data' branch.") (defun sx-request-get-data (file) -- cgit v1.2.3