Skip to content

Commit ac3cd43

Browse files
committed
fix: simplify changelog list parsing filter to prevent panflute version compilation error
1 parent 4013bde commit ac3cd43

1 file changed

Lines changed: 7 additions & 16 deletions

File tree

.github/scripts/build/inject_changelog.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -199,24 +199,15 @@ def add_changelog(doc):
199199

200200
# Render a <ul> summary as a real BulletList so it survives in
201201
# every output format; otherwise fall back to plain text.
202-
if sanitized_summary.startswith("<ul>"):
203-
list_items = re.findall(
204-
r"<li>(.*?)</li>", sanitized_summary, re.DOTALL
205-
)
206-
if list_items:
207-
list_items_elements = []
208-
for item in list_items:
209-
clean_item = re.sub(r"<[^>]+>", "", item).strip()
210-
# ListItem expects a list of Block elements
211-
list_item = pf.ListItem(pf.Plain(pf.Str(clean_item)))
212-
list_items_elements.append(list_item)
213-
bullet_list = pf.BulletList(*list_items_elements)
214-
summary_cell = pf.TableCell(bullet_list)
202+
if "<li>" in sanitized_summary:
203+
items = re.findall(r"<li>(.*?)</li>", sanitized_summary, re.DOTALL)
204+
if items:
205+
bulleted = "\n".join(f"• {re.sub(r'<[^>]+>', '', x).strip()}" for x in items)
206+
summary_cell = pf.TableCell(pf.Plain(pf.Str(bulleted)))
215207
else:
216-
clean_summary = re.sub(r"<[^>]+>", "", sanitized_summary)
217-
summary_cell = pf.TableCell(pf.Plain(pf.Str(clean_summary)))
208+
summary_cell = pf.TableCell(pf.Plain(pf.Str(re.sub(r'<[^>]+>', '', sanitized_summary).strip())))
218209
else:
219-
summary_cell = pf.TableCell(pf.Plain(pf.Str(sanitized_summary)))
210+
summary_cell = pf.TableCell(pf.Plain(pf.Str(re.sub(r'<[^>]+>', '', sanitized_summary).strip())))
220211

221212
row = pf.TableRow(date_cell, version_cell, summary_cell)
222213
body_rows.append(row)

0 commit comments

Comments
 (0)