{ "info": { "author": "cig01", "author_email": "juhani@163.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Text Processing", "Topic :: Utilities" ], "description": "====\nYATG\n====\n\nYATG (Yet Another Table Generator) is a utility for generating ASCII art table.\n\n.. image:: https://travis-ci.org/10gic/yatg.svg?branch=master\n :target: https://travis-ci.org/10gic/yatg\n :alt: Build status\n\nIntroduction\n============\n\nThis tool can convert csv or html to ASCII art table.\n\nExample of output (emacs style)::\n\n +---------+-----------------+----------+\n | | Average | Red eyes |\n | +--------+--------+ |\n | | height | weight | |\n +---------+--------+--------+----------+\n | Males | 1.9 | 0.003 | 40% |\n +---------+--------+--------+----------+\n | Females | 1.7 | 0.002 | 43% |\n +---------+--------+--------+----------+\n\nExample of output (orgmode style)::\n\n | Header content 1 | Header content 2 |\n |------------------+------------------|\n | Body content 1 | Body content 2 |\n | Body content 3 | Body content 4 |\n | Body content 5 | Body content 6 |\n\nExample of output (mysql style)::\n\n +------------------+------------------+\n | Header content 1 | Header content 2 |\n +------------------+------------------+\n | Body content 1 | Body content 2 |\n | Body content 3 | Body content 4 |\n | Body content 5 | Body content 6 |\n +------------------+------------------+\n\nExample of output (markdown style)::\n\n | Header content 1 | Header content 2 |\n |------------------|------------------|\n | Body content 1 | Body content 2 |\n | Body content 3 | Body content 4 |\n | Body content 5 | Body content 6 |\n\nInstallation\n============\n\nTo install YATG from PyPI::\n\n $ pip install yatg\n\nOr from github::\n\n $ curl -O https://raw.githubusercontent.com/10gic/yatg/master/yatg/yatg.py && chmod u+x yatg.py\n\nUsage\n=====\n\nAs command-line tool\n--------------------\nOptions::\n\n usage: yatg [-h] [-i INFILE] [-f FORMAT] [-d DELIMITER] [-o OUTFILE]\n [-s STYLE] [--no-header] [--column-align ALIGN]\n [--width1-chars CHARS] [--align-in-tty]\n\n Yet Another Table Generator, convert CSV or html table to ASCII art table.\n\n optional arguments:\n -h, --help show this help message and exit\n -i INFILE, --input-file INFILE\n source file, read from stdin if not specified\n -f FORMAT, --input-format FORMAT\n format of input file, can be 'html' or 'csv', auto\n guess it if not specified\n -d DELIMITER, --csv-delimiter DELIMITER\n delimiter of csv data, guess it if not specified\n -o OUTFILE, --output-file OUTFILE\n output file, write to stdout if not specified\n -s STYLE, --output-style STYLE\n specify output table style, support 'orgmode',\n 'emacs', 'mysql', 'markdown', default is orgmode style\n --no-header horizontal header line would not be printed if this\n option present\n --column-align ALIGN specify align string of columns, support 'l/r'. For\n example, 'llrr' specify first two colums align left,\n 3rd and 4th columns align right. Default alignment is\n left.\n --width1-chars CHARS specify chars that should consider one character width\n by force, only 'emoji' is supported currently. This\n option requires package emoji.\n --align-in-tty set column aligned in tty. This option requires\n package blessed. If this option present, option\n --width1-chars would be ignored. NOTE: (1) this option\n requires you in a tty, (2) each column width must less\n than width of tty, please enlarge your tty window if\n you have long cell data.\n\nAs a library\n------------\nExample::\n\n >>> import yatg\n >>> print(yatg.csv_2_ascii_table([[\"head1\", \"head2\"],\n ... [\"content1\", \"content2\"],\n ... [\"content3\", \"content4\"]]))\n | head1 | head2 |\n |----------+----------|\n | content1 | content2 |\n | content3 | content4 |\n\n >>> print(yatg.html_2_ascii_table(\"\"\"\n ...
| 1st row | \n ...colspan2 | \n ...rowspan2 | \n ...|
| 2nd row | \n ...under colspan2 | \n ...under colspan2 | \n ...|
| 3rd row | \n ...colspan3 | \n ...||