mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 09:26:37 +03:00
Don't link generic arguments on the docs
This commit is contained in:
parent
64a1a69a5e
commit
356ed164f7
|
@ -107,6 +107,7 @@ class DocsWriter:
|
|||
# Write all the arguments (or do nothing if there's none)
|
||||
for arg in tlobject.args:
|
||||
self.write(' ')
|
||||
add_link = not arg.generic_definition and not arg.is_generic
|
||||
|
||||
# "Opening" modifiers
|
||||
if arg.generic_definition:
|
||||
|
@ -128,9 +129,11 @@ class DocsWriter:
|
|||
|
||||
# Argument type
|
||||
if arg.type:
|
||||
self.write('<a href="')
|
||||
self.write(self.type_to_path(arg.type))
|
||||
self.write('">%s</a>' % arg.type)
|
||||
if add_link:
|
||||
self.write('<a href="%s">' % self.type_to_path(arg.type))
|
||||
self.write(arg.type)
|
||||
if add_link:
|
||||
self.write('</a>')
|
||||
else:
|
||||
self.write('#')
|
||||
|
||||
|
@ -142,7 +145,15 @@ class DocsWriter:
|
|||
self.write('}')
|
||||
|
||||
# Now write the resulting type (result from a function, or type for a constructor)
|
||||
self.write(' = <a href="')
|
||||
self.write(' = ')
|
||||
generic_name = next((arg.name for arg in tlobject.args
|
||||
if arg.generic_definition), None)
|
||||
|
||||
if tlobject.result == generic_name:
|
||||
# Generic results cannot have any link
|
||||
self.write(tlobject.result)
|
||||
else:
|
||||
self.write('<a href="')
|
||||
self.write(self.type_to_path(tlobject.result))
|
||||
self.write('">%s</a>' % tlobject.result)
|
||||
|
||||
|
|
|
@ -221,6 +221,9 @@ def generate_documentation(scheme_file):
|
|||
bold=True)
|
||||
|
||||
# Type row
|
||||
if arg.is_generic:
|
||||
docs.add_row('!' + arg.type, align='center')
|
||||
else:
|
||||
docs.add_row(arg.type,
|
||||
link=get_path_for_type(arg.type, relative_to=filename),
|
||||
align='center')
|
||||
|
|
Loading…
Reference in New Issue
Block a user