Name | textlinebreaker JSON |
Version |
0.2.0
JSON |
| download |
home_page | None |
Summary | A module to format strings. Length and alignment of lines can be specified. In the new version is resolved the issue that caused the string to be splitted in single characters rather than in words. Also a check has been added to establish if the input is a list or a string in order to perform the correct splitting method. |
upload_time | 2024-04-20 19:11:25 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | MIT License |
keywords |
alignment
break
center
centre
format
left
line
right
split
string
text
words
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Textlinebreaker
[<img src="https://img.shields.io/badge/textlinebreaker-py-blue?style=flat&logo=python&logoWidth=20.svg/"></a>](https://github.com/scalvaruso/textlinebreaker/)
[![PyPI - Version](https://img.shields.io/pypi/v/textlinebreaker?logo=pypi&logoColor=white&color=blue)](https://pypi.org/project/textlinebreaker/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/textlinebreaker?logo=python)](https://pypi.org/project/textlinebreaker/)
[![Downloads](https://static.pepy.tech/badge/textlinebreaker)](https://pepy.tech/project/textlinebreaker)
[![PyPI - License](https://img.shields.io/pypi/l/textlinebreaker?color=blue)](https://github.com/scalvaruso/textlinebreaker/blob/main/LICENSE.md)
<!---
[![PyPI - status](https://img.shields.io/pypi/status/:textlinebreaker)](https://pypi.org/project/textlinebreaker/)
[![Documentation Status](https://readthedocs.org/projects/textlinebreaker/badge/?version=latest)](https://textlinebreaker.readthedocs.io/en/latest/?badge=latest)
-->
## Description
Text Line Breaker is a Python script that takes a string of text and breaks it into lines of a specified maximum width. This tool is particularly useful for formatting and displaying text in a terminal.
## Features
- Split text lines to fit within a specified maximum width.
- Choose alignment options for the text (left, center, right).
- Adjust the maximum width (default value is the terminal width).
## Latest Version 0.2.0
- Added new parameters (`"min"`, `"2words"`, `"max"`) to set different lines width.
- Improved algorithm to better split the input in the desired lenght lines.
## Table of Contents
- [Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Usage](#usage)
- [Parameters](#parameters)
- [Examples](#examples)
- [Contributing](#contributing)
- [License](#license)
## Getting Started
### Prerequisites
This script relies on the Python standard library and does not require any additional dependencies.
### Installation
- Install the package with pip
```bash
pip install textlinebreaker
```
- or upgrade it with
```bash
pip install --upgrade textlinebreaker
```
- Import the package in your program
```python
from textlinebreaker import split_line
```
## Usage
This function takes a long string of text as input and breaks it into lines according to the specified maximum width.
The default length is the width of the terminal.
### Parameters
The `split_line` function accepts the following parameters:
- **`line`**: is the main argument, it's the text that needs to be broken down.
- allowed values: strings, list of strings
- **`max_width`**: allows to set the max length of text on a line.
- allowed values: integers, "min", "2words", "max"
- default value = "max" (terminal width)
- **`alignment`**: allows to change the alignment of the text inside the frame.
- allowed values: "left", "centre", "center", "right"
- default value = "left"
### Examples
Here's an example of how to use the `split_line` function:
```python
from textlinebreaker import split_line
text = "This is an example of text line breaking using the Text Line Breaker script."
lines = split_line(text, max_width=30, alignment="center")
for line in lines:
print(line)
```
Output:
```bash
This is an example of text
line breaking using the Text
Line Breaker script.
```
## Contributing
If you'd like to contribute to this project, please follow these steps:
1. Fork the repository on GitHub.
2. Clone the fork to your local machine.
3. Create a new branch for your feature or bug fix.
4. Make your changes and commit them.
5. Push the changes to your fork on GitHub.
6. Create a pull request to the original repository.
## License
This project is licensed under the MIT License - see the [LICENSE](https://github.com/scalvaruso/textlinebreaker/blob/main/LICENSE.md) file for details.
Raw data
{
"_id": null,
"home_page": null,
"name": "textlinebreaker",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "alignment, break, center, centre, format, left, line, right, split, string, text, words",
"author": null,
"author_email": "scalvaruso <calvaruso.simone@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/6f/2d/7ec969244487b0e039e5369d08a642c0c0a414983676641ac728b8e75422/textlinebreaker-0.2.0.tar.gz",
"platform": null,
"description": "# Textlinebreaker\n\n[<img src=\"https://img.shields.io/badge/textlinebreaker-py-blue?style=flat&logo=python&logoWidth=20.svg/\"></a>](https://github.com/scalvaruso/textlinebreaker/)\n[![PyPI - Version](https://img.shields.io/pypi/v/textlinebreaker?logo=pypi&logoColor=white&color=blue)](https://pypi.org/project/textlinebreaker/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/textlinebreaker?logo=python)](https://pypi.org/project/textlinebreaker/)\n[![Downloads](https://static.pepy.tech/badge/textlinebreaker)](https://pepy.tech/project/textlinebreaker)\n[![PyPI - License](https://img.shields.io/pypi/l/textlinebreaker?color=blue)](https://github.com/scalvaruso/textlinebreaker/blob/main/LICENSE.md)\n\n<!---\n[![PyPI - status](https://img.shields.io/pypi/status/:textlinebreaker)](https://pypi.org/project/textlinebreaker/)\n[![Documentation Status](https://readthedocs.org/projects/textlinebreaker/badge/?version=latest)](https://textlinebreaker.readthedocs.io/en/latest/?badge=latest)\n-->\n\n## Description\n\nText Line Breaker is a Python script that takes a string of text and breaks it into lines of a specified maximum width. This tool is particularly useful for formatting and displaying text in a terminal.\n\n## Features\n\n- Split text lines to fit within a specified maximum width.\n- Choose alignment options for the text (left, center, right).\n- Adjust the maximum width (default value is the terminal width).\n\n## Latest Version 0.2.0\n\n- Added new parameters (`\"min\"`, `\"2words\"`, `\"max\"`) to set different lines width.\n- Improved algorithm to better split the input in the desired lenght lines.\n\n## Table of Contents\n\n- [Getting Started](#getting-started)\n - [Prerequisites](#prerequisites)\n - [Installation](#installation)\n- [Usage](#usage)\n - [Parameters](#parameters)\n - [Examples](#examples)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Getting Started\n\n### Prerequisites\n\nThis script relies on the Python standard library and does not require any additional dependencies.\n\n### Installation\n\n- Install the package with pip\n\n```bash\n pip install textlinebreaker\n```\n- or upgrade it with\n```bash\n pip install --upgrade textlinebreaker\n```\n\n- Import the package in your program\n\n```python\n from textlinebreaker import split_line\n```\n\n## Usage\n\nThis function takes a long string of text as input and breaks it into lines according to the specified maximum width.\nThe default length is the width of the terminal.\n\n### Parameters\n\nThe `split_line` function accepts the following parameters:\n\n- **`line`**: is the main argument, it's the text that needs to be broken down.\n - allowed values: strings, list of strings\n- **`max_width`**: allows to set the max length of text on a line. \n - allowed values: integers, \"min\", \"2words\", \"max\"\n - default value = \"max\" (terminal width)\n- **`alignment`**: allows to change the alignment of the text inside the frame.\n - allowed values: \"left\", \"centre\", \"center\", \"right\"\n - default value = \"left\"\n\n### Examples\n\nHere's an example of how to use the `split_line` function:\n\n```python\nfrom textlinebreaker import split_line\n\ntext = \"This is an example of text line breaking using the Text Line Breaker script.\"\nlines = split_line(text, max_width=30, alignment=\"center\")\n\nfor line in lines:\n print(line)\n```\n\nOutput:\n\n```bash\n This is an example of text \nline breaking using the Text \n Line Breaker script. \n```\n\n## Contributing\n\nIf you'd like to contribute to this project, please follow these steps:\n\n1. Fork the repository on GitHub.\n2. Clone the fork to your local machine.\n3. Create a new branch for your feature or bug fix.\n4. Make your changes and commit them.\n5. Push the changes to your fork on GitHub.\n6. Create a pull request to the original repository.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](https://github.com/scalvaruso/textlinebreaker/blob/main/LICENSE.md) file for details.\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "A module to format strings. Length and alignment of lines can be specified. In the new version is resolved the issue that caused the string to be splitted in single characters rather than in words. Also a check has been added to establish if the input is a list or a string in order to perform the correct splitting method.",
"version": "0.2.0",
"project_urls": {
"Homepage": "https://pypi.org/project/textlinebreaker",
"Repository": "https://github.com/scalvaruso/textlinebreaker"
},
"split_keywords": [
"alignment",
" break",
" center",
" centre",
" format",
" left",
" line",
" right",
" split",
" string",
" text",
" words"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9530bf04569feb2efafc0ee7523f034f4b2d13a1858ab29d6aea60edafdc5bb8",
"md5": "6af2f0cfe228a0994ac8fdc8ef7085b7",
"sha256": "bcfa36e58e409928b6f1810d9157e0b14cd697c42f940ece42d8c73017013ca1"
},
"downloads": -1,
"filename": "textlinebreaker-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6af2f0cfe228a0994ac8fdc8ef7085b7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 5951,
"upload_time": "2024-04-20T19:11:22",
"upload_time_iso_8601": "2024-04-20T19:11:22.296790Z",
"url": "https://files.pythonhosted.org/packages/95/30/bf04569feb2efafc0ee7523f034f4b2d13a1858ab29d6aea60edafdc5bb8/textlinebreaker-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6f2d7ec969244487b0e039e5369d08a642c0c0a414983676641ac728b8e75422",
"md5": "f52975f678e6f0c2d27ca73b9a543a5f",
"sha256": "b5bf513fe7f37561605526527c28886ac372a0226b7c3c7fef8dcb6e26184382"
},
"downloads": -1,
"filename": "textlinebreaker-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "f52975f678e6f0c2d27ca73b9a543a5f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 5349,
"upload_time": "2024-04-20T19:11:25",
"upload_time_iso_8601": "2024-04-20T19:11:25.163025Z",
"url": "https://files.pythonhosted.org/packages/6f/2d/7ec969244487b0e039e5369d08a642c0c0a414983676641ac728b8e75422/textlinebreaker-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-20 19:11:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "scalvaruso",
"github_project": "textlinebreaker",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "textlinebreaker"
}