temporary disable links surrounding for cargo doc

it was causing some issues and I want to focus on other things first.
This commit is contained in:
OMGeeky
2024-05-18 19:15:35 +02:00
parent 01aa60909c
commit af71b9ee49
2 changed files with 7 additions and 7 deletions

View File

@@ -120,17 +120,17 @@ class UtilsTest(unittest.TestCase):
s = "This is a documentation with a link to https://goo.gl/TgSFN2 which is a link to some more info"
expected = "This is a documentation with a link to <https://goo.gl/TgSFN2> which is a link to some more info"
result = use_automatic_links_in_rust_doc_comment(s)
self.assertEqual(result, expected)
# self.assertEqual(result, expected)
s = "/// Creates multiple new sessions. This API can be used to initialize a session cache on the clients. See https://goo.gl/TgSFN2 for best practices on session cache management."
expected = "/// Creates multiple new sessions. This API can be used to initialize a session cache on the clients. See <https://goo.gl/TgSFN2> for best practices on session cache management."
result = use_automatic_links_in_rust_doc_comment(s)
self.assertEqual(result, expected)
# self.assertEqual(result, expected)
def test_url_in_doc_ending_with_dot(self):
s = "This is a documentation with a link to https://goo.gl/TgSFN2."
expected = "This is a documentation with a link to <https://goo.gl/TgSFN2>."
result = use_automatic_links_in_rust_doc_comment(s)
self.assertEqual(result, expected)
# self.assertEqual(result, expected)
def main():
unittest.main()

View File

@@ -19,7 +19,7 @@ re_desc_parts = re.compile(
re_find_replacements = re.compile(r"\{[/\+]?\w+\*?\}")
re_relative_links = re.compile(r"\]\s*\([^h]")
re_non_hyper_links = re.compile(r"(?<!<)(?:https?|ftp)://[\w/\-?=%.]+\.[\w/\-&?=%+#.]+(?!>)")
# re_non_hyper_links = re.compile(r"(?<!<)(?:https?|ftp)://[\w/\-?=%.]+\.[\w/\-&?=%+#]+(?!>)")
"""a regex that finds all links not surrounded by < and >"""
HTTP_METHODS = set(("OPTIONS", "GET", "POST", "PUT", "DELETE", "HEAD", "TRACE", "CONNECT", "PATCH"))
@@ -140,8 +140,8 @@ def use_automatic_links_in_rust_doc_comment(s: str) -> str:
link = match.group()
return f"<{link}>"
return re_non_hyper_links.sub(replace_links, s)
# return re_non_hyper_links.sub(replace_links, s)
return s
# returns true if there is an indication for something that is interpreted as doc comment by rustdoc
def has_markdown_codeblock_with_indentation(s):
@@ -1321,4 +1321,4 @@ if __name__ == '__main__':