loopstring 0.1.0__py3-none-any.whl → 0.2.0__py3-none-any.whl
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.
- loopstring/loopstring.py +165 -1
- {loopstring-0.1.0.dist-info → loopstring-0.2.0.dist-info}/METADATA +1 -1
- loopstring-0.2.0.dist-info/RECORD +6 -0
- loopstring-0.1.0.dist-info/RECORD +0 -6
- {loopstring-0.1.0.dist-info → loopstring-0.2.0.dist-info}/WHEEL +0 -0
- {loopstring-0.1.0.dist-info → loopstring-0.2.0.dist-info}/top_level.txt +0 -0
loopstring/loopstring.py
CHANGED
|
@@ -56,7 +56,6 @@ class BOXES:
|
|
|
56
56
|
box.append(f"{g['bl']}{g['h'] * (max_width + 2)}{g['br']}")
|
|
57
57
|
return '\n'.join(box)
|
|
58
58
|
|
|
59
|
-
# 🚀 NEW SHORTCUTS FOR VERSION 0.0.5 🚀
|
|
60
59
|
@staticmethod
|
|
61
60
|
def rounded(text: str) -> str:
|
|
62
61
|
"""Shortcut to draw a rounded box."""
|
|
@@ -119,3 +118,168 @@ class SYMBOLS:
|
|
|
119
118
|
LOOP_SINGLE = '➰︎' # U+27B0 - Light curly loop curl
|
|
120
119
|
LOOP_DOUBLE = '➿︎' # U+27BF - Double curly loop hook
|
|
121
120
|
LOOP_REFRESH = '⥁' # U+2941 - Circular reload sequence
|
|
121
|
+
|
|
122
|
+
SCALES = '⚖'
|
|
123
|
+
|
|
124
|
+
class DIVIDERS:
|
|
125
|
+
@staticmethod
|
|
126
|
+
def draw_divider(text, style="box"):
|
|
127
|
+
if style == "box":
|
|
128
|
+
return(f"▌[{text}]▐")
|
|
129
|
+
elif style == "server":
|
|
130
|
+
return(f"╽ {text} ╿")
|
|
131
|
+
elif style == "pixel":
|
|
132
|
+
return(f"▀▄ {text} ▄▀")
|
|
133
|
+
elif style == "shade":
|
|
134
|
+
return(f"░▒▓█ {text} █▓▒░")
|
|
135
|
+
elif style == "angle_bracket":
|
|
136
|
+
return(f"❬ {text} ❭")
|
|
137
|
+
elif style == "boxed":
|
|
138
|
+
return(f"┍[ {text} ]┑")
|
|
139
|
+
elif style == "bullet":
|
|
140
|
+
return(f"⁌ {text} ⁍")
|
|
141
|
+
elif style == "dotted_line":
|
|
142
|
+
return(f"⁞ {text} ⁞")
|
|
143
|
+
elif style == "mini_triangle":
|
|
144
|
+
return(f"◂ {text} ▸")
|
|
145
|
+
elif style == "science":
|
|
146
|
+
return(f"⚗⚛ {text} ⚛⚗")
|
|
147
|
+
|
|
148
|
+
class MULTI_INPUT_MATRICES:
|
|
149
|
+
@staticmethod
|
|
150
|
+
def draw_matrix(text1, text2, text3, matrixType="square"):
|
|
151
|
+
"""
|
|
152
|
+
Draws matrices with three text parameters.
|
|
153
|
+
Available in 3 styles:
|
|
154
|
+
- Square
|
|
155
|
+
- Rounded
|
|
156
|
+
- Curly
|
|
157
|
+
"""
|
|
158
|
+
# Combine inputs to find the maximum string length efficiently
|
|
159
|
+
texts = [text1, text2, text3]
|
|
160
|
+
biggestLength = max(len(t) for t in texts)
|
|
161
|
+
|
|
162
|
+
# Dynamically pad each text string to match the longest one
|
|
163
|
+
padded_texts = [t.ljust(biggestLength) for t in texts]
|
|
164
|
+
|
|
165
|
+
if matrixType == "square":
|
|
166
|
+
# Brackets now dynamically scale based on the largest input width
|
|
167
|
+
topBracket = "⎡ " + padded_texts[0] + " ⎤"
|
|
168
|
+
middleBracket = "⎢ " + padded_texts[1] + " ⎥"
|
|
169
|
+
bottomBracket = "⎣ " + padded_texts[2] + " ⎦"
|
|
170
|
+
elif matrixType == "rounded":
|
|
171
|
+
topBracket = "⎧ " + padded_texts[0] + " ⎫"
|
|
172
|
+
middleBracket = "⎪ " + padded_texts[1] + " ⎪"
|
|
173
|
+
bottomBracket = "⎩ " + padded_texts[2] + " ⎭"
|
|
174
|
+
elif matrixType == "curly":
|
|
175
|
+
topBracket = "⎧ " + padded_texts[0] + " ⎫"
|
|
176
|
+
middleBracket = "⎨ " + padded_texts[1] + " ⎬"
|
|
177
|
+
bottomBracket = "⎩ " + padded_texts[2] + " ⎭"
|
|
178
|
+
|
|
179
|
+
return topBracket + "\n" + middleBracket + "\n" + bottomBracket + "\n"
|
|
180
|
+
|
|
181
|
+
class MATRICES:
|
|
182
|
+
@staticmethod
|
|
183
|
+
def draw_matrix(text, matrixType="square"):
|
|
184
|
+
"""
|
|
185
|
+
Draws matrices with one text parameter.
|
|
186
|
+
Available in 3 styles:
|
|
187
|
+
- Square
|
|
188
|
+
- Rounded
|
|
189
|
+
- Curly
|
|
190
|
+
"""
|
|
191
|
+
textLength = 0
|
|
192
|
+
textLength = len(text)
|
|
193
|
+
if matrixType == "square":
|
|
194
|
+
topBracket = "⎡" + ((" " * textLength) + " ") + "⎤"
|
|
195
|
+
middleBracket = "⎢" + (" " + text + " ") + "⎥"
|
|
196
|
+
bottomBracket = "⎣" + ((" " * textLength) + " ") + "⎦"
|
|
197
|
+
elif matrixType == "rounded":
|
|
198
|
+
topBracket = "⎧" + ((" " * textLength) + " ") + "⎫"
|
|
199
|
+
middleBracket = "⎪" + (" " + text + " ") + "⎪"
|
|
200
|
+
bottomBracket = "⎩" + ((" " * textLength) + " ") + "⎭"
|
|
201
|
+
elif matrixType == "curly":
|
|
202
|
+
topBracket = "⎧" + ((" " * textLength) + " ") + "⎫"
|
|
203
|
+
middleBracket = "⎨" + (" " + text + " ") + "⎬"
|
|
204
|
+
bottomBracket = "⎩" + ((" " * textLength) + " ") + "⎭"
|
|
205
|
+
|
|
206
|
+
return((topBracket + "\n") + (middleBracket + "\n") + (bottomBracket + "\n"))
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
class WRITEDOWN:
|
|
210
|
+
def format_writedown(writedown_text):
|
|
211
|
+
"""
|
|
212
|
+
Parses standard Writedown (a Markdown modification) syntax string formatting loops and translates
|
|
213
|
+
them directly into terminal screen Colorama escape styles.
|
|
214
|
+
"""
|
|
215
|
+
lines = writedown_text.split(r"\n") # Splits text lines accurately
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
for line in lines:
|
|
220
|
+
processed_line = line.strip()
|
|
221
|
+
|
|
222
|
+
# 1. Parse # Headers -> Bright Cyan Bold
|
|
223
|
+
if processed_line.startswith("# "):
|
|
224
|
+
processed_line = "\033[36m" + "\033[1m" + "▶ " + processed_line[2:].upper()
|
|
225
|
+
# 2. Parse ## and ### Headers -> Bright White Bold
|
|
226
|
+
elif processed_line.startswith("## "):
|
|
227
|
+
processed_line = "\033[36m" + "\033[1m" + "▷ " + processed_line[3:]
|
|
228
|
+
elif processed_line.startswith("### "):
|
|
229
|
+
processed_line = "\033[37m" + "‣ " + processed_line[4:]
|
|
230
|
+
# 3. Parse * Bullet points -> Green Bullet Indent
|
|
231
|
+
elif processed_line.startswith("* "):
|
|
232
|
+
processed_line = " " + "\033[32m" + "• " + "\033[37m" + processed_line[2:]
|
|
233
|
+
elif processed_line.startswith("- "):
|
|
234
|
+
processed_line = " " + "\033[32m" + "- " + "\033[37m" + processed_line[2:]
|
|
235
|
+
elif processed_line.startswith("> "):
|
|
236
|
+
processed_line = " " + "\033[33m" + "‣ " + "\033[37m" + processed_line[2:]
|
|
237
|
+
elif processed_line.startswith("1. "):
|
|
238
|
+
processed_line = " " + "\033[31m" + "1. " + "\033[37m" + processed_line[3:]
|
|
239
|
+
elif processed_line.startswith("2. "):
|
|
240
|
+
processed_line = " " + "\033[31m" + "2. " + "\033[37m" + processed_line[3:]
|
|
241
|
+
elif processed_line.startswith("3. "):
|
|
242
|
+
processed_line = " " + "\033[31m" + "3. " + "\033[37m" + processed_line[3:]
|
|
243
|
+
elif processed_line.startswith("4. "):
|
|
244
|
+
processed_line = " " + "\033[31m" + "4. " + "\033[37m" + processed_line[3:]
|
|
245
|
+
elif processed_line.startswith("5. "):
|
|
246
|
+
processed_line = " " + "\033[31m" + "5. " + "\033[37m" + processed_line[3:]
|
|
247
|
+
elif processed_line.startswith("6. "):
|
|
248
|
+
processed_line = " " + "\033[31m" + "6. " + "\033[37m" + processed_line[3:]
|
|
249
|
+
elif processed_line.startswith("7. "):
|
|
250
|
+
processed_line = " " + "\033[31m" + "7. " + "\033[37m" + processed_line[3:]
|
|
251
|
+
elif processed_line.startswith("8. "):
|
|
252
|
+
processed_line = " " + "\033[31m" + "8. " + "\033[37m" + processed_line[3:]
|
|
253
|
+
elif processed_line.startswith("9. "):
|
|
254
|
+
processed_line = " " + "\033[31m" + "9. " + "\033[37m" + processed_line[3:]
|
|
255
|
+
elif processed_line.startswith("10. "):
|
|
256
|
+
processed_line = " " + "\033[31m" + "10. " + "\033[37m" + processed_line[4:]
|
|
257
|
+
|
|
258
|
+
# 4. Parse Inline **Bold** markers using colorama replacements
|
|
259
|
+
while "**" in processed_line:
|
|
260
|
+
processed_line = processed_line.replace("**", "\033[33m" + "\033[1m", 1).replace("**", "\033[0m" + "\033[37m", 1)
|
|
261
|
+
|
|
262
|
+
# 5. Parse Inline *Italic* markers (we can use Underline style for italics in terminal layouts)
|
|
263
|
+
while "*" in processed_line:
|
|
264
|
+
processed_line = processed_line.replace("*", "\033[4m", 1).replace("*", "\033[24m", 1)
|
|
265
|
+
|
|
266
|
+
# 6. Parse Inline `Code` markers -> Magenta text style
|
|
267
|
+
while "`" in processed_line:
|
|
268
|
+
processed_line = processed_line.replace("`", "\033[35m", 1).replace("`", "\033[37m", 1)
|
|
269
|
+
|
|
270
|
+
while "=Y=" in processed_line:
|
|
271
|
+
processed_line = processed_line.replace("=Y=", "\033[43m", 1).replace("=Y=", "\033[0m", 1)
|
|
272
|
+
|
|
273
|
+
while "=R=" in processed_line:
|
|
274
|
+
processed_line = processed_line.replace("=R=", "\033[41m", 1).replace("=R=", "\033[0m", 1)
|
|
275
|
+
|
|
276
|
+
while "=G=" in processed_line:
|
|
277
|
+
processed_line = processed_line.replace("=G=", "\033[42m", 1).replace("=G=", "\033[0m", 1)
|
|
278
|
+
|
|
279
|
+
while "=C=" in processed_line:
|
|
280
|
+
processed_line = processed_line.replace("=C=", "\033[46m", 1).replace("=C=", "\033[0m", 1)
|
|
281
|
+
|
|
282
|
+
while "=B=" in processed_line:
|
|
283
|
+
processed_line = processed_line.replace("=B=", "\033[44m", 1).replace("=B=", "\033[0m", 1)
|
|
284
|
+
|
|
285
|
+
return("\033[0m" + processed_line + "\033[0m")
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
loopstring/__init__.py,sha256=JwlaxgSNMrKB5FLZZf9R3p38hHjeJ8JlqhZmrYUHmeA,109
|
|
2
|
+
loopstring/loopstring.py,sha256=Jd2Zsxy5NVEr7os-dlsNDqVh28zWjk_5ZSIfFTRNdQQ,12122
|
|
3
|
+
loopstring-0.2.0.dist-info/METADATA,sha256=d-NbHV_1eD9t8zLCu-X1ot3na8O23LkDiVwYOdfsJ9g,1493
|
|
4
|
+
loopstring-0.2.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
|
|
5
|
+
loopstring-0.2.0.dist-info/top_level.txt,sha256=2ydcZBVjxIoTy9e7zFiQFH3LMMAGVBh6iPbdCfKdtqo,11
|
|
6
|
+
loopstring-0.2.0.dist-info/RECORD,,
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
loopstring/__init__.py,sha256=JwlaxgSNMrKB5FLZZf9R3p38hHjeJ8JlqhZmrYUHmeA,109
|
|
2
|
-
loopstring/loopstring.py,sha256=67fOYFq2tKHB7J5l9FlqZixyeXfzDdwBoGPsj_M-Pdc,4275
|
|
3
|
-
loopstring-0.1.0.dist-info/METADATA,sha256=hRQ_oB2kHU55In7fYIf7P6wIZ38xCsGiwnKE304p5w8,1493
|
|
4
|
-
loopstring-0.1.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
|
|
5
|
-
loopstring-0.1.0.dist-info/top_level.txt,sha256=2ydcZBVjxIoTy9e7zFiQFH3LMMAGVBh6iPbdCfKdtqo,11
|
|
6
|
-
loopstring-0.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|