muesli4 / table-layout

Layout data in grids and pretty tables. Provides a lot of tools to get the cell formatting right (positional alignment, alignment on specific characters and limiting of cell width)..
BSD 3-Clause "New" or "Revised" License
37 stars 11 forks source link

Allow Strings for TableStyle delimiters. #21

Closed Xitian9 closed 2 years ago

Xitian9 commented 2 years ago

Fixes #17.

This allows a greater range of delimiters allowed in tables, including multi-character delimiters like ||, or null delimiters "". This furthermore allows us to create tables with no outer borders.

Here are two examples of new table styles created with this.

Using asciiDoubleS:

├────────────────────────────┼───────────────────────────────────────────────────────────────────┤
│                            │        ++-------------------++-------------------++-----++        │
│  len spec: expand          │        ||     Some text     ||   Some numbers    ||  X  ||        │
│  position: left            │        ++-------------------++-------------------++-----++        │
│ alignment: no align        │        || This is long text || 4.20000000        || foo ||        │
│                            │        || Short             || 200300400500600.2 || bar ||        │
│                            │        ++-------------------++-------------------++-----++        │
├────────────────────────────┼───────────────────────────────────────────────────────────────────┤

Using withoutBorders unicodeS:

├────────────────────────────┼───────────────────────────────────────────────────────────────────┤
│  len spec: expand          │                Some text     │   Some numbers    │  X             │
│  position: left            │           ═══════════════════╪═══════════════════╪═════           │
│ alignment: no align        │            This is long text │ 4.20000000        │ foo            │
│                            │            Short             │ 200300400500600.2 │ bar            │
├────────────────────────────┼───────────────────────────────────────────────────────────────────┤
Xitian9 commented 2 years ago

I think I've addressed all the comments. Let me know if you'd like other changes.

Xitian9 commented 2 years ago

Updated. Let me know if that's satisfactory.

And don't worry about the wait; thank you for maintaining this wonderful library!