Skip to main content

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.

Examples

from kantex 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 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kantex-0.1.0.tar.gz (3.4 kB view hashes)

Uploaded source

Built Distributions

kantex-0.1.0-py3.8.egg (9.7 kB view hashes)

Uploaded 3 8

kantex-0.1.0-py3-none-any.whl (7.3 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page