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
Copy file name to clipboardExpand all lines: README.md
+82-30Lines changed: 82 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,16 @@
9
9
10
10
---
11
11
12
+
## ✨ Features
13
+
14
+
- Flexible text composition from components
15
+
- Conditional rendering support (`when`)
16
+
- Grouping and repeating blocks
17
+
- Formatting via f-string and Jinja2
18
+
- Easily extensible with new components
19
+
20
+
---
21
+
12
22
## 🚀 Installation
13
23
14
24
You can install the library in two ways:
@@ -26,63 +36,105 @@ pip install textcompose
26
36
27
37
---
28
38
39
+
29
40
## 💻 Usage
30
41
31
42
### Components Overview
32
43
33
-
`TextCompose` provides the following core components:
44
+
#### General
45
+
46
+
-`Template` — combines and renders components as a structured text block.
47
+
48
+
#### Content Blocks
49
+
50
+
-`BaseContent` — abstract base class for all content components
51
+
52
+
53
+
-`Text` — outputs static text
54
+
-`Format` — dynamic formatting via f-string
55
+
-`Jinja` — rendering via Jinja2 templates
34
56
35
-
1.**`Template`**: Combines and renders components as a structured text block.
36
-
2.**`Group`**: Groups multiple components and joins their output with a separator (`sep`).
37
-
3.**`Text`**: Displays static text.
38
-
4.**`Format`**: Formats strings dynamically using a given context.
57
+
#### Containers
39
58
40
-
All components support the `when` parameter for conditional rendering. If `when` evaluates to `True`, the component is rendered; otherwise, it is skipped.
59
+
-`BaseContainer` — abstract base class for containers
41
60
42
-
### Example
43
61
44
-
Below is an example of how to use `TextCompose` to create dynamic text templates with nested components and conditional rendering.
0 commit comments