txtwrap 2.3.1__tar.gz → 2.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,18 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: txtwrap
3
- Version: 2.3.1
3
+ Version: 2.3.2
4
4
  Summary: A tool for wrapping and filling text.
5
5
  Home-page: https://github.com/azzammuhyala/txtwrap
6
6
  Author: azzammuhyala
7
7
  Author-email: azzammuhyala@gmail.com
8
8
  License: MIT
9
9
  Keywords: wrap,wrapper,wrapping,wrapped,text wrap,text wrapper,text wrapping,text wrapped
10
+ Classifier: Programming Language :: Python
10
11
  Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.3
11
13
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
12
- Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Topic :: Text Processing
15
+ Classifier: Topic :: Text Processing :: Filters
13
16
  Requires-Python: >=3.3
14
17
  Description-Content-Type: text/markdown
15
18
  Dynamic: author
@@ -26,15 +29,19 @@ Dynamic: summary
26
29
  # TxTWrap🔡
27
30
  A tool for wrapping and filling text.🔨
28
31
 
29
- - `LOREM_IPSUM_WORDS`
30
- - `LOREM_IPSUM_SENTENCES`
31
- - `LOREM_IPSUM_PARAGRAPHS`
32
- - `TextWrapper` (❇️ Fixed)
33
- - `sanitize`
34
- - `wrap`
35
- - `align`
36
- - `fillstr`
37
- - `shorten`
32
+ Version: **2.3.2** <br>
33
+ Python requires version: **3.3.0+** <br>
34
+ Python stub file requires version: **3.8.0+**
35
+
36
+ - [`LOREM_IPSUM_WORDS`](#lorem-ipsum)
37
+ - [`LOREM_IPSUM_SENTENCES`](#lorem-ipsum)
38
+ - [`LOREM_IPSUM_PARAGRAPHS`](#lorem-ipsum)
39
+ - [`TextWrapper`](#textwrapper) (🔨 Fixed)
40
+ - [`sanitize`](#sanitizetext)
41
+ - [`wrap`](#wraptext-return_detailsfalse)
42
+ - [`align`](#aligntext-return_detailsfalse)
43
+ - [`fillstr`](#fillstrtext)
44
+ - [`shorten`](#shortentext)
38
45
 
39
46
  # Documents📄
40
47
  This module is inspired by the [`textwrap`](https://docs.python.org/3/library/textwrap.html) module, which provides
@@ -42,17 +49,18 @@ several useful functions, along with the [`TextWrapper`](#textwrapper), class th
42
49
 
43
50
  The difference between [`txtwrap`](https://pypi.org/project/txtwrap) and
44
51
  [`textwrap`](https://docs.python.org/3/library/textwrap.html) is that this module is designed not only for wrapping and
45
- filling monospace fonts but also for other font types, such as Arial, Times New Roman, and more.
52
+ filling _monospace fonts_ but also for other font types, such as _Arial_, _Times New Roman_, and more.
46
53
 
47
54
  <h1></h1>
48
55
 
56
+ ## Lorem ipsum
49
57
  ```py
50
58
  LOREM_IPSUM_WORDS
51
59
  LOREM_IPSUM_SENTENCES
52
60
  LOREM_IPSUM_PARAGRAPHS
53
61
  ```
54
- A collection of words, sentences, and paragraphs that can be used as examples.
55
- - `LOREM_IPSUM_WORDS` contains a short Lorem Ipsum sentence.
62
+ A _Lorem Ipsum_ collection of words, sentences, and paragraphs that can be used as examples.
63
+ - `LOREM_IPSUM_WORDS` contains a short sentence.
56
64
  - `LOREM_IPSUM_SENTENCES` contains a slightly longer paragraph.
57
65
  - `LOREM_IPSUM_PARAGRAPHS` contains several longer paragraphs.
58
66
 
@@ -109,15 +117,14 @@ as each attribute has type checking, which may reduce performance.
109
117
  <h1></h1>
110
118
 
111
119
  #### **`method`**
112
- (Default: `'word'`) The wrapping method. Available options: `'mono'` and `'word'`.
120
+ (Default: `'word'`) The wrapping method. Available options:
113
121
  - `'mono'` method wraps text character by character.
114
122
  - `'word'` method wraps text word by word.
115
123
 
116
124
  <h1></h1>
117
125
 
118
126
  #### **`alignment`**
119
- (Default: `'left'`) The alignment of the wrapped text. Available options: `'left'`, `'center'`, `'right'`,
120
- (`'fill'` or `'fill-left'`), `'fill-center'`, and `'fill-right'`.
127
+ (Default: `'left'`) The alignment of the wrapped text. Available options:
121
128
  - `'left'`: Aligns text to the start of the line.
122
129
  - `'center'`: Centers text within the line.
123
130
  - `'right'`: Aligns text to the end of the line.
@@ -142,7 +149,7 @@ as each attribute has type checking, which may reduce performance.
142
149
  (Default: `None`) The character used to separate words.
143
150
  - `None`: Uses whitespace as the separator.
144
151
  - `str`: Uses the specified character.
145
- - `Iterable`: Uses multiple specified characters.
152
+ - `Iterable[str]`: Uses multiple specified characters.
146
153
 
147
154
  <h1></h1>
148
155
 
@@ -189,6 +196,8 @@ If the function calculates only the width, it must return a single value of type
189
196
 
190
197
  ### Methods of [`TextWrapper`](#textwrapper):
191
198
 
199
+ > Note: All methods can be called outside the [`TextWrapper`](#textwrapper) like external functions.
200
+
192
201
  <h1></h1>
193
202
 
194
203
  #### **`copy`**
@@ -202,7 +211,7 @@ character.
202
211
 
203
212
  For example:
204
213
  ```py
205
- >>> TextWrapper().sanitize("\tHello World! ")
214
+ >>> TextWrapper().sanitize("\tHello \nWorld!\r ")
206
215
  'Hello World!'
207
216
  ```
208
217
 
@@ -211,7 +220,7 @@ For example:
211
220
  #### **`wrap(text, return_details=False)`**
212
221
  Returns a list of wrapped text strings. If `return_details=True`, returns a dictionary containing:
213
222
  - `'wrapped'`: A list of wrapped text fragments.
214
- - `'indiced'`: A set of indices marking line breaks (starting from `0`, like programming indices).
223
+ - `'indiced'`: A set of indices marking the end of line (starting from `0`, like programming indices).
215
224
 
216
225
  For example:
217
226
  ```py
@@ -224,7 +233,7 @@ For example:
224
233
  <h1></h1>
225
234
 
226
235
  #### **`align(text, return_details=False)`**
227
- Returns a list of tuples, where each tuple contains `(x, y, text)`, representing the wrapped text along with its
236
+ Returns a list of tuples, where each tuple contains `(xPosition, yPosition, text)`, representing the wrapped text along with its
228
237
  coordinates.
229
238
  > Note: [`sizefunc`](#sizefunc) must return both width and height.
230
239
 
@@ -247,7 +256,7 @@ For example:
247
256
 
248
257
  #### **`fillstr(text)`**
249
258
  Returns a string with wrapped text formatted for monospace fonts.
250
- > Note: [`width`](#width), [`line_padding`](#line_padding), and the output of [`sizefunc`](#sizefunc) must return `int`,
259
+ > Note: [`width`](#width), [`line_padding`](#line_padding), and the output of [`sizefunc`](#sizefunc) (size or just length) must return `int`,
251
260
  not `float`!
252
261
 
253
262
  For example:
@@ -1,15 +1,19 @@
1
1
  # TxTWrap🔡
2
2
  A tool for wrapping and filling text.🔨
3
3
 
4
- - `LOREM_IPSUM_WORDS`
5
- - `LOREM_IPSUM_SENTENCES`
6
- - `LOREM_IPSUM_PARAGRAPHS`
7
- - `TextWrapper` (❇️ Fixed)
8
- - `sanitize`
9
- - `wrap`
10
- - `align`
11
- - `fillstr`
12
- - `shorten`
4
+ Version: **2.3.2** <br>
5
+ Python requires version: **3.3.0+** <br>
6
+ Python stub file requires version: **3.8.0+**
7
+
8
+ - [`LOREM_IPSUM_WORDS`](#lorem-ipsum)
9
+ - [`LOREM_IPSUM_SENTENCES`](#lorem-ipsum)
10
+ - [`LOREM_IPSUM_PARAGRAPHS`](#lorem-ipsum)
11
+ - [`TextWrapper`](#textwrapper) (🔨 Fixed)
12
+ - [`sanitize`](#sanitizetext)
13
+ - [`wrap`](#wraptext-return_detailsfalse)
14
+ - [`align`](#aligntext-return_detailsfalse)
15
+ - [`fillstr`](#fillstrtext)
16
+ - [`shorten`](#shortentext)
13
17
 
14
18
  # Documents📄
15
19
  This module is inspired by the [`textwrap`](https://docs.python.org/3/library/textwrap.html) module, which provides
@@ -17,17 +21,18 @@ several useful functions, along with the [`TextWrapper`](#textwrapper), class th
17
21
 
18
22
  The difference between [`txtwrap`](https://pypi.org/project/txtwrap) and
19
23
  [`textwrap`](https://docs.python.org/3/library/textwrap.html) is that this module is designed not only for wrapping and
20
- filling monospace fonts but also for other font types, such as Arial, Times New Roman, and more.
24
+ filling _monospace fonts_ but also for other font types, such as _Arial_, _Times New Roman_, and more.
21
25
 
22
26
  <h1></h1>
23
27
 
28
+ ## Lorem ipsum
24
29
  ```py
25
30
  LOREM_IPSUM_WORDS
26
31
  LOREM_IPSUM_SENTENCES
27
32
  LOREM_IPSUM_PARAGRAPHS
28
33
  ```
29
- A collection of words, sentences, and paragraphs that can be used as examples.
30
- - `LOREM_IPSUM_WORDS` contains a short Lorem Ipsum sentence.
34
+ A _Lorem Ipsum_ collection of words, sentences, and paragraphs that can be used as examples.
35
+ - `LOREM_IPSUM_WORDS` contains a short sentence.
31
36
  - `LOREM_IPSUM_SENTENCES` contains a slightly longer paragraph.
32
37
  - `LOREM_IPSUM_PARAGRAPHS` contains several longer paragraphs.
33
38
 
@@ -84,15 +89,14 @@ as each attribute has type checking, which may reduce performance.
84
89
  <h1></h1>
85
90
 
86
91
  #### **`method`**
87
- (Default: `'word'`) The wrapping method. Available options: `'mono'` and `'word'`.
92
+ (Default: `'word'`) The wrapping method. Available options:
88
93
  - `'mono'` method wraps text character by character.
89
94
  - `'word'` method wraps text word by word.
90
95
 
91
96
  <h1></h1>
92
97
 
93
98
  #### **`alignment`**
94
- (Default: `'left'`) The alignment of the wrapped text. Available options: `'left'`, `'center'`, `'right'`,
95
- (`'fill'` or `'fill-left'`), `'fill-center'`, and `'fill-right'`.
99
+ (Default: `'left'`) The alignment of the wrapped text. Available options:
96
100
  - `'left'`: Aligns text to the start of the line.
97
101
  - `'center'`: Centers text within the line.
98
102
  - `'right'`: Aligns text to the end of the line.
@@ -117,7 +121,7 @@ as each attribute has type checking, which may reduce performance.
117
121
  (Default: `None`) The character used to separate words.
118
122
  - `None`: Uses whitespace as the separator.
119
123
  - `str`: Uses the specified character.
120
- - `Iterable`: Uses multiple specified characters.
124
+ - `Iterable[str]`: Uses multiple specified characters.
121
125
 
122
126
  <h1></h1>
123
127
 
@@ -164,6 +168,8 @@ If the function calculates only the width, it must return a single value of type
164
168
 
165
169
  ### Methods of [`TextWrapper`](#textwrapper):
166
170
 
171
+ > Note: All methods can be called outside the [`TextWrapper`](#textwrapper) like external functions.
172
+
167
173
  <h1></h1>
168
174
 
169
175
  #### **`copy`**
@@ -177,7 +183,7 @@ character.
177
183
 
178
184
  For example:
179
185
  ```py
180
- >>> TextWrapper().sanitize("\tHello World! ")
186
+ >>> TextWrapper().sanitize("\tHello \nWorld!\r ")
181
187
  'Hello World!'
182
188
  ```
183
189
 
@@ -186,7 +192,7 @@ For example:
186
192
  #### **`wrap(text, return_details=False)`**
187
193
  Returns a list of wrapped text strings. If `return_details=True`, returns a dictionary containing:
188
194
  - `'wrapped'`: A list of wrapped text fragments.
189
- - `'indiced'`: A set of indices marking line breaks (starting from `0`, like programming indices).
195
+ - `'indiced'`: A set of indices marking the end of line (starting from `0`, like programming indices).
190
196
 
191
197
  For example:
192
198
  ```py
@@ -199,7 +205,7 @@ For example:
199
205
  <h1></h1>
200
206
 
201
207
  #### **`align(text, return_details=False)`**
202
- Returns a list of tuples, where each tuple contains `(x, y, text)`, representing the wrapped text along with its
208
+ Returns a list of tuples, where each tuple contains `(xPosition, yPosition, text)`, representing the wrapped text along with its
203
209
  coordinates.
204
210
  > Note: [`sizefunc`](#sizefunc) must return both width and height.
205
211
 
@@ -222,7 +228,7 @@ For example:
222
228
 
223
229
  #### **`fillstr(text)`**
224
230
  Returns a string with wrapped text formatted for monospace fonts.
225
- > Note: [`width`](#width), [`line_padding`](#line_padding), and the output of [`sizefunc`](#sizefunc) must return `int`,
231
+ > Note: [`width`](#width), [`line_padding`](#line_padding), and the output of [`sizefunc`](#sizefunc) (size or just length) must return `int`,
226
232
  not `float`!
227
233
 
228
234
  For example:
@@ -5,7 +5,7 @@ with open('README.md', encoding='utf-8') as readme:
5
5
 
6
6
  setup(
7
7
  name='txtwrap',
8
- version='2.3.1',
8
+ version='2.3.2',
9
9
  description='A tool for wrapping and filling text.',
10
10
  long_description=long_description,
11
11
  long_description_content_type='text/markdown',
@@ -18,8 +18,11 @@ setup(
18
18
  include_package_data=True,
19
19
  keywords=['wrap', 'wrapper', 'wrapping', 'wrapped', 'text wrap', 'text wrapper', 'text wrapping', 'text wrapped'],
20
20
  classifiers=[
21
+ 'Programming Language :: Python',
21
22
  'Programming Language :: Python :: 3',
23
+ 'Programming Language :: Python :: 3.3',
22
24
  'Topic :: Software Development :: Libraries :: Python Modules',
23
- 'License :: OSI Approved :: MIT License'
25
+ 'Topic :: Text Processing',
26
+ 'Topic :: Text Processing :: Filters'
24
27
  ]
25
28
  )
@@ -1,16 +1,14 @@
1
+ """
2
+ Internal txtwrap module
3
+ """
4
+
1
5
  from collections.abc import Iterable
2
6
  from re import compile, escape
3
7
 
4
8
  # Tools ----------------------------------------------------------------------------------------------------------------
5
9
 
6
10
  pdict = type('pdict', (dict,), {
7
- '__repr__': lambda self : '{}({{\n {}\n}})'.format(
8
- self.__class__.__name__,
9
- ',\n '.join(
10
- '{!r}: {!r}'.format(key, value)
11
- for key, value in self.items()
12
- )
13
- ) if self else self.__class__.__name__ + '()',
11
+ '__repr__': lambda self : '{}({})'.format(self.__class__.__name__, dict.__repr__(self)),
14
12
  '__setattr__': dict.__setitem__,
15
13
  '__getattr__': lambda self, key: self.get(key, None),
16
14
  '__delattr__': dict.__delitem__
@@ -51,7 +49,7 @@ def word(text, width, fillchar, break_on_hyphens, lenfunc, sanitize, split_separ
51
49
 
52
50
  if break_on_hyphens:
53
51
  for part in split_hyphenated(word):
54
- for wrapped_part in mono(part, width, 0, 0, lenfunc, sanitize, 0):
52
+ for wrapped_part in mono(part, width, None, None, lenfunc, sanitize, None):
55
53
  if lenfunc(current_line + wrapped_part) <= width:
56
54
  current_line += wrapped_part
57
55
  else:
@@ -59,7 +57,7 @@ def word(text, width, fillchar, break_on_hyphens, lenfunc, sanitize, split_separ
59
57
  wrapped.append(current_line)
60
58
  current_line = wrapped_part
61
59
  else:
62
- for part in mono(word, width, 0, 0, lenfunc, sanitize, 0):
60
+ for part in mono(word, width, None, None, lenfunc, sanitize, None):
63
61
  if lenfunc(current_line + part) <= width:
64
62
  current_line += part
65
63
  else:
@@ -94,7 +92,7 @@ def justify_fillstr_right(justified_lines, text, width, text_width, fillchar):
94
92
 
95
93
  # Identities -----------------------------------------------------------------------------------------------------------
96
94
 
97
- __version__ = '2.3.1'
95
+ __version__ = '2.3.2'
98
96
  __author__ = 'azzammuhyala'
99
97
  __license__ = 'MIT'
100
98
 
@@ -135,7 +133,7 @@ LOREM_IPSUM_PARAGRAPHS = (
135
133
 
136
134
  class TextWrapper:
137
135
 
138
- """ A class for text wrapping. """
136
+ """ Text wrapper class """
139
137
 
140
138
  # Dunder / Magic Methods -------------------------------------------------------------------------------------------
141
139
 
@@ -150,7 +148,8 @@ class TextWrapper:
150
148
  [PyPi](https://pypi.org/project/txtwrap) for details.
151
149
  """
152
150
 
153
- self._d = pdict() # dictionary to store a metadata and private variables
151
+ # dictionary to store a metadata and private variables
152
+ self._d = pdict()
154
153
 
155
154
  self.width = width
156
155
  self.line_padding = line_padding
@@ -327,9 +326,8 @@ class TextWrapper:
327
326
  def max_lines(self, new):
328
327
  if not isinstance(new, (int, type(None))):
329
328
  raise TypeError("max_lines must be an integer or None")
330
- if new is not None:
331
- if new <= 0:
332
- raise ValueError("max_lines must be greater than 0")
329
+ if new is not None and new <= 0:
330
+ raise ValueError("max_lines must be greater than 0")
333
331
  self._d.max_lines = new
334
332
 
335
333
  @preserve_empty.setter
@@ -414,9 +412,9 @@ class TextWrapper:
414
412
  else:
415
413
  max_lines = self._d.max_lines
416
414
 
417
- set_max_lines = max_lines is not None
415
+ has_max_lines = max_lines is not None
418
416
 
419
- if set_max_lines and width < lenfunc(placeholder):
417
+ if has_max_lines and width < lenfunc(placeholder):
420
418
  raise ValueError("width must be greater than length of the placeholder")
421
419
 
422
420
  wrapped = []
@@ -429,15 +427,15 @@ class TextWrapper:
429
427
  wrapped.extend(wrapped_line)
430
428
  lines = len(wrapped)
431
429
 
432
- if set_max_lines and lines <= max_lines:
430
+ if has_max_lines and lines <= max_lines:
433
431
  indiced.add(lines - 1)
434
- elif not set_max_lines:
432
+ elif not has_max_lines:
435
433
  indiced.add(lines - 1)
436
434
 
437
435
  elif preserve_empty:
438
436
  wrapped.append('')
439
437
 
440
- if set_max_lines and len(wrapped) > max_lines:
438
+ if has_max_lines and len(wrapped) > max_lines:
441
439
  current_char = ''
442
440
 
443
441
  for part in wrapped[max_lines - 1]:
@@ -493,10 +491,9 @@ class TextWrapper:
493
491
  no_fill_last_line = not self._d.justify_last_line
494
492
  lines_word = [split_fillchar(line) for line in wrapped]
495
493
 
496
- if minimum_width and any(
497
- len(line) > 1 and not (no_fill_last_line and i in indiced)
498
- for i, line in enumerate(lines_word)
499
- ): use_width = width if wrapped else 0
494
+ if minimum_width and any(len(line) > 1 and not (no_fill_last_line and i in indiced)
495
+ for i, line in enumerate(lines_word)):
496
+ use_width = width if wrapped else 0
500
497
 
501
498
  for i, line in enumerate(wrapped):
502
499
  width_line, height_line = lines_size[i]
@@ -567,10 +564,9 @@ class TextWrapper:
567
564
  no_fill_last_line = not self._d.justify_last_line
568
565
  lines_word = [split_fillchar(line) for line in wrapped]
569
566
 
570
- if minimum_width and any(
571
- len(line) > 1 and not (no_fill_last_line and i in indiced)
572
- for i, line in enumerate(lines_word)
573
- ): use_width = width if wrapped else 0
567
+ if minimum_width and any(len(line) > 1 and not (no_fill_last_line and i in indiced)
568
+ for i, line in enumerate(lines_word)):
569
+ use_width = width if wrapped else 0
574
570
 
575
571
  fill_line_padding = '\n'.join(fillchar * use_width for _ in range(line_padding))
576
572
 
@@ -1,15 +1,18 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: txtwrap
3
- Version: 2.3.1
3
+ Version: 2.3.2
4
4
  Summary: A tool for wrapping and filling text.
5
5
  Home-page: https://github.com/azzammuhyala/txtwrap
6
6
  Author: azzammuhyala
7
7
  Author-email: azzammuhyala@gmail.com
8
8
  License: MIT
9
9
  Keywords: wrap,wrapper,wrapping,wrapped,text wrap,text wrapper,text wrapping,text wrapped
10
+ Classifier: Programming Language :: Python
10
11
  Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.3
11
13
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
12
- Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Topic :: Text Processing
15
+ Classifier: Topic :: Text Processing :: Filters
13
16
  Requires-Python: >=3.3
14
17
  Description-Content-Type: text/markdown
15
18
  Dynamic: author
@@ -26,15 +29,19 @@ Dynamic: summary
26
29
  # TxTWrap🔡
27
30
  A tool for wrapping and filling text.🔨
28
31
 
29
- - `LOREM_IPSUM_WORDS`
30
- - `LOREM_IPSUM_SENTENCES`
31
- - `LOREM_IPSUM_PARAGRAPHS`
32
- - `TextWrapper` (❇️ Fixed)
33
- - `sanitize`
34
- - `wrap`
35
- - `align`
36
- - `fillstr`
37
- - `shorten`
32
+ Version: **2.3.2** <br>
33
+ Python requires version: **3.3.0+** <br>
34
+ Python stub file requires version: **3.8.0+**
35
+
36
+ - [`LOREM_IPSUM_WORDS`](#lorem-ipsum)
37
+ - [`LOREM_IPSUM_SENTENCES`](#lorem-ipsum)
38
+ - [`LOREM_IPSUM_PARAGRAPHS`](#lorem-ipsum)
39
+ - [`TextWrapper`](#textwrapper) (🔨 Fixed)
40
+ - [`sanitize`](#sanitizetext)
41
+ - [`wrap`](#wraptext-return_detailsfalse)
42
+ - [`align`](#aligntext-return_detailsfalse)
43
+ - [`fillstr`](#fillstrtext)
44
+ - [`shorten`](#shortentext)
38
45
 
39
46
  # Documents📄
40
47
  This module is inspired by the [`textwrap`](https://docs.python.org/3/library/textwrap.html) module, which provides
@@ -42,17 +49,18 @@ several useful functions, along with the [`TextWrapper`](#textwrapper), class th
42
49
 
43
50
  The difference between [`txtwrap`](https://pypi.org/project/txtwrap) and
44
51
  [`textwrap`](https://docs.python.org/3/library/textwrap.html) is that this module is designed not only for wrapping and
45
- filling monospace fonts but also for other font types, such as Arial, Times New Roman, and more.
52
+ filling _monospace fonts_ but also for other font types, such as _Arial_, _Times New Roman_, and more.
46
53
 
47
54
  <h1></h1>
48
55
 
56
+ ## Lorem ipsum
49
57
  ```py
50
58
  LOREM_IPSUM_WORDS
51
59
  LOREM_IPSUM_SENTENCES
52
60
  LOREM_IPSUM_PARAGRAPHS
53
61
  ```
54
- A collection of words, sentences, and paragraphs that can be used as examples.
55
- - `LOREM_IPSUM_WORDS` contains a short Lorem Ipsum sentence.
62
+ A _Lorem Ipsum_ collection of words, sentences, and paragraphs that can be used as examples.
63
+ - `LOREM_IPSUM_WORDS` contains a short sentence.
56
64
  - `LOREM_IPSUM_SENTENCES` contains a slightly longer paragraph.
57
65
  - `LOREM_IPSUM_PARAGRAPHS` contains several longer paragraphs.
58
66
 
@@ -109,15 +117,14 @@ as each attribute has type checking, which may reduce performance.
109
117
  <h1></h1>
110
118
 
111
119
  #### **`method`**
112
- (Default: `'word'`) The wrapping method. Available options: `'mono'` and `'word'`.
120
+ (Default: `'word'`) The wrapping method. Available options:
113
121
  - `'mono'` method wraps text character by character.
114
122
  - `'word'` method wraps text word by word.
115
123
 
116
124
  <h1></h1>
117
125
 
118
126
  #### **`alignment`**
119
- (Default: `'left'`) The alignment of the wrapped text. Available options: `'left'`, `'center'`, `'right'`,
120
- (`'fill'` or `'fill-left'`), `'fill-center'`, and `'fill-right'`.
127
+ (Default: `'left'`) The alignment of the wrapped text. Available options:
121
128
  - `'left'`: Aligns text to the start of the line.
122
129
  - `'center'`: Centers text within the line.
123
130
  - `'right'`: Aligns text to the end of the line.
@@ -142,7 +149,7 @@ as each attribute has type checking, which may reduce performance.
142
149
  (Default: `None`) The character used to separate words.
143
150
  - `None`: Uses whitespace as the separator.
144
151
  - `str`: Uses the specified character.
145
- - `Iterable`: Uses multiple specified characters.
152
+ - `Iterable[str]`: Uses multiple specified characters.
146
153
 
147
154
  <h1></h1>
148
155
 
@@ -189,6 +196,8 @@ If the function calculates only the width, it must return a single value of type
189
196
 
190
197
  ### Methods of [`TextWrapper`](#textwrapper):
191
198
 
199
+ > Note: All methods can be called outside the [`TextWrapper`](#textwrapper) like external functions.
200
+
192
201
  <h1></h1>
193
202
 
194
203
  #### **`copy`**
@@ -202,7 +211,7 @@ character.
202
211
 
203
212
  For example:
204
213
  ```py
205
- >>> TextWrapper().sanitize("\tHello World! ")
214
+ >>> TextWrapper().sanitize("\tHello \nWorld!\r ")
206
215
  'Hello World!'
207
216
  ```
208
217
 
@@ -211,7 +220,7 @@ For example:
211
220
  #### **`wrap(text, return_details=False)`**
212
221
  Returns a list of wrapped text strings. If `return_details=True`, returns a dictionary containing:
213
222
  - `'wrapped'`: A list of wrapped text fragments.
214
- - `'indiced'`: A set of indices marking line breaks (starting from `0`, like programming indices).
223
+ - `'indiced'`: A set of indices marking the end of line (starting from `0`, like programming indices).
215
224
 
216
225
  For example:
217
226
  ```py
@@ -224,7 +233,7 @@ For example:
224
233
  <h1></h1>
225
234
 
226
235
  #### **`align(text, return_details=False)`**
227
- Returns a list of tuples, where each tuple contains `(x, y, text)`, representing the wrapped text along with its
236
+ Returns a list of tuples, where each tuple contains `(xPosition, yPosition, text)`, representing the wrapped text along with its
228
237
  coordinates.
229
238
  > Note: [`sizefunc`](#sizefunc) must return both width and height.
230
239
 
@@ -247,7 +256,7 @@ For example:
247
256
 
248
257
  #### **`fillstr(text)`**
249
258
  Returns a string with wrapped text formatted for monospace fonts.
250
- > Note: [`width`](#width), [`line_padding`](#line_padding), and the output of [`sizefunc`](#sizefunc) must return `int`,
259
+ > Note: [`width`](#width), [`line_padding`](#line_padding), and the output of [`sizefunc`](#sizefunc) (size or just length) must return `int`,
251
260
  not `float`!
252
261
 
253
262
  For example:
File without changes
File without changes
File without changes
File without changes