Files
test/html_to_django/formatters/command_formatter.py
T
2024-05-05 14:31:34 +02:00

8 lines
224 B
Python

from bs4 import BeautifulSoup
def format(soup: BeautifulSoup) -> None:
for element in soup.find_all(attrs={"dj-command": True}):
element.string = f"{{% {element.get("dj-command")} %}}"
element.unwrap()