Current state and the future of PrettyTables.jl

Are the plots using UnicodePlots? :blush: Very cool feature

2 Likes

See the footnote (another great PrettyTables feature :smiley: )

3 Likes

Ahh I totally missed that footnote. :joy:

1 Like

Yes! I used UnicodePlots.jl. This test was related to the AnsiTextCell, a custom cell type that you can pass any string with decorations and it renders it correctly inside the cell.

Hi!

I need to design the name for some predefined table formats in PrettyTables.jl. I have already asked here, and @xlxs4 suggestion was to keep what we have now. However, it will not be possible.

For example, now we have tf_ascii_dots to define a text table format that uses ASCII dots at borders. The name came from a far past when we only have a text back end. Now, I can rename to tf_text_ascii_dots , but it is not good also. In the new design, we have a TextTableFormat that stores all the variables related to table formatting (border style, where to draw vertical and horizontal lines, etc). The old tf_text_ascii_dots relates only to the border style. Now, we have the structure TextTableBorder for this purpose.

Hence, I have two options:

  1. tf_text_border_ascii_dots , which is not the way things are called in English; or
  2. the very verbose text_table_border__ascii_dots.

The latter uses two underscores to separate a “naming space” and I use it a lot internally. What do you think?

  • tf_text_border_ascii_dots
  • text_table_border__ascii_dots
  • Other (please, comment)
0 voters

To be less verbose, maybe something like

txt_tborder_ascii_dots

In any case, I will have to read the syntax, unless I use them often I cannot remember such strings.

1 Like

What about

abstract type TxtPredefinedBorderFmt end
struct TxtDotsBorderFmt <: TxtPredefinedBorderFmt end
struct TxtOtherBorderFmt <: TxtPredefinedBorderFmt end

function TextTableBorder(fmt::TxtPredefinedBorderFmt)
    if isa(fmt, TxtDotsBorderFmt) # Or use dispatch
        return ....
    elseif isa(fmt, TxtOtherBorderFmt)
        return ....
    end
end

If TextTableBorder is used across a lot of names, a simple ttb_ascii_dots would help reduce the verbosity

Thanks for the suggestion @xlxs4 ! However, I realized that probably I will not be able to create good acronyms for PrettyTables.jl at this stage. For example, if we use ttb_ for the text back end, what would we use for the Typst back end when it is implemented ? The problem occurs because we do not have a final product yet.

My conclusion is to be verbose but clear. Afterward, maybe someone in the community can see the whole picture and create a PrettyTablesMeta.jl to make things easier like we have in DataFramesMeta.jl.

10 Likes

Nice updates, like the merged columns!
Hacked a simple wrapper to determine multilevel column headings automatically based on the dataset:


Do you think this is within the scope of your package?

Also, cosmetic comments based on how these headings look:

  • Would be nice to have some gap between the merged cell borders in the HTML format, otherwise the boundary between “name” and “flux” in this example is not clear
  • For the terminal output, the secondary heading colors are almost invisible in some common colorscehemes (see the screenshot)
1 Like

Hi @aplavin !

Thanks!

Do you think this is within the scope of your package?

Maybe not. I am really trying to make the scope as small as possible in this new rewrite. Otherwise, I will get the same maintainability problem in the current version.

  • Would be nice to have some gap between the merged cell borders in the HTML format, otherwise the boundary between “name” and “flux” in this example is not clear

How can we make this? I think it is only possible by customizing the CSS.

  • For the terminal output, the secondary heading colors are almost invisible in some common colorscehemes (see the screenshot)

What color scheme are you using?

* thinking if I should write PrettyTablesExtra.jl :slight_smile: *

I think so indeed, just put some minimal CSS by default so that everything is distinguishable… Probably border-spacing is the right property here.

It’s the default one in Pluto, I didn’t change anything.

2 Likes

Please!! We need something like this (just like DataFramesMeta.jl).

The problem is that it will only work with stand_alone = true.

I will check. thanks!

Hmm, why? What’s prohibiting <th style="border-spacing: 1em">... in embedded tables?

I tried, and it does not work :frowning:

That option only works if you add border-collapse: separate;. However, this option introduces a lot of problems given how we render the borders.

What are the issues with applying border-collapse to the table or tr?

I cannot remember, but there were a lot of problems. AFAIK, border-collapse can only be applied to table not to a specific row.

However, you can always provide your custom CSS to adjust all those things using the HtmlTableFormat structure.

1 Like