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