mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-03 11:47:28 +01:00
Fix missing content_html in JSONFeed
Unfortunately, the only working validator I found can only validate live URLs
This commit is contained in:
parent
9062f49992
commit
b4f9c99717
@ -38,6 +38,10 @@ def _make_feed(title: str, feed_url: str, items: list):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def _render_link(url: str):
|
||||||
|
return f"<p><a href='{url}'>Read more</a></p>"
|
||||||
|
|
||||||
|
|
||||||
def _get_new_packages_feed(feed_url: str) -> dict:
|
def _get_new_packages_feed(feed_url: str) -> dict:
|
||||||
packages = (Package.query
|
packages = (Package.query
|
||||||
.filter(Package.state == PackageState.APPROVED)
|
.filter(Package.state == PackageState.APPROVED)
|
||||||
@ -49,7 +53,8 @@ def _get_new_packages_feed(feed_url: str) -> dict:
|
|||||||
"id": package.get_url("packages.view", absolute=True),
|
"id": package.get_url("packages.view", absolute=True),
|
||||||
"language": "en",
|
"language": "en",
|
||||||
"title": f"New: {package.title}",
|
"title": f"New: {package.title}",
|
||||||
"content_html": render_markdown(package.desc) if package.desc else None,
|
"content_html": render_markdown(package.desc) \
|
||||||
|
if package.desc else _render_link(package.get_url("packages.view", absolute=True)),
|
||||||
"author": {
|
"author": {
|
||||||
"name": package.author.display_name,
|
"name": package.author.display_name,
|
||||||
"avatar": package.author.get_profile_pic_url(absolute=True),
|
"avatar": package.author.get_profile_pic_url(absolute=True),
|
||||||
@ -75,7 +80,8 @@ def _get_releases_feed(query, feed_url: str):
|
|||||||
"id": release.package.get_url("packages.view_release", id=release.id, absolute=True),
|
"id": release.package.get_url("packages.view_release", id=release.id, absolute=True),
|
||||||
"language": "en",
|
"language": "en",
|
||||||
"title": f"{release.title} - {release.package.title}",
|
"title": f"{release.title} - {release.package.title}",
|
||||||
"content_html": render_markdown(release.release_notes) if release.release_notes else None,
|
"content_html": render_markdown(release.release_notes) \
|
||||||
|
if release.release_notes else _render_link(release.package.get_url("packages.view_release", id=release.id, absolute=True)),
|
||||||
"author": {
|
"author": {
|
||||||
"name": release.package.author.display_name,
|
"name": release.package.author.display_name,
|
||||||
"avatar": release.package.author.get_profile_pic_url(absolute=True),
|
"avatar": release.package.author.get_profile_pic_url(absolute=True),
|
||||||
|
Loading…
Reference in New Issue
Block a user