Tabular formatting facility built on the clj-format DSL.
Table specifications follow the Hiccup convention used throughout
clj-format. A table is expressed as [:table opts? & cols], which
clj-format.core/clj-format dispatches automatically:
(clj-format nil [:table] rows) (clj-format nil [:table :name :age] rows) (clj-format nil [:table {:style :unicode :header-case :upcase} [:col :product {:width 15}] [:col :qty {:align :right :format [:int {:group true}]}]] products)
This namespace exposes two entry points:
Architecture is a strict pipeline. Every cell is preprocessed to a
string at prep time; the rendered DSL uses :str directives
exclusively. This trades a less showcase-y generated DSL for one
uniform rendering path, single-mode semantics, and dramatically
simpler cell and row construction.
Tabular formatting facility built on the clj-format DSL.
Table specifications follow the Hiccup convention used throughout
clj-format. A table is expressed as `[:table opts? & cols]`, which
clj-format.core/clj-format dispatches automatically:
(clj-format nil [:table] rows)
(clj-format nil [:table :name :age] rows)
(clj-format nil
[:table {:style :unicode :header-case :upcase}
[:col :product {:width 15}]
[:col :qty {:align :right :format [:int {:group true}]}]]
products)
This namespace exposes two entry points:
- table-dsl — build the DSL body + argument list for inspection
- render-to — internal dispatch target used by clj-format
Architecture is a strict pipeline. Every cell is preprocessed to a
string at prep time; the rendered DSL uses `:str` directives
exclusively. This trades a less showcase-y generated DSL for one
uniform rendering path, single-mode semantics, and dramatically
simpler cell and row construction.(render-to target spec rows)Render a [:table ...] spec to a target. Internal entry point used by clj-format.core/clj-format.
target is the normalized output target: nil, true, or a Writer.
spec is a [:table ...] form. rows is the data sequence.
Render a [:table ...] spec to a target. Internal entry point used by clj-format.core/clj-format. `target` is the normalized output target: nil, true, or a Writer. `spec` is a [:table ...] form. `rows` is the data sequence.
(table-dsl spec rows)Build the table DSL and argument list without rendering.
Returns a map with :dsl (the clj-format DSL body vector) and
:args (the argument list to feed clj-format). Useful for
inspecting the generated DSL or calling clj-format directly.
spec is a [:table opts? & cols] form matching the Hiccup
convention; rows is a seq of maps or vectors.
Build the table DSL and argument list without rendering. Returns a map with `:dsl` (the clj-format DSL body vector) and `:args` (the argument list to feed clj-format). Useful for inspecting the generated DSL or calling clj-format directly. `spec` is a `[:table opts? & cols]` form matching the Hiccup convention; `rows` is a seq of maps or vectors.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |