Archived
1
0
Fork 0

Update image_table.py

This commit is contained in:
yzhh 2022-01-07 23:50:43 +08:00
parent aa80c2090b
commit eec737c75d

View file

@ -2,10 +2,12 @@ import os
import re import re
import traceback import traceback
import uuid import uuid
from html import escape
from typing import List, Union from typing import List, Union
import aiohttp import aiohttp
import ujson as json import ujson as json
from tabulate import tabulate from tabulate import tabulate
from config import Config from config import Config
@ -32,7 +34,7 @@ async def image_table_render(table: Union[ImageTable, List[ImageTable]]):
for row in tbl.data: for row in tbl.data:
cs = [] cs = []
for c in row: for c in row:
cs.append(re.sub(r'\n', '<br>', c)) cs.append(escape(c))
d.append(cs) d.append(cs)
w = len(tbl.headers) * 500 w = len(tbl.headers) * 500
if w > max_width: if w > max_width: