Skip to content

Commit 51e5225

Browse files
committed
⚠️ Remove filters
Filters were a feature very few people use and caused a lot of problems to add new features. Since we can replicate the result using standard Julia functions (like `filter` and `map`), we decided to remove it from PrettyTables.jl to make it easier to maintain the code. For more information, please, refer to: https://discourse.julialang.org/t/question-for-prettytables-jl-users-can-we-remove-filters/82609/8
1 parent 149563e commit 51e5225

39 files changed

+366
-1252
lines changed

docs/make.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ makedocs(
1818
"LaTeX" => "man/latex_backend.md",
1919
],
2020
"Alignment" => "man/alignment.md",
21-
"Filters" => "man/filters.md",
2221
"Formatters" => "man/formatters.md",
2322
"Examples" => Any[
2423
"Text back-end" => "man/text_examples.md",

docs/src/assets/ex_00011.png

-20.4 KB
Binary file not shown.

docs/src/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ Pages = [
3030
"man/html_backend.md"
3131
"man/latex_backend.md"
3232
"man/alignment.md"
33-
"man/filters.md"
3433
"man/formatters.md"
3534
"man/text_examples.md"
3635
"man/html_examples.md"

docs/src/man/filters.md

Lines changed: 0 additions & 67 deletions
This file was deleted.

docs/src/man/latex_backend.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,10 @@ passed as keywords when calling the function [`pretty_table`](@ref):
3434
drawn if `0` is in `hlines`, and the header and subheaders are
3535
considered as only 1 row. Furthermore, it is important to mention that
3636
the row number in this variable is related to the **printed rows**.
37-
Thus, it is affected by filters, and by the option to suppress the
38-
header `noheader`. Finally, for convenience, the top and bottom lines
39-
can be drawn by adding the symbols `:begin` and `:end` to this vector,
40-
respectively, and the line after the header can be drawn by adding the
41-
symbol `:header`.
37+
Thus, it is affected by the option to suppress the header `noheader`.
38+
Finally, for convenience, the top and bottom lines can be drawn by
39+
adding the symbols `:begin` and `:end` to this vector, respectively, and
40+
the line after the header can be drawn by adding the symbol `:header`.
4241

4342
!!! info
4443
The values of `body_hlines` will be appended to this vector. Thus,
@@ -65,10 +64,10 @@ passed as keywords when calling the function [`pretty_table`](@ref):
6564
case, the vertical lines will be drawn only after the columns in the vector.
6665
Notice that the left border will be drawn if `0` is in `vlines`.
6766
Furthermore, it is important to mention that the column number in this
68-
variable is related to the **printed columns**. Thus, it is affected by
69-
filters, and by the columns added using the variable `show_row_number`.
70-
Finally, for convenience, the left and right border can be drawn by adding
71-
the symbols `:begin` and `:end` to this vector, respectively.
67+
variable is related to the **printed columns**. Thus, it is affected by the
68+
columns added using the variable `show_row_number`. Finally, for
69+
convenience, the left and right border can be drawn by adding the symbols
70+
`:begin` and `:end` to this vector, respectively.
7271
(**Default** = `:none`)
7372
- `wrap_table::Union{Nothing, String}`: This variable controls whether to wrap
7473
the table in a environment defined by the variable `wrap_table_environment`.

docs/src/man/text_backend.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,10 @@ passed as keywords when calling the function `pretty_table`:
9696
drawn if `0` is in `hlines`, and the header and subheaders are
9797
considered as only 1 row. Furthermore, it is important to mention that
9898
the row number in this variable is related to the **printed rows**.
99-
Thus, it is affected by filters, and by the option to suppress the
100-
header `show_header`. Finally, for convenience, the top and bottom lines
101-
can be drawn by adding the symbols `:begin` and `:end` to this vector,
102-
respectively, and the line after the header can be drawn by adding the
103-
symbol `:header`.
99+
Thus, it is affected by the option to suppress the header `show_header`.
100+
Finally, for convenience, the top and bottom lines can be drawn by
101+
adding the symbols `:begin` and `:end` to this vector, respectively, and
102+
the line after the header can be drawn by adding the symbol `:header`.
104103

105104
!!! info
106105
The values of `body_hlines` will be appended to this vector. Thus,
@@ -152,11 +151,11 @@ passed as keywords when calling the function `pretty_table`:
152151
after the columns in the vector. Notice that the top line will be drawn
153152
if `0` is in `vlines`. Furthermore, it is important to mention that the
154153
column number in this variable is related to the **printed column**.
155-
Thus, it is affected by filters, and by the options `row_names` and
156-
`show_row_number`. Finally, for convenience, the left and right vertical
157-
lines can be drawn by adding the symbols `:begin` and `:end` to this
158-
vector, respectively, and the line after the header can be drawn by
159-
adding the symbol `:header`.
154+
Thus, it is affected by the options `row_names` and `show_row_number`.
155+
Finally, for convenience, the left and right vertical lines can be drawn
156+
by adding the symbols `:begin` and `:end` to this vector, respectively,
157+
and the line after the header can be drawn by adding the symbol
158+
`:header`.
160159

161160
The following keywords related to crayons are available to customize the output
162161
decoration:

docs/src/man/text_examples.md

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -124,25 +124,6 @@ julia> pretty_table(data, tf = tf_borderless, show_header = false)
124124

125125
![](../assets/ex_00010.png)
126126

127-
In the following, it is shown how the filters can be used to print only the even
128-
rows and columns:
129-
130-
```julia-repl
131-
julia> A = [(0:1:10)'
132-
(1:1:11)'
133-
(2:1:12)'
134-
(3:1:13)'
135-
(4:1:14)']
136-
137-
julia> f_c(data, i) = i % 2 == 0
138-
139-
julia> f_r(data, i) = i % 2 == 0
140-
141-
julia> pretty_table(A, filters_row = (f_r,), filters_col = (f_c,), show_row_number = true)
142-
```
143-
144-
![](../assets/ex_00011.png)
145-
146127
By default, if the data is larger than the display, then it will be cropped to
147128
fit it. This can be changed by using the keywords `crop` and `display_size`.
148129

docs/src/man/usage.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ Each back-end defines its own configuration keywords that can be passed using
7272
will be printed. (**Default** = `false`)
7373
- `compact_printing::Bool`: Select if the option `:compact` will be used when
7474
printing the data. (**Default** = `true`)
75-
- `column_filters::Union{Nothing, Tuple}`: Filters for the columns (see the
76-
section [Filters](@ref)).
7775
- `formatters::Union{Nothing, Function, Tuple}`: See the section
7876
[Formatters](@ref).
7977
- `header::Union{Symbol, Vector{Symbol}}`: The header must be a tuple of
@@ -107,8 +105,6 @@ Each back-end defines its own configuration keywords that can be passed using
107105
`print` or `:show` to use the function `show`. Notice that this selection is
108106
applicable only to the table data. Headers, sub-headers, and row name column
109107
are always rendered with print. (**Default** = `:print`)
110-
- `row_filters::Union{Nothing, Tuple}`: Filters for the rows (see the section
111-
[Filters](@ref)).
112108
- `row_names::Union{Nothing, AbstractVector}`: A vector containing the row names
113109
that will be appended to the left of the table. If it is `nothing`, then the
114110
column with the row names will not be shown. Notice that the size of this

precompilation/input.jl

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -111,17 +111,6 @@ function precompilation_input()
111111

112112
pretty_table(dict, sortkeys = true)
113113

114-
# Filters
115-
# ==========================================================================
116-
117-
pretty_table(data, filters_row = ((data, i) -> i % 2 == 0,))
118-
pretty_table(data, filters_col = ((data, i) -> i % 2 == 0,))
119-
pretty_table(
120-
data,
121-
filters_col = ((data, i) -> i % 2 == 0,),
122-
filters_row = ((data, i) -> i % 2 == 0,)
123-
)
124-
125114
# Input: Data with URLTextCell
126115
# ==========================================================================
127116

0 commit comments

Comments
 (0)