Skip to content

Commit 802df2f

Browse files
committed
Merge pull request #676 from otfrom/handle-grimoire-qmark
Replace ? in grimoire URLs.
2 parents 39275cb + 24b2b7e commit 802df2f

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

cider-interaction.el

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,8 +1408,11 @@ under point, prompts for a var."
14081408
(interactive "P")
14091409
(cider-read-symbol-name "Symbol: " 'cider-doc-lookup query))
14101410

1411-
(defun cider-grimoire-replace-dashes (name)
1411+
(defun cider-grimoire-replace-special (name)
14121412
"Convert the dashes in NAME to a grimoire friendly format."
1413+
(setq name (if (string-match "\\?\\'" name)
1414+
(replace-match "_QMARK" t t name)
1415+
name))
14131416
(setq name (if (string-match "\\`-" name)
14141417
(replace-match "DASH_" t t name)
14151418
name))
@@ -1423,7 +1426,7 @@ under point, prompts for a var."
14231426
(let ((clojure-version (concat (substring clojure-version 0 4) "0"))
14241427
(base-url "http://grimoire.arrdem.com/"))
14251428
(if name
1426-
(concat base-url clojure-version "/" ns "/" (cider-grimoire-replace-dashes name) "/")
1429+
(concat base-url clojure-version "/" ns "/" (cider-grimoire-replace-special name) "/")
14271430
(concat base-url clojure-version "/" ns "/"))))
14281431

14291432
(defun cider-grimoire-lookup (symbol)

test/cider-tests.el

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -544,10 +544,12 @@
544544
(should (equal "C:/space test" (cider--url-to-file "file:/C:/space%20test"))))
545545

546546
;;; grimoire tests
547-
(ert-deftest cider-grimoire-replace-dashes ()
548-
(should (equal (cider-grimoire-replace-dashes "defn-") "defn_DASH"))
549-
(should (equal (cider-grimoire-replace-dashes "-map-indexed") "DASH_map_DASH_indexed"))
550-
(should (equal (cider-grimoire-replace-dashes "-foo-bar-baz-") "DASH_foo_DASH_bar_DASH_baz_DASH")))
547+
(ert-deftest cider-grimoire-replace-special ()
548+
(should (equal (cider-grimoire-replace-special "isa?") "isa_QMARK"))
549+
(should (equal (cider-grimoire-replace-special "really-isa?") "really_DASH_isa_QMARK"))
550+
(should (equal (cider-grimoire-replace-special "defn-") "defn_DASH"))
551+
(should (equal (cider-grimoire-replace-special "-map-indexed") "DASH_map_DASH_indexed"))
552+
(should (equal (cider-grimoire-replace-special "-foo-bar-baz-") "DASH_foo_DASH_bar_DASH_baz_DASH")))
551553

552554
(ert-deftest cider-grimoire-url ()
553555
(should (equal "http://grimoire.arrdem.com/1.5.0/clojure.core/defn_DASH/"

0 commit comments

Comments
 (0)