diff --git a/docs/docs_writer.py b/docs/docs_writer.py index 5a804fc5..2dbc5a58 100644 --- a/docs/docs_writer.py +++ b/docs/docs_writer.py @@ -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('%s' % arg.type) + if add_link: + self.write('' % self.type_to_path(arg.type)) + self.write(arg.type) + if add_link: + self.write('') else: self.write('#') @@ -142,9 +145,17 @@ class DocsWriter: self.write('}') # Now write the resulting type (result from a function, or type for a constructor) - self.write(' = %s' % tlobject.result) + 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('%s' % tlobject.result) self.write('') diff --git a/docs/generate.py b/docs/generate.py index 6ec6a99c..4c7cf9ad 100644 --- a/docs/generate.py +++ b/docs/generate.py @@ -221,9 +221,12 @@ def generate_documentation(scheme_file): bold=True) # Type row - docs.add_row(arg.type, - link=get_path_for_type(arg.type, relative_to=filename), - align='center') + 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') # Create a description for this argument description = ''