(print-table & args)Print a table to out
Takes same arguments as table, but prints rather than returning
strings. Returns nil.
Print a table to *out* Takes same arguments as `table`, but prints rather than returning strings. Returns nil.
(table data)(table cols-or-opts data)(table opts cols data)Render a table as sequence of strings.
data should be a collection of maps with similar keys.
cols is a list of "colspecs", which can take the form
of keywords or maps with any of the following keys:
:name Specifies both the function (as a
keyword) and the title for the column
:title The title to use for the column in
the header. When not provided, uses a
titleized version of `:name`.
:key-fn The function that gets called on each
map in the collection to get the column.
When not specified, calls `get` on the
map with the `:name`
:align One of #{:left :right :center}, how to
align the text in the rows for this
column. Defaults to `:left`.
:title-align Similar to `:align`, but for the header
of the column. When not specified, will
use the value of `:align`.
:render-cell Function to format body cells (not titles)
after acesss, but before escaping. Default
is `crockery.protocols/render-cell*`, but
a useful alternative might be `pr-str`.
Must return a string.
:render-title Like `:render-cell`, but for titles.
Must return a string. Defaults to
`crockery.protocols/render-title*`.
When a map is provided, either :name or :key-fn is
required.
opts is a map of table options. All are optional, as is the
argument itself.
:format Can either be one of the built-in formatters
by key (:org, :tsv, :gfm, :fancy), or
anything that implements crockery.protocols/RenderTable.
:defaults Column defaults to be used when not provided
in an individual column's colspec.
:max-width The maximum textual width of a table. Useful when
printing to a tty terminal. The default is your
terminal width, if it can be detected.
Returns a lazy sequence of strings, each representing a printable line.
Render a table as sequence of strings.
`data` should be a collection of maps with similar keys.
`cols` is a list of "colspecs", which can take the form
of keywords or maps with any of the following keys:
:name Specifies both the function (as a
keyword) and the title for the column
:title The title to use for the column in
the header. When not provided, uses a
titleized version of `:name`.
:key-fn The function that gets called on each
map in the collection to get the column.
When not specified, calls `get` on the
map with the `:name`
:align One of #{:left :right :center}, how to
align the text in the rows for this
column. Defaults to `:left`.
:title-align Similar to `:align`, but for the header
of the column. When not specified, will
use the value of `:align`.
:render-cell Function to format body cells (not titles)
after acesss, but before escaping. Default
is `crockery.protocols/render-cell*`, but
a useful alternative might be `pr-str`.
Must return a string.
:render-title Like `:render-cell`, but for titles.
Must return a string. Defaults to
`crockery.protocols/render-title*`.
When a map is provided, either `:name` or `:key-fn` is
required.
`opts` is a map of table options. All are optional, as is the
argument itself.
:format Can either be one of the built-in formatters
by key (:org, :tsv, :gfm, :fancy), or
anything that implements crockery.protocols/RenderTable.
:defaults Column defaults to be used when not provided
in an individual column's colspec.
:max-width The maximum textual width of a table. Useful when
printing to a tty terminal. The default is your
terminal width, if it can be detected.
Returns a lazy sequence of strings, each representing a
printable line.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 |