scripts/update-plugin-list: escape summary for special RST chars
A new plugin has this summary:
Continiously runs pytest on changes in *.py files
The `*` is interpreted as a special character and fails the CI.
Add some rudimentary escaping to hopefully prevent this.
This commit is contained in:
@@ -26,6 +26,20 @@ DEVELOPMENT_STATUS_CLASSIFIERS = (
|
||||
)
|
||||
|
||||
|
||||
def escape_rst(text: str) -> str:
|
||||
"""Rudimentary attempt to escape special RST characters to appear as
|
||||
plain text."""
|
||||
text = (
|
||||
text
|
||||
.replace("*", "\\*")
|
||||
.replace("<", "\\<")
|
||||
.replace(">", "\\>")
|
||||
.replace("`", "\\`")
|
||||
)
|
||||
text = re.sub(r"_\b", "", text)
|
||||
return text
|
||||
|
||||
|
||||
def iter_plugins():
|
||||
regex = r">([\d\w-]*)</a>"
|
||||
response = requests.get("https://pypi.org/simple")
|
||||
@@ -63,8 +77,7 @@ def iter_plugins():
|
||||
last_release = release_date.strftime("%b %d, %Y")
|
||||
break
|
||||
name = f'`{info["name"]} <{info["project_url"]}>`_'
|
||||
summary = info["summary"].replace("\n", "")
|
||||
summary = re.sub(r"_\b", "", summary)
|
||||
summary = escape_rst(info["summary"].replace("\n", ""))
|
||||
yield {
|
||||
"name": name,
|
||||
"summary": summary,
|
||||
|
||||
Reference in New Issue
Block a user