3 ms·
I like it! Here's one I use to decide from a list of free-form submissions whether to generate a link or a Google search: (fn [pair-of] (let [text (get
by pgayed 3y ago
I like it!
Here's one I use to decide from a list of free-form submissions whether to generate a link or a Google search:
(fn [pair-of]
(let [text (get pair-of 1)]
(cond
(clojure.string/starts-with? text "http")
(list [:a {:href text} (truncate text 60)] [:br])
:else (list [:a {:href (str "https://google.com/search?q=" text)} text] [:br]))))
Doesn't always work but works often enough! ;)