Files
test/html_to_django/main.py
T
2024-05-02 17:42:19 +02:00

20 lines
451 B
Python

import bs4
from .formatters import formatters
def main():
with open("test.html", "r") as file:
soup = bs4.BeautifulSoup(file, "html.parser")
for formatter in formatters:
formatter.format(soup)
formatter = bs4.formatter.HTMLFormatter(indent=4)
with open("out.html", "w") as file:
file.write("{% load static %}\n")
file.write(soup.prettify(formatter=formatter))
def command_entry():
print("ok")