Skip to main content

A utility for generating ASCII art table

Project description

YATG (Yet Another Table Generator) is a utility for generating ASCII art table.

Introduction

It’s a good tool for generating ASCII art table. Input data can be csv or html.

Example of output (emacs style):

+---------+-----------------+----------+
|         | Average         | Red eyes |
|         +--------+--------+          |
|         | height | weight |          |
+---------+--------+--------+----------+
| Males   | 1.9    | 0.003  | 40%      |
+---------+--------+--------+----------+
| Females | 1.7    | 0.002  | 43%      |
+---------+--------+--------+----------+

Example of output (orgmode style):

| Header content 1 | Header content 2 |
|------------------+------------------|
| Body content 1   | Body content 2   |
| Body content 3   | Body content 4   |
| Body content 5   | Body content 6   |

Example of output (mysql style):

+------------------+------------------+
| Header content 1 | Header content 2 |
+------------------+------------------+
| Body content 1   | Body content 2   |
| Body content 3   | Body content 4   |
| Body content 5   | Body content 6   |
+------------------+------------------+

Example of output (markdown style):

| Header content 1 | Header content 2 |
|------------------|------------------|
| Body content 1   | Body content 2   |
| Body content 3   | Body content 4   |
| Body content 5   | Body content 6   |

Installation

To install YATG from PyPI:

$ pip install yatg

Usage

Options:

usage: yatg [-h] [-i INFILE] [-f FORMAT] [-d DELIMITER] [-o OUTFILE]
            [-s STYLE]

Yet Another Table Generator, convert CSV or html table to ASCII art table.

optional arguments:
  -h, --help            show this help message and exit
  -i INFILE, --input-file INFILE
                        source file, read from stdin if not specified
  -f FORMAT, --input-format FORMAT
                        format of input file, can be 'html' or 'csv', auto
                        guess it if not specified
  -d DELIMITER, --csv-delimiter DELIMITER
                        delimiter of csv data, guess it if not specified
  -o OUTFILE, --output-file OUTFILE
                        output file, write to stdout if not specified
  -s STYLE, --output-style STYLE
                        specify output table style, support 'orgmode',
                        'emacs', 'mysql', 'markdown', default is orgmode style

Feature

  1. Support multi output styles: emacs/orgmode(default)/mysql/markdown style.

  2. Colspan and rowspan are supported.

  3. Table is keep aligned when cell contains both ASCII and non-ASCII charaters.

  4. Compatible with Python 2 and Python 3, tested in Python 2.6/2.7/3.6.

  5. No 3rd-part dependency.

Limitation

  1. Multi-line text in one table cell would flatten to one line.

  2. Nested tables are not supported.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yatg-0.9.1.tar.gz (10.9 kB view hashes)

Uploaded Source

Built Distribution

yatg-0.9.1-py2.py3-none-any.whl (12.3 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page