Fix build_docs regex for trailing URL periods (#17036)

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
pull/17038/head
Paula Derrenger 1 month ago committed by GitHub
parent 99f729a4e4
commit e107611294
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      docs/build_docs.py

@ -199,11 +199,11 @@ def convert_plaintext_links_to_html(content):
for text_node in paragraph.find_all(string=True, recursive=False):
if text_node.parent.name not in {"a", "code"}: # Ignore links and code blocks
new_text = re.sub(
r"(https?://[^\s()<>]+)",
r"(https?://[^\s()<>]*[^\s()<>.,:;!?])",
r'<a href="\1">\1</a>',
str(text_node),
)
if "<a" in new_text:
if "<a href=" in new_text:
new_soup = BeautifulSoup(new_text, "html.parser")
text_node.replace_with(new_soup)
modified = True

Loading…
Cancel
Save