Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/metaxal/text-table
A simple Racket package to display text tables with utf-8 boxes
https://github.com/metaxal/text-table
racket
Last synced: 5 days ago
JSON representation
A simple Racket package to display text tables with utf-8 boxes
- Host: GitHub
- URL: https://github.com/metaxal/text-table
- Owner: Metaxal
- License: other
- Created: 2017-09-23T18:08:38.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-06-28T09:32:08.000Z (over 1 year ago)
- Last Synced: 2025-01-29T11:33:52.043Z (6 days ago)
- Topics: racket
- Language: Racket
- Size: 87.9 KB
- Stars: 11
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
text-table
==========
A simple package to display utf-8 textual tables.
Check out the [docs](https://docs.racket-lang.org/text-table/index.html).To install:
```
raco pkg install text-table
```See the example in the main submodule of the `main.rkt` file.
You can observe the results by running:
```
racket -l text-table
```A minimalistic example:
```scheme
#lang racket
(require text-table)(print-simple-table
'((a b c d e f gggg h)
(12 "a\nbcde" 77 54 1 5646547987 41 1)
(111 222 3333 44 5 6 7 8888)))
```
Output:
```
a b c d e f gggg h
12 a 77 54 1 5646547987 41 1
bcde
111 222 3333 44 5 6 7 8888
```
A less minimalistic example:
```scheme
(print-table
'((a b c d e f gggg h)
(12 "a\nbcde" 77 54 1 5646547987 41 1)
(111 222 3333 44 5 6 7 8888)))
```
```
┌───┬────┬────┬──┬─┬──────────┬────┬────┐
│a │b │c │d │e│f │gggg│h │
├───┼────┼────┼──┼─┼──────────┼────┼────┤
│12 │a │77 │54│1│5646547987│41 │1 │
│ │bcde│ │ │ │ │ │ │
├───┼────┼────┼──┼─┼──────────┼────┼────┤
│111│222 │3333│44│5│6 │7 │8888│
└───┴────┴────┴──┴─┴──────────┴────┴────┘
```
An example with some more bells and whistles:
```scheme
(print-table
'((a b c d e f gggg h)
(12 "a\nbcde" 77 54 1 5646547987 41 1)
(111 222 3333 44 5 6 7 8888))
#:border-style 'double
#:framed? #f
#:row-sep? #t
#:align '(left center center center center center center right))
```
```
a ║ b ║ c ║d ║e║ f ║gggg║ h
═══╬════╬════╬══╬═╬══════════╬════╬════
12 ║ a ║ 77 ║54║1║5646547987║ 41 ║ 1
║bcde║ ║ ║ ║ ║ ║
═══╬════╬════╬══╬═╬══════════╬════╬════
111║222 ║3333║44║5║ 6 ║ 7 ║8888
```