You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**TextCompose** is a Python library for creating dynamic, structured text templates. Inspired by [aiogram-dialog](https://github.com/Tishka17/aiogram_dialog), it provides a flexible and intuitive interface for composing text.
9
+
**TextCompose** is a Python library for creating dynamic, structured text templates with an intuitive, component-based approach. Inspired by [aiogram-dialog](https://github.com/Tishka17/aiogram_dialog).
10
10
11
11
---
12
12
13
13
## ✨ Features
14
14
15
-
- Flexible text composition from components
16
-
- Conditional rendering support (`when`)
17
-
- Grouping and repeating blocks
18
-
- Formatting via f-string and Jinja2
19
-
- Easily extensible with new components
20
-
21
-
15
+
- 🧱 Flexible text composition from components
16
+
- 🔀 Conditional rendering support (`when`)
17
+
- 🔁 Grouping and repeating blocks
18
+
- 🎨 Formatting via f-string and Jinja2
19
+
- 🔌 Easily extensible with new components
22
20
23
21
## 🚀 Installation
24
22
25
-
You can install the library in two ways:
26
-
27
-
### Using `uv`
28
-
If you are using the `uv` package manager, you can install it as follows:
29
23
```bash
30
24
uv add textcompose
31
-
```
32
-
33
-
### Using `pip`
34
-
```bash
25
+
# or
35
26
pip install textcompose
36
27
```
37
28
29
+
## 🧩 Components Overview
38
30
39
-
## 💻 Usage
40
-
41
-
### Components Overview
42
-
43
-
#### General
31
+
### General
44
32
45
33
-`Template` — main class for combining and rendering components
46
34
47
35
48
-
####Elements
36
+
### Elements
49
37
`Element` — abstract base class for all element components
50
38
51
-
-`Text` — outputs static text
52
-
-`Format` — dynamic formatting via f-string
53
-
-`Jinja` — rendering via Jinja2 templates
39
+
-`Text` — static text.
40
+
-`Format` — dynamic python f-string formatting
41
+
-`Jinja` — Jinja2 template rendering
42
+
-[`ProgressBar`](#progressbar) — show progress visually
54
43
55
-
####Containers
44
+
### Containers
56
45
`Container` — abstract base class for all container components
57
46
58
-
-`Group` — groups child components with a separator
59
-
-`List` — repeats a template for a collection
47
+
-`Group` — group children with custom separators.
48
+
-`List` — repeat templates for each item in a collection.
60
49
61
-
####Logic Components
50
+
### Logic Components
62
51
`Logic` — abstract base class for all container components
Built-in styles are listed in the `PROGRESS_BAR_STYLES` dictionary (see [`textcompose/styles/progress_bar.py`](./textcompose/styles/progress_bar.py)). Examples:
150
+
151
+
-`"symbol_square"`: `[■■■■■ ]`
152
+
-`"symbol_classic"`: `[#####-----]`
153
+
-`"emoj_square"`: `🟩🟩🟩⬜⬜⬜`
154
+
-`"emoji_circle"`: `🟢🟢⚪⚪⚪`
155
+
156
+
You can create a custom style using `ProgressBarStyle`:
0 commit comments