Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Lib/pydoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ def markup(self, text, escape=None, funcs={}, classes={}, methods={}):
escape = escape or self.escape
results = []
here = 0
pattern = re.compile(r'\b((http|ftp)://\S+[\w/]|'
pattern = re.compile(r'\b((http|https|ftp)://\S+[\w/]|'
r'RFC[- ]?(\d+)|'
r'PEP[- ]?(\d+)|'
r'(self\.)?(\w+))')
Expand Down
11 changes: 11 additions & 0 deletions Lib/test/test_pydoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1311,6 +1311,17 @@ async def an_async_generator():
'async <a name="-an_async_generator"><strong>an_async_generator',
html)

def test_html_for_https_links(self):
def a_fn_with_https_link():
"""a link https://localhost/"""
pass

html = pydoc.HTMLDoc().document(a_fn_with_https_link)
self.assertIn(
'<a href="https://localhost/">https://localhost/</a>',
html
)

class PydocServerTest(unittest.TestCase):
"""Tests for pydoc._start_server"""

Expand Down
2 changes: 1 addition & 1 deletion Lib/xmlrpc/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ def markup(self, text, escape=None, funcs={}, classes={}, methods={}):
# hyperlinking of arbitrary strings being used as method
# names. Only methods with names consisting of word characters
# and '.'s are hyperlinked.
pattern = re.compile(r'\b((http|ftp)://\S+[\w/]|'
pattern = re.compile(r'\b((http|https|ftp)://\S+[\w/]|'
r'RFC[- ]?(\d+)|'
r'PEP[- ]?(\d+)|'
r'(self\.)?((?:\w|\.)+))\b')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pydoc now recognizes and parses HTTPS URLs. Patch by python273.