Unverified Commit 2c75a375 authored by Xiaomeng Zhao's avatar Xiaomeng Zhao Committed by GitHub

Merge pull request #855 from myhloli/add-structeqtable

feat(model): add HTML minification to StructTableModel
parents dc31c97b b5117e72
import re
import torch
from struct_eqtable import build_model
......@@ -28,4 +30,16 @@ class StructTableModel:
images, output_format=output_format
)
if output_format == "html":
results = [self.minify_html(html) for html in results]
return results
def minify_html(self, html):
# 移除多余的空白字符
html = re.sub(r'\s+', ' ', html)
# 移除行尾的空白字符
html = re.sub(r'\s*>\s*', '>', html)
# 移除标签前的空白字符
html = re.sub(r'\s*<\s*', '<', html)
return html.strip()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment