minimal styling

This commit is contained in:
caandt 2024-10-15 20:53:41 -05:00
parent 177152d03a
commit 63f6fc9e7d

View file

@ -37,10 +37,9 @@ def minify(html):
code.string = new code.string = new
tab = True tab = True
code.unwrap() code.unwrap()
if tab: sty = soup.new_tag('style')
tab = soup.new_tag('style') sty.string = '*{tab-size:4;max-width:1000px}' if tab else '*{max-width:1000px}'
tab.string = '*{tab-size:4}' soup.insert(1, sty)
soup.insert(1, tab)
for tag in soup.find_all(True): for tag in soup.find_all(True):
tag.attrs = {k: v for k, v in tag.attrs.items() if k != 'class'} tag.attrs = {k: v for k, v in tag.attrs.items() if k != 'class'}
return minify_html.minify(str(soup)) return minify_html.minify(str(soup))