{ "info": { "author": "Christopher Welborn", "author_email": "cj@welbornprod.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX :: Linux", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "FmtBlock\n========\n\nFormats text into \"blocks\" that do not exceed the maximum length for\neach line. This can be used as a command-line tool or imported for the\n``FormatBlock`` class. There are various features like prepending,\nappending, expanding space between words, splitting on characters or\nspaces, and preserving newlines.\n\n--------------\n\nCommand-line help:\n------------------\n\n::\n\n Usage:\n fmtblock -h | -v\n fmtblock [WORDS...] [-D] [-w num]\n [-c | -f] [-e] ([-i num] | [-I num]) [-l] [-n]\n ([-s] [-p txt | -P txt]) ([-S] [-a txt | -A txt])\n\n Options:\n WORDS : Words to format into a block.\n File names can be passed to read from a file.\n If not given, stdin is used instead.\n -a txt,--append txt : Append this text before each line, after any\n indents.\n -A txt,--APPEND txt : Same as --append, except the appended text\n is not included when calculating the width.\n -c,--chars : Wrap on characters instead of spaces.\n -D,--debug : Show some debugging info.\n -e,--enumerate : Print line numbers before each line.\n -f,--fill : Insert spaces between words so that each line\n is the same width.\n -h,--help : Show this help message.\n -i num,--indent num : Indention level, where 4 spaces is 1 indent.\n Maximum width includes any indention.\n Default: 0\n -I num,--INDENT num : Same as --indent, except the indention is not\n included when calculating the width.\n Default: 0\n -l,--lstrip : Remove leading spaces for each line, before\n indention.\n -n,--newlines : Preserve newlines.\n -p txt,--prepend txt : Prepend this text before each line, after any\n indents.\n -P txt,--PREPEND txt : Same as --prepend, except the prepended text\n is not included when calculating the width.\n -s,--stripfirst : Strip first --prepend.\n -S,--striplast : Strip last --append.\n -v,--version : Show version.\n -w num,--width num : Maximum width for the block.\n Default: 79\n\n--------------\n\nDependencies:\n-------------\n\n- **Python 3.3+** - This project uses ``yield from``. Porting to older\n python versions would be trivial, but I don't plan on doing it (just\n use ``for-loops`` and ``yield`` instead of ``yield from``).\n\nPython Dependencies:\n--------------------\n\nThese are installable with ``pip``.\n\n- **Colr** - Used for colorized output.\n- **Docopt** - Used to handle command-line argument parsing.\n\n--------------\n\nInstallation:\n-------------\n\nInstall the module with pip:\n\n::\n\n # You may have to use pip3 here.\n pip install formatblock\n\nThen you can run it like this:\n\n::\n\n fmtblock --help\n\nOr like this:\n\n::\n\n python3 -m fmtblock --help\n\nImports\n-------\n\nAll of the functionality for ``fmtblock`` is contained in a class called\n``FormatBlock``, which is importable for use in your project.\n\n.. code:: python\n\n from fmtblock import FormatBlock\n\n print(FormatBlock('This is a test okay.').format(width=5))\n\nOutput:\n\n::\n\n This\n is a\n test\n okay.\n\n--------------\n\nExamples:\n---------\n\nInput:\n~~~~~~\n\nThese three methods for sending input to ``fmtblock`` are the same:\n\n.. code:: bash\n\n echo \"Test String\" | fmtblock -w 5\n fmtblock \"Test String\" -w 5\n fmtblock Test String -w 5\n\nSpace splitting:\n~~~~~~~~~~~~~~~~\n\n.. code:: bash\n\n fmtblock -w 30 \"This is a fairly long string, though I've seen bigger.\"\n\nOutput:\n\n::\n\n This is a fairly long string,\n though I've seen bigger.\n\nCharacter splitting:\n~~~~~~~~~~~~~~~~~~~~\n\n.. code:: bash\n\n fmtblock -c -w 10 \"This is a fairly long string, though I've seen bigger.\"\n\nOutput:\n\n::\n\n This is a\n fairly lon\n g string,\n though I'v\n e seen big\n ger.\n\nNewlines:\n~~~~~~~~~\n\n.. code:: bash\n\n echo \"This is a string\n that contains newlines\n and they will be preserved.\" | fmtblock -w 20 -n\n\nOutput:\n\n::\n\n This is a string\n that contains\n newlines\n and they will be\n preserved.\n\nEnumeration:\n~~~~~~~~~~~~\n\n.. code:: bash\n\n echo {a..c} | fmtblock -e -w 1\n\nOutput:\n\n::\n\n 1: a\n 2: b\n 3: c\n\nIndents:\n~~~~~~~~\n\n.. code:: bash\n\n # Preserving newlines with -n, instead of using -w.\n seq 1 3 | fmtblock -i 1 -n\n\nOutput:\n\n::\n\n 1\n 2\n 3\n\nPrepended Text:\n~~~~~~~~~~~~~~~\n\n.. code:: bash\n\n # Preserving newlines with -n, instead of using -w.\n seq 1 3 | fmtblock -n -p \"Test \"\n\nOutput:\n\n::\n\n Test 1\n Test 2\n Test 3\n\nAlso see ``-P``, to prepend text without it affecting width\ncalculations.\n\nAppended Text:\n~~~~~~~~~~~~~~\n\n.. code:: bash\n\n seq 1 3 | fmtblock -n -a \") Test\"\n\nOutput:\n\n::\n\n 1) Test\n 2) Test\n 3) Test\n\nAlso see ``-A``, to append text without it affecting width calculations.\n\nStrip first/last:\n~~~~~~~~~~~~~~~~~\n\nWhen using ``-p`` or ``-P``, you can skip the first line with ``-s``.\n\nWhen using ``-a`` or ``-A``, you can also skip the last line with\n``-S``.\n\n.. code:: bash\n\n seq 200000 200010 | fmtblock -w 30 -p \" \" -s -a \" \\\\\" -S\n\nOutput:\n\n::\n\n 200000 200001 200002 \\\n 200003 200004 200005 \\\n 200006 200007 200008 \\\n 200009 200010\n\nFill:\n~~~~~\n\n.. code:: bash\n\n echo \"this is a test of the word fill feature for fmtblock\" | fmtblock -w 20 -f\n\nOutput:\n\n::\n\n this is a test of\n the word fill\n feature for fmtblock\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/welbornprod/fmtblock", "keywords": "python module library 3 format block characters chars text", "license": "", "maintainer": "", "maintainer_email": "", "name": "FormatBlock", "package_url": "https://pypi.org/project/FormatBlock/", "platform": "", "project_url": "https://pypi.org/project/FormatBlock/", "project_urls": { "Homepage": "https://github.com/welbornprod/fmtblock" }, "release_url": "https://pypi.org/project/FormatBlock/0.4.1/", "requires_dist": null, "requires_python": "", "summary": "Format blocks of characters for display, split by words, characters, or newlines.\n", "version": "0.4.1" }, "last_serial": 5081428, "releases": { "0.3.5": [ { "comment_text": "", "digests": { "md5": "ddaefc9017a302b55462be5ee88efca9", "sha256": "ddd3b85a31800903b2ba3345bfb460110c79ff48e700997254dea2099c8b7e21" }, "downloads": -1, "filename": "FormatBlock-0.3.5.tar.gz", "has_sig": false, "md5_digest": "ddaefc9017a302b55462be5ee88efca9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10860, "upload_time": "2016-12-10T03:45:00", "url": "https://files.pythonhosted.org/packages/b0/91/d45bd9799eac7e8b59173ee3eca6726da3f6823ce00a018a669b6f6e5dfb/FormatBlock-0.3.5.tar.gz" } ], "0.3.6": [ { "comment_text": "", "digests": { "md5": "611b7a2c1a839a42b2b8722ee75a21a0", "sha256": "ec62ce54fb19d1a1261ead328e397dffb4dde4bbded8747f4f367292ff0cd654" }, "downloads": -1, "filename": "FormatBlock-0.3.6.tar.gz", "has_sig": false, "md5_digest": "611b7a2c1a839a42b2b8722ee75a21a0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10877, "upload_time": "2016-12-10T03:49:50", "url": "https://files.pythonhosted.org/packages/17/d0/ea82145baa83492200996a3c8b57774162368991f173909111e6eee97a22/FormatBlock-0.3.6.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "071ec50f836b6048fbb246b0e67608e6", "sha256": "79d95a9e7eeb865b21180fc0cb457755efef838b4b74ac5d78711806b0929e9c" }, "downloads": -1, "filename": "FormatBlock-0.4.1.tar.gz", "has_sig": false, "md5_digest": "071ec50f836b6048fbb246b0e67608e6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14638, "upload_time": "2019-04-02T23:19:51", "url": "https://files.pythonhosted.org/packages/b5/35/f149f35720194e55f4b0d10cfa0988aa8f8e82a1fb7280e24ec2794449e7/FormatBlock-0.4.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "071ec50f836b6048fbb246b0e67608e6", "sha256": "79d95a9e7eeb865b21180fc0cb457755efef838b4b74ac5d78711806b0929e9c" }, "downloads": -1, "filename": "FormatBlock-0.4.1.tar.gz", "has_sig": false, "md5_digest": "071ec50f836b6048fbb246b0e67608e6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14638, "upload_time": "2019-04-02T23:19:51", "url": "https://files.pythonhosted.org/packages/b5/35/f149f35720194e55f4b0d10cfa0988aa8f8e82a1fb7280e24ec2794449e7/FormatBlock-0.4.1.tar.gz" } ] }