babashka

jmglov 2025-12-31T15:47:34.962829Z

Do any of the various batteries included in Babashka have a way to decode XML entities? I want to turn something like "it's not that hard, surely" into "it's not that hard, surely". It seems like https://docs.oracle.com/javase/7/docs/api/javax/xml/bind/DatatypeConverter.html#parseString%28java.lang.String%29 can do it, but that class isn't included in Babashka and would probably suck in a bunch of shit that you don't want. 😬

✅ 1
borkdude 2025-12-31T15:52:36.404729Z

Indeed, I've avoided javax.xml so far :)

borkdude 2025-12-31T15:54:03.920719Z

You could cheat by using clojure.data.xml:

(require '[clojure.data.xml :as xml])

(def xml "<root>Don&#x27;t</root>")

(-> (xml/parse-str xml) :content first)
;; => "Don't"

borkdude 2025-12-31T15:54:51.456929Z

I hope you won't add this abomination to a PR in quickblog though... because then I'm responsible for it

borkdude 2025-12-31T15:56:03.520989Z

you could also manually process the things with str/replace

Bob B 2025-12-31T16:07:38.153959Z

user=> (org.jsoup.parser.Parser/unescapeEntities "don&#x27;t" false)
"don't"

💜 1
🎉 1
✅ 1
jmglov 2025-12-31T17:16:29.816269Z

@highpressurecarsalesm Lovely! Thank you so much! 🎉

jmglov 2025-12-31T17:30:24.901149Z

@borkdude Not everything is about quickblog, y'know. 😜

jmglov 2025-12-31T17:30:49.898379Z

This is actually part of https://codeberg.org/jmglov/cljcastr, my latest bit of silliness.

jmglov 2025-12-31T17:31:14.109379Z

It got complicated enough that I actually had to add some tests. 😭

borkdude 2025-12-31T17:35:36.507989Z

cool, I was afraid my hack would backfire on me! :P

😂 1
jmglov 2025-12-31T17:39:43.808079Z

Since when has a hack ever backfired? 😈

borkdude 2025-12-31T17:42:12.212249Z

one person's hack is another person's main project

😂 1
Bob B 2025-12-31T19:56:31.583429Z

I sometimes feel like my editor config is one my main projects, and like it's a collection of hacks 🙃

jmglov 2026-01-01T07:39:44.457679Z

Haha, I can relate! Moving to Doom Emacs a few years back let me jettison a lot of accumulated cruft, but I still have a few glorious Elisp hacks lying around. My Emacs config file is actually 27 years old, and has just been lugged along from one machine to the next. 😅