fix(api): Code formatting
This commit is contained in:
@@ -111,9 +111,9 @@ class PDFGenerator(AbstractGenerator):
|
||||
if not img_data:
|
||||
continue
|
||||
|
||||
img_tag[
|
||||
"src"
|
||||
] = f"data:image/jpg;base64,{b64encode(img_data).decode()}"
|
||||
img_tag["src"] = (
|
||||
f"data:image/jpg;base64,{b64encode(img_data).decode()}"
|
||||
)
|
||||
|
||||
data[part["id"]] = tree.prettify()
|
||||
|
||||
@@ -137,9 +137,11 @@ class PDFGenerator(AbstractGenerator):
|
||||
"description": self.story["description"],
|
||||
"avatar": b64encode(self.author).decode(),
|
||||
"copyright": {
|
||||
"data": b64encode(copyright["asset"].read_bytes()).decode()
|
||||
if copyright["asset"]
|
||||
else "",
|
||||
"data": (
|
||||
b64encode(copyright["asset"].read_bytes()).decode()
|
||||
if copyright["asset"]
|
||||
else ""
|
||||
),
|
||||
"name": copyright["name"],
|
||||
},
|
||||
"parts": parts,
|
||||
|
||||
@@ -31,7 +31,7 @@ def clean_tree(title: str, id: int, body: str) -> BeautifulSoup:
|
||||
for child in cast(list[Tag], tag.children):
|
||||
# tag is a <p> enclosing either text, media, or a break
|
||||
|
||||
if child.name in [None, "b", "i", "u","strong","em"]:
|
||||
if child.name in [None, "b", "i", "u", "strong", "em"]:
|
||||
# text is enclosed, can be italic, bold, underlined, or a mix
|
||||
tag.attrs = {}
|
||||
p_tag = tag
|
||||
|
||||
Reference in New Issue
Block a user