doc additions/cleanups [skip ci] (#1388)

This commit is contained in:
Bob 2022-10-10 11:04:15 -04:00 committed by GitHub
parent 863c6051bd
commit 9241c81238
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 2 deletions

View file

@ -401,7 +401,7 @@ handling of SIGINT and SIGPIPE. This can be done by setting
- [Recursive document transformations with Pandoc and Clojure](https://play.teod.eu/document-transform-pandoc-clojure/) by Teodor Heggelund
- [Blambda!](https://jmglov.net/blog/2022-07-03-blambda.html) by Josh Glover
- [Babashka CLI](https://blog.michielborkent.nl/babashka-cli.html): turn Clojure functions into CLIs!
- [Breakneck Babashka on K8s](Breakneck Babashka on K8s) by Heow Goodman
- [Breakneck Babashka on K8s](https://www.linkedin.com/pulse/breakneck-babashka-k8s-heow-goodman/) by Heow Goodman
- [Recursive document transformations with Pandoc and Clojure](https://play.teod.eu/document-transform-pandoc-clojure/)
- [Detecting inconsistent aliases in a clojure codebase](https://www.youtube.com/watch?v=bf8KLKkCH2g) by Oxalorg
- [I, too, Wrote Myself a Static Site Generator](https://dawranliou.com/blog/i-too-wrote-myself-a-static-site-generator/) by Daw-Ran Liou

View file

@ -38,6 +38,8 @@
- [Simple logger](#simple-logger)
- [Using GZip streams (memo utility)](#using-gzip-streams-to-make-a-note-utility)
- [Pretty-printing mySQL results](#pretty-printing-mysql-results)
- [Single page application with Babashka + htmx](#single-page-application-with-babashka--htmx)
- [Wikipedia translation](#wikipedia-translation)
Here's a gallery of useful examples. Do you have a useful example? PR welcome!
@ -390,7 +392,7 @@ Example usage:
$ examples/http-server.clj
```
See [file-server.clj](file-server.clj).
See [http-server.clj](http-server.clj).
## Torrent viewer
@ -555,3 +557,14 @@ Example of a todo list SPA using Babashka and htmx
See [htmx_todoapp.clj](htmx_todoapp.clj)
Contributed by [@prestancedesign](https://github.com/prestancedesign).
## Wikipedia translation
[wiki-translate.clj](wiki-translate.clj) uses Wikipedia to translate words from English to Dutch (other languages are available).
``` shell
$ bb wiki-translate.clj window
"Venster (muur) Dutch"
```
Shared by Janne Himanka on Clojurians Slack

View file

@ -0,0 +1,11 @@
#!/usr/bin/env bb
;; by Janne Himanka shared on Clojurians Slack
(require '[babashka.curl :as curl])
(let [url (str "https://en.wikipedia.org/wiki/" (first *command-line-args*))
page (:body (curl/get url))]
(cond
(re-find #"Disambiguation" page)
(doseq [item (map last (re-seq #"<li><a href...wiki/([^\"]+)" page))]
(println item))
:else (last (re-find #"nl.wikipedia.org/.+?title..([^\"]+)" page))))