Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/backends/html/html_backend.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
function _html__print(
pspec::PrintingSpec;
allow_html_in_cells::Bool = false,
highlighters::Vector{HtmlHighlighter} = HtmlHighlighter[],
highlighters::Union{Vector{HtmlHighlighter}, NTuple{N, HtmlHighlighter} where N} = HtmlHighlighter[],
is_stdout::Bool = false,
line_breaks::Bool = false,
maximum_column_width::String = "",
Expand Down
6 changes: 4 additions & 2 deletions src/backends/text/text_backend.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,22 @@ const _DEFAULT_TEXT_HIGHLIGHTER = TextHighlighter[]
function _text__print_table(
pspec::PrintingSpec;
alignment_anchor_fallback::Symbol = :l,
alignment_anchor_regex::Union{Vector{Regex}, Vector{Pair{Int, Vector{Regex}}}} = _DEFAULT_ALIGNMENT_ANCHOR_REGEX,
alignment_anchor_regex::Union{Vector{Regex}, Vector{Pair{Int, Vector{Regex}}}, Dict{Int, Vector{Regex}}} = _DEFAULT_ALIGNMENT_ANCHOR_REGEX,
auto_wrap::Bool = false,
column_label_width_based_on_first_line_only::Bool = false,
display_size::NTuple{2, Int} = displaysize(pspec.context),
equal_data_column_widths::Bool = false,
fit_table_in_display_horizontally::Bool = true,
fit_table_in_display_vertically::Bool = true,
fixed_data_column_widths::Union{Int, Vector{Int}} = 0,
highlighters::Vector{TextHighlighter} = _DEFAULT_TEXT_HIGHLIGHTER,
highlighters::Union{Vector{TextHighlighter}, NTuple{N, TextHighlighter} where N} = _DEFAULT_TEXT_HIGHLIGHTER,
line_breaks::Bool = false,
maximum_data_column_widths::Union{Int, Vector{Int}} = 0,
overwrite_display::Bool = false,
reserved_display_lines::Int = 0,
style::TextTableStyle = TextTableStyle(),
table_format::TextTableFormat = TextTableFormat(),
kwargs...
)
context = pspec.context
table_data = pspec.table_data
Expand Down Expand Up @@ -97,6 +98,7 @@ function _text__print_table(
has_fixed_data_column_widths = true
end

alignment_anchor_regex isa Dict && (alignment_anchor_regex = collect(alignment_anchor_regex))
if alignment_anchor_regex isa Vector{Pair{Int, Vector{Regex}}}
for (j, _) in alignment_anchor_regex
(j <= 0) && throw(ArgumentError(
Expand Down
6 changes: 6 additions & 0 deletions src/backends/text/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -290,3 +290,9 @@
end

_text__default_highlighter_fd(h::TextHighlighter, ::Any, ::Int, ::Int) = h._decoration

# for compatibility with current Version of DataFrames.jl

const Highlighter = TextHighlighter
HtmlDecoration(; kwargs...) = Pair{String, String}["$k" => "$v" for (k, v) in kwargs]

Check warning on line 297 in src/backends/text/types.jl

View check run for this annotation

Codecov / codecov/patch

src/backends/text/types.jl#L297

Added line #L297 was not covered by tests
export Highlighter, HtmlDecoration
4 changes: 2 additions & 2 deletions src/main.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function pretty_table(

# == Other Configurations ==============================================================

formatters::Union{Nothing, Vector{T} where T <: Any} = nothing,
formatters::Union{Nothing, Vector, Tuple} = nothing,
maximum_number_of_columns::Int = -1,
maximum_number_of_rows::Int = -1,
merge_column_label_cells::Union{Symbol, Vector{MergeCells}} = :auto,
Expand Down Expand Up @@ -137,7 +137,7 @@ function pretty_table(
# == Other Configurations ==========================================================

cell_alignment,
formatters,
formatters isa Tuple ? collect(formatters) : formatters,
maximum_number_of_columns,
maximum_number_of_rows,
merge_column_label_cells,
Expand Down
Loading