Helper package to format TeamSpeak BBCode
Project description
TSFormatter
Helper package to format TeamSpeak BBCode
📦 Installation
pip install tsformatter
✏️ Usage
importing the formatter
import tsformatter
Colors
# Using HTML color name
>>> tsformatter.color("red", "This text is red")
'[COLOR=red]This text is red[/COLOR]'
>>> tsformatter.color("PaleTurquoise", "This text is turquoise")
'[COLOR=PaleTurquoise]This text is turquoise[/COLOR]'
# Using Hex Triplet
>>> tsformatter.color("#f00", "This text is red")
'[COLOR=f00]This text is red[/COLOR]'
>>> tsformatter.color("#AFEEEE", "This text is turquoise")
'[COLOR=#AFEEEE]This text is turquoise[/COLOR]'
Horizontal line
>>> tsformatter.hr
'[HR]'
Images
>>> tsformatter.img("https://i.imgur.com/ml09ccU.png")
'[IMG]https://i.imgur.com/ml09ccU.png[/IMG]'
Links
# Without specifying link text
>>> tsformatter.link("https://www.teamspeak.com/")
'[URL]https://www.teamspeak.com/[/URL]'
# With a link text
>>> tsformatter.link("https://www.teamspeak.com/", "TeamSpeak Website")
'[URL=https://www.teamspeak.com/]TeamSpeak Website[/URL]'
Lists
# Default style of the list is bullet list
>>> tsformatter.list_(f"List item #{x}" for x in range(1, 6))
'[LIST]\n[*]List item #1\n[*]List item #2\n[*]List item #3\n[*]List item #4\n[*]List item #5\n[/LIST]'
# You can specify the style of the list
>>> tsformatter.list_((f"List item #{x}" for x in range(1, 6)), style="1")
'[LIST=1]\n[*]List item #1\n[*]List item #2\n[*]List item #3\n[*]List item #4\n[*]List item #5\n[/LIST]'
List styles that work:
| Style | "1" | "a" | "i" | "A" | "I" |
|---|---|---|---|---|---|
| Renders |
Placement
>>> tsformatter.left("Formatted to the left")
'[LEFT]Formatted to the left[/LEFT]'
>>> tsformatter.right("Formatted to the right")
'[RIGHT]Formatted to the right[/RIGHT]'
>>> tsformatter.center("Center of the space")
'[CENTER]Center of the space[/CENTER]'
Size
# Using absolute sizes
>>> tsformatter.size(24, "I am huge!")
'[SIZE=24]I am huge![/SIZE]'
# Relative sizes can be either positive or negative
>>> tsformatter.size('-4', "I am 4 units smaller than the rest")
'[SIZE=-2]I am 2 units smaller than the rest[/SIZE]'
>>> tsformatter.size('+2', "I am 2 units bigger than the rest")
'[SIZE=+2]I am 2 units bigger than the rest[/SIZE]'
Styles
>>> tsformatter.bold("Example text")
'[B]Example text[/B]'
>>> tsformatter.italic("Example text")
'[I]Example text[/I]'
>>> tsformatter.underline("Example text")
'[U]Example text[/U]'
>>> tsformatter.strike("Example text")
'[S]Example text[/S]'
Tables
>>> header = ("Place", "City", "Date")
>>> data1 = ("Statue of Liberty", "New York City", "October 28, 1886")
>>> data2 = ("Eiffel Tower", "Paris", "31 March, 1889")
>>> data3 = ("Big Ben", "London", "31 May, 1859")
>>> tsformatter.table(
tsformatter.table_header_row(header),
tsformatter.table_row(data1),
tsformatter.table_row(data2),
tsformatter.table_row(data3)
)
'[TABLE]\n[TR][TH]Place[/TH][TH]City[/TH][TH]Date[/TH][/TR]\n[TR][TD]Statue of Liberty[/TD][TD]New York City[/TD][TD]October 28, 1886[/TD][/TR]\n[TR][TD]Eiffel Tower[/TD][TD]Paris[/TD][TD]31 March, 1889[/TD][/TR]\n[TR][TD]Big Ben[/TD][TD]London[/TD][TD]31 May, 1859[/TD][/TR]\n[/TABLE]'
Results when rendered by TeamSpeak client:
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tsformatter-0.2.3.tar.gz.
File metadata
- Download URL: tsformatter-0.2.3.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85586cf29d62a4bc1c1e065db879e5729f9d4677c0e799be63a369941c786b69
|
|
| MD5 |
d8b27f11560662306db5138b5ee21bb3
|
|
| BLAKE2b-256 |
cff313622286f0fed2cd250472dd23b3e6f19a3a6826057b3ae3f9369e74b1d6
|
Provenance
The following attestation bundles were made for tsformatter-0.2.3.tar.gz:
Publisher:
publish.yaml on jykob/TSFormatter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tsformatter-0.2.3.tar.gz -
Subject digest:
85586cf29d62a4bc1c1e065db879e5729f9d4677c0e799be63a369941c786b69 - Sigstore transparency entry: 177410202
- Sigstore integration time:
-
Permalink:
jykob/TSFormatter@01bff50712b9a8be43a3fc37885c7644c381c147 -
Branch / Tag:
refs/tags/0.2.3 - Owner: https://github.com/jykob
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@01bff50712b9a8be43a3fc37885c7644c381c147 -
Trigger Event:
release
-
Statement type:
File details
Details for the file tsformatter-0.2.3-py3-none-any.whl.
File metadata
- Download URL: tsformatter-0.2.3-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b23df83c5336b61c6ab3ac5c7e03c7fedb4e95601f268a0f2b78892fb7b8e6e
|
|
| MD5 |
dd963a7303b80a6438b604f2def2747d
|
|
| BLAKE2b-256 |
32bc908d53234ee16ab58abcb6051dc95332d4288e8a2d2f721d292eed79d9c7
|
Provenance
The following attestation bundles were made for tsformatter-0.2.3-py3-none-any.whl:
Publisher:
publish.yaml on jykob/TSFormatter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tsformatter-0.2.3-py3-none-any.whl -
Subject digest:
0b23df83c5336b61c6ab3ac5c7e03c7fedb4e95601f268a0f2b78892fb7b8e6e - Sigstore transparency entry: 177410204
- Sigstore integration time:
-
Permalink:
jykob/TSFormatter@01bff50712b9a8be43a3fc37885c7644c381c147 -
Branch / Tag:
refs/tags/0.2.3 - Owner: https://github.com/jykob
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@01bff50712b9a8be43a3fc37885c7644c381c147 -
Trigger Event:
release
-
Statement type: