mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
don't remove self from example code in the HTML output (closes #13223)
Patch by Víctor Terrón.
This commit is contained in:
parent
3c2dca67ac
commit
ed1160b39c
4 changed files with 64 additions and 2 deletions
|
@ -595,10 +595,15 @@ class HTMLDoc(Doc):
|
|||
elif pep:
|
||||
url = 'http://www.python.org/dev/peps/pep-%04d/' % int(pep)
|
||||
results.append('<a href="%s">%s</a>' % (url, escape(all)))
|
||||
elif selfdot:
|
||||
# Create a link for methods like 'self.method(...)'
|
||||
# and use <strong> for attributes like 'self.attr'
|
||||
if text[end:end+1] == '(':
|
||||
results.append('self.' + self.namelink(name, methods))
|
||||
else:
|
||||
results.append('self.<strong>%s</strong>' % name)
|
||||
elif text[end:end+1] == '(':
|
||||
results.append(self.namelink(name, methods, funcs, classes))
|
||||
elif selfdot:
|
||||
results.append('self.<strong>%s</strong>' % name)
|
||||
else:
|
||||
results.append(self.namelink(name, classes))
|
||||
here = end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue