Layout text automatically using classes
Project description
KanTeX
KanTeX is a library that allow you to layout and format text using python. It is mainly intended to be used with Telegram Userbots and Bots.
KanTeX defaults to markdown but can be switched to using html by using from kantex.html import *. To be explicit about using Markdown, from kantex.md import * can be used.
Examples
from kantex.md import *
doc = KanTeXDocument(
Section('A Section',
Italic('A italic Text'),
Mention('Telegram', 777000)))
print(doc)
Result:
**A Section**
__A italic Text__
[Telegram](tg://user?id=777000)
from kantex.html import *
doc = KanTeXDocument(
Section('A Section',
Italic('A italic Text'),
Mention('Telegram', 777000)))
print(doc)
Result:
<b>A Section</b>
<i>A italic Text</i>
<a href="tg://user?id=777000">Telegram</a>
from kantex.md import *
doc = KanTeXDocument()
for i in range(5):
sec = Section(f'Section {i}')
for n in range(2):
sec.append(KeyValueItem(i, n))
doc.append(sec)
print(doc)
Result:
**Section 0**
0: 0
0: 1
**Section 1**
1: 0
1: 1
**Section 2**
2: 0
2: 1
**Section 3**
3: 0
3: 1
**Section 4**
4: 0
4: 1
from kantex import *
doc = KanTeXDocument(
Section('Nested',
SubSection('Sections',
Italic('work too'))))
print(doc)
Result:
**Nested**
**Sections**
__work too__
Project details
Release history Release notifications | RSS feed
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 kantex-0.2.0.tar.gz.
File metadata
- Download URL: kantex-0.2.0.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77742cd70f38e0ea71eca601c98f3c2d044cbd9bf9088a6e3b418667f619187a
|
|
| MD5 |
20e1530a1693fce0ecface1d9c5d306f
|
|
| BLAKE2b-256 |
a4d5c129c60d2680347d80252d2969af0e318599454e6391f78c7ea968df78fc
|
File details
Details for the file kantex-0.2.0-py3-none-any.whl.
File metadata
- Download URL: kantex-0.2.0-py3-none-any.whl
- Upload date:
- Size: 13.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af26c41577d621311386fbb422dba847e92e9f0ed701f402b2d6184e7f409b98
|
|
| MD5 |
88cb6cc9f64b57dd709416a0dc27fa92
|
|
| BLAKE2b-256 |
dd3426e1b7e766e96d0a5b1dc8a22b8e1f4c7857ae6df4f083ea6c67ca43522d
|