Public entry points for rendering rows of strings with the clj-string-layout DSL.
Most applications use layout for vector output, layout-str for newline joined output, or layout-seq for large inputs with explicit column widths. The parse-layout and explain-layout helpers are intended for developing and debugging custom layout strings.
Public entry points for rendering rows of strings with the clj-string-layout DSL. Most applications use layout for vector output, layout-str for newline joined output, or layout-seq for large inputs with explicit column widths. The parse-layout and explain-layout helpers are intended for developing and debugging custom layout strings.
Default configuration merged into every layout config.
Important keys include :width, :align-char, :fill-char, :display-width, :col-widths, :row-count, :word-split-char, :row-split-char, and :raw?. The :layout key is intentionally not defaulted and must be supplied by callers.
Default configuration merged into every layout config. Important keys include :width, :align-char, :fill-char, :display-width, :col-widths, :row-count, :word-split-char, :row-split-char, and :raw?. The :layout key is intentionally not defaulted and must be supplied by callers.
(explain-layout layout-string)(explain-layout row-layout? layout-string)Returns parse diagnostics for a layout string without throwing.
Column layout parsing is used by default. Pass true as the first argument to explain a row layout. Returns {:valid? true :layout ...} when parsing succeeds, otherwise {:valid? false :message ... :data ...}. The :data value is the ex-data map that parse-layout would have thrown.
Returns parse diagnostics for a layout string without throwing.
Column layout parsing is used by default. Pass true as the first argument to
explain a row layout. Returns {:valid? true :layout ...} when parsing
succeeds, otherwise {:valid? false :message ... :data ...}. The :data value is
the ex-data map that parse-layout would have thrown.(layout rows layout-config)Renders rows of strings into a vector of layout lines.
rows may be a string, split with :row-split-char and :word-split-char, or a sequence of row sequences containing strings. Short rows are padded with empty cells to the widest input row unless explicit :col-widths are supplied.
layout-config must include [:layout :cols], a vector whose first item is a layout string. Optional [:layout :rows] entries insert virtual rows such as table borders. See clj-string-layout.predicates for repeat and row predicate helpers.
Returns a vector of strings by default. With :raw? true, returns a vector of row-piece vectors instead, which is useful for post-processing individual cells before joining.
Renders rows of strings into a vector of layout lines. rows may be a string, split with :row-split-char and :word-split-char, or a sequence of row sequences containing strings. Short rows are padded with empty cells to the widest input row unless explicit :col-widths are supplied. layout-config must include [:layout :cols], a vector whose first item is a layout string. Optional [:layout :rows] entries insert virtual rows such as table borders. See clj-string-layout.predicates for repeat and row predicate helpers. Returns a vector of strings by default. With :raw? true, returns a vector of row-piece vectors instead, which is useful for post-processing individual cells before joining.
(layout-seq rows layout-config)Renders rows of strings as a lazy sequence of layout lines.
The rendering rules are the same as layout. For large data sets, pass :col-widths so rows can be rendered without first retaining the whole input to compute automatic widths. If virtual row layouts are present, pass :row-count so last-row? style predicates can be evaluated without counting the input.
Without :col-widths, exact automatic widths still require realizing all rows before the first output row can be produced. With :raw? true, returns lazy row-piece vectors instead of joined strings.
Renders rows of strings as a lazy sequence of layout lines. The rendering rules are the same as layout. For large data sets, pass :col-widths so rows can be rendered without first retaining the whole input to compute automatic widths. If virtual row layouts are present, pass :row-count so last-row? style predicates can be evaluated without counting the input. Without :col-widths, exact automatic widths still require realizing all rows before the first output row can be produced. With :raw? true, returns lazy row-piece vectors instead of joined strings.
(layout-str rows layout-config)Renders rows and joins the resulting lines with newline characters.
This is a convenience wrapper around layout for consumers that expect a single string rather than a vector of lines.
Renders rows and joins the resulting lines with newline characters. This is a convenience wrapper around layout for consumers that expect a single string rather than a vector of lines.
(parse-layout layout-string)(parse-layout row-layout? layout-string)Parses a layout string into the diagnostic layout representation.
Column layout parsing is used by default. Pass true as the first argument to parse a row layout, where the character inside brackets is treated as the row drawing character instead of a column alignment marker.
The returned data is useful for debugging custom layouts and error reports, but it is not a stable rendering API. Prefer layout, layout-str, or layout-seq for application code.
Parses a layout string into the diagnostic layout representation. Column layout parsing is used by default. Pass true as the first argument to parse a row layout, where the character inside brackets is treated as the row drawing character instead of a column alignment marker. The returned data is useful for debugging custom layouts and error reports, but it is not a stable rendering API. Prefer layout, layout-str, or layout-seq for application code.
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 |