Modern way to edit and format text.
To install this module, run the following command:
pip install weneda
import asyncio
from weneda import Formatter, placeholder
class MyFormatter(Formatter):
@placeholder(
name="upper",
syntax="upper_<text>",
pattern=r"upper_(?P<text>.*)"
)
async def upper_handler(self, text: str) -> str:
return text.upper()
async def main():
formatter = MyFormatter()
result = await formatter.format("Hello {upper_world}")
print(result) # Hello WORLD
asyncio.run(main())