[ANN] PrettyTables 0.7.0

Hi!

I just tag a new version of PrettyTables.jl (v0.7.0).

This version has two major improvements.

HTML backend

Now, PrettyTables.jl can print tables in HTML format. This is the very first version to support this back-end and only a minimal set of features is implemented. It should be considered in beta stage and I appreciate ideas to improve it!

For more information about how to use it, please, check the documentation.

Auto-wrap in text mode

Now, using the text back-end, you can fix the column size and, if you like, you can also enable auto-wrapping so that the text is fitted in the selected size. In this case, PrettyTables.jl will look for spaces to provide a better output.

Let’s say I want to print the Brazilian national anthem one verse per row:

julia> using PrettyTables

julia> table = [1 """Ouviram do Ipiranga as margens plΓ‘cidas
                  De um povo herΓ³ico o brado retumbante,
                  E o sol da Liberdade, em raios fΓΊlgidos,
                  Brilhou no cΓ©u da PΓ‘tria nesse instante.""";
             2 """Se o penhor dessa igualdade
                  Conseguimos conquistar com braço forte,
                  Em teu seio, Γ³ Liberdade,
                  Desafia o nosso peito a prΓ³pria morte!""";
             3 """Γ“ PΓ‘tria amada, Idolatrada, Salve! Salve!
                  Brasil, um sonho intenso, um raio vΓ­vido
                  De amor e de esperança à terra desce,
                  Se em teu formoso cΓ©u, risonho e lΓ­mpido,"""]

julia> header = ["Verse number", "Verse"]

julia> pretty_table(table, header; autowrap = true, linebreaks = true, hlines = 1:4, columns_width = [-1,30])
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Verse number β”‚                          Verse β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚            1 β”‚         Ouviram do Ipiranga as β”‚
β”‚              β”‚               margens plΓ‘cidas β”‚
β”‚              β”‚     De um povo herΓ³ico o brado β”‚
β”‚              β”‚                    retumbante, β”‚
β”‚              β”‚       E o sol da Liberdade, em β”‚
β”‚              β”‚                raios fΓΊlgidos, β”‚
β”‚              β”‚       Brilhou no cΓ©u da PΓ‘tria β”‚
β”‚              β”‚                nesse instante. β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚            2 β”‚    Se o penhor dessa igualdade β”‚
β”‚              β”‚     Conseguimos conquistar com β”‚
│              │                   braço forte, │
β”‚              β”‚      Em teu seio, Γ³ Liberdade, β”‚
β”‚              β”‚        Desafia o nosso peito a β”‚
β”‚              β”‚                 prΓ³pria morte! β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚            3 β”‚    Γ“ PΓ‘tria amada, Idolatrada, β”‚
β”‚              β”‚                  Salve! Salve! β”‚
β”‚              β”‚   Brasil, um sonho intenso, um β”‚
β”‚              β”‚                    raio vΓ­vido β”‚
│              │       De amor e de esperança à │
β”‚              β”‚                   terra desce, β”‚
β”‚              β”‚         Se em teu formoso cΓ©u, β”‚
β”‚              β”‚             risonho e lΓ­mpido, β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Notice that the alignment keyword also works here:

julia> pretty_table(table, header; autowrap = true, linebreaks = true, hlines = 1:4, columns_width = [-1,30], alignment = :c)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Verse number β”‚             Verse              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚      1       β”‚     Ouviram do Ipiranga as     β”‚
β”‚              β”‚        margens plΓ‘cidas        β”‚
β”‚              β”‚   De um povo herΓ³ico o brado   β”‚
β”‚              β”‚          retumbante,           β”‚
β”‚              β”‚    E o sol da Liberdade, em    β”‚
β”‚              β”‚        raios fΓΊlgidos,         β”‚
β”‚              β”‚    Brilhou no cΓ©u da PΓ‘tria    β”‚
β”‚              β”‚        nesse instante.         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚      2       β”‚  Se o penhor dessa igualdade   β”‚
β”‚              β”‚   Conseguimos conquistar com   β”‚
│              │          braço forte,          │
β”‚              β”‚   Em teu seio, Γ³ Liberdade,    β”‚
β”‚              β”‚    Desafia o nosso peito a     β”‚
β”‚              β”‚         prΓ³pria morte!         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚      3       β”‚  Γ“ PΓ‘tria amada, Idolatrada,   β”‚
β”‚              β”‚         Salve! Salve!          β”‚
β”‚              β”‚  Brasil, um sonho intenso, um  β”‚
β”‚              β”‚          raio vΓ­vido           β”‚
│              │    De amor e de esperança à    │
β”‚              β”‚          terra desce,          β”‚
β”‚              β”‚     Se em teu formoso cΓ©u,     β”‚
β”‚              β”‚       risonho e lΓ­mpido,       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
8 Likes