New Release: https://github.com/avanelsas/baredom 80+ lightweight web components built in Clojurescript on web standards (Custom Elements, Shadow DOM, ES modules). No framework, just the DOM. What's new: - New components: x-icon, x-image - Default for x-navbar set to site header Live demos of these web components and all others at the repo's https://avanelsas.github.io/baredom/ Feedback Welcome! There is a #baredom channel where you can ask questions.
clj-format 0.1.2 — an extensible Clojure DSL for cl-format
https://github.com/danlentz/clj-format
[com.github.danlentz/clj-format "0.1.2"]
clj-format wraps clojure.pprint/cl-format with a Hiccup-style s-expression DSL. Pass it a string and it behaves identically to cl-format; pass it a vector and it compiles the DSL to a
format string first. Works on Clojure, ClojureScript, and Babashka.
(clj-format nil [:each {:sep ", " :from :rest} :str] "one" "two" "three")
;; => "one, two, three"
(clj-format nil [:int " item" [:plural {:rewind true}]] 5)
;; => "5 items"
New in 0.1.2 -- tables are now a first-class DSL form. [:table opts? & cols] renders through the same clj-format entry point with the same writer semantics:
(fmt/clj-format true
[:table {:style :unicode :header-case :upcase}
[:col :name {:width 12}]
[:col :description {:width 25 :overflow :wrap}]
[:col :price {:width 10 :align :right :format :money}]]
catalog)
┌──────────────┬───────────────────────────┬────────────┐
│ NAME │ DESCRIPTION │ PRICE │
├──────────────┼───────────────────────────┼────────────┤
│ Widget Pro │ Premium widget with │ 49.99 │
│ │ extended warranty and │ │
│ │ free shipping worldwide │ │
│ Gadget │ Basic gadget │ 24.50 │
│ Sprocket ... │ High-quality precision │ 12.75 │
│ │ sprocket for industrial │ │
│ │ applications │ │
└──────────────┴───────────────────────────┴────────────┘
Column formats accept any DSL directive (:int, :money, :roman, [:if "Yes" "No"], or a custom fn). Nine border styles. Word-wrap that preserves pre-formatted whitespace, so nested tables
and FIGlet banners drop cleanly into cells. Footer aggregation with :sum, :avg, :min, :max, :count. Markdown output for READMEs.
Also new: an optional [:figlet ...] directive for ASCII-art banners via clj-figlet, and a dsl-preprocessor extension hook for adding custom directives.
Full DSL reference covering all 33 cl-format directives, 50+ worked examples, and the complete CHANGELOG: https://github.com/danlentz/clj-formatorg.clj-commons/pretty 3.7.0
https://github.com/clj-commons/pretty
Pretty prints things prettily; mostly, carefully formatted exception output using ANSI colors, smarter ordering, and
name-demangling to take the pain out of figuring out what went wrong, and where.
Pretty provides a Hiccup-inspired syntax for generating rich terminal output with ANSI fonts and colors, as well as
utilities for formatting tabular output, binary sequences (and binary diffs), and more.
Changes:
• clj-commons.format.exceptions/parse-exception
◦ Can now also parse the output of printing an exception (using pr, prn, or pr-str)
◦ Unknown reader tags when parsing EDN are ignored and the value is passed through
https://github.com/clj-commons/pretty/milestone/68?closed=1
You might be wondering what the point of the above is ... at Nubank, our services do not run with Pretty, it is strictly optional and used only at development time; that means that logging output has normal Clojure exception output in one format (text) or another (EDN). So the parsing and formatting trick is used when copying an exception out of a log, and gives very good fidelity to what Pretty would have done at runtime. I have a Babashka command line tool as a wrapper around parse-exception (and then format-exception* to make it pretty). It's very handy.