fix warnings in classref

This commit is contained in:
Hana 2022-11-18 15:41:44 +01:00
parent e8f9cd8ac5
commit a5e5f1aa50
4 changed files with 14 additions and 12 deletions

View File

@ -4,7 +4,7 @@
Popup is a base window container for popup-like subwindows. Popup is a base window container for popup-like subwindows.
</brief_description> </brief_description>
<description> <description>
Popup is a base window container for popup-like subwindows. It's a modal by default (see [member popup_window]) and has helpers for custom popup behavior. Popup is a base window container for popup-like subwindows. It's a modal by default (see [member Window.popup_window]) and has helpers for custom popup behavior.
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>

View File

@ -82,9 +82,9 @@
var rect2 = rect.expand(Vector2(0, -1)) var rect2 = rect.expand(Vector2(0, -1))
[/gdscript] [/gdscript]
[csharp] [csharp]
# position (-3, 2), size (1, 1) // position (-3, 2), size (1, 1)
var rect = new Rect2(new Vector2(-3, 2), new Vector2(1, 1)); var rect = new Rect2(new Vector2(-3, 2), new Vector2(1, 1));
# position (-3, -1), size (3, 4), so we fit both rect and Vector2(0, -1) // position (-3, -1), size (3, 4), so we fit both rect and Vector2(0, -1)
var rect2 = rect.Expand(new Vector2(0, -1)); var rect2 = rect.Expand(new Vector2(0, -1));
[/csharp] [/csharp]
[/codeblocks] [/codeblocks]

View File

@ -79,9 +79,9 @@
var rect2 = rect.expand(Vector2i(0, -1)) var rect2 = rect.expand(Vector2i(0, -1))
[/gdscript] [/gdscript]
[csharp] [csharp]
# position (-3, 2), size (1, 1) // position (-3, 2), size (1, 1)
var rect = new Rect2i(new Vector2i(-3, 2), new Vector2i(1, 1)); var rect = new Rect2i(new Vector2i(-3, 2), new Vector2i(1, 1));
# position (-3, -1), size (3, 4), so we fit both rect and Vector2i(0, -1) // position (-3, -1), size (3, 4), so we fit both rect and Vector2i(0, -1)
var rect2 = rect.Expand(new Vector2i(0, -1)); var rect2 = rect.Expand(new Vector2i(0, -1));
[/csharp] [/csharp]
[/codeblocks] [/codeblocks]

View File

@ -1057,12 +1057,11 @@ def make_rst_class(class_def: ClassDef, state: State, dry_run: bool, output_dir:
for i, m in enumerate(method_list): for i, m in enumerate(method_list):
if index != 0: if index != 0:
f.write("----\n\n") f.write("----\n\n")
out = f".. _class_{class_name}_operator_{sanitize_operator_name(m.name, state)}"
if i == 0: for parameter in m.parameters:
f.write( out += f"_{parameter.type_name.type_name}"
f".. _class_{class_name}_operator_{sanitize_operator_name(m.name, state)}_{m.return_type.type_name}:\n\n" out += f":\n\n"
) f.write(out)
ret_type, signature = make_method_signature(class_def, m, "", state) ret_type, signature = make_method_signature(class_def, m, "", state)
f.write(f"- {ret_type} {signature}\n\n") f.write(f"- {ret_type} {signature}\n\n")
@ -1168,7 +1167,10 @@ def make_method_signature(
if isinstance(definition, MethodDef) and ref_type != "": if isinstance(definition, MethodDef) and ref_type != "":
if ref_type == "operator": if ref_type == "operator":
op_name = definition.name.replace("<", "\\<") # So operator "<" gets correctly displayed. op_name = definition.name.replace("<", "\\<") # So operator "<" gets correctly displayed.
out += f":ref:`{op_name}<class_{class_def.name}_{ref_type}_{sanitize_operator_name(definition.name, state)}_{definition.return_type.type_name}>` " out += f":ref:`{op_name}<class_{class_def.name}_{ref_type}_{sanitize_operator_name(definition.name, state)}"
for parameter in definition.parameters:
out += f"_{parameter.type_name.type_name}"
out += f">` "
else: else:
out += f":ref:`{definition.name}<class_{class_def.name}_{ref_type}_{definition.name}>` " out += f":ref:`{definition.name}<class_{class_def.name}_{ref_type}_{definition.name}>` "
else: else: