diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/classes/AABB.xml | 3 | ||||
-rw-r--r-- | doc/classes/Basis.xml | 1 | ||||
-rw-r--r-- | doc/classes/Color.xml | 1 | ||||
-rw-r--r-- | doc/classes/MeshLibrary.xml | 22 | ||||
-rw-r--r-- | doc/classes/Plane.xml | 1 | ||||
-rw-r--r-- | doc/classes/Quat.xml | 1 | ||||
-rw-r--r-- | doc/classes/Rect2.xml | 3 | ||||
-rw-r--r-- | doc/classes/Script.xml | 2 | ||||
-rw-r--r-- | doc/classes/Transform.xml | 1 | ||||
-rw-r--r-- | doc/classes/Transform2D.xml | 1 | ||||
-rw-r--r-- | doc/classes/Vector2.xml | 1 | ||||
-rw-r--r-- | doc/classes/Vector3.xml | 1 | ||||
-rwxr-xr-x | doc/tools/makerst.py | 67 |
13 files changed, 67 insertions, 38 deletions
diff --git a/doc/classes/AABB.xml b/doc/classes/AABB.xml index 61e1ea9b8d..44f1d9a921 100644 --- a/doc/classes/AABB.xml +++ b/doc/classes/AABB.xml @@ -182,6 +182,7 @@ <argument index="0" name="aabb" type="AABB"> </argument> <description> + Returns [code]true[/code] if this [AABB] and [code]aabb[/code] are approximately equal, by calling [code]is_equal_approx[/code] on each component. </description> </method> <method name="merge"> @@ -190,7 +191,7 @@ <argument index="0" name="with" type="AABB"> </argument> <description> - Returns a larger AABB that contains this AABB and [code]with[/code]. + Returns a larger [AABB] that contains both this [AABB] and [code]with[/code]. </description> </method> </methods> diff --git a/doc/classes/Basis.xml b/doc/classes/Basis.xml index df9438e695..5a7fc0a41b 100644 --- a/doc/classes/Basis.xml +++ b/doc/classes/Basis.xml @@ -102,6 +102,7 @@ <argument index="1" name="epsilon" type="float" default="0.00001"> </argument> <description> + Returns [code]true[/code] if this basis and [code]b[/code] are approximately equal, by calling [code]is_equal_approx[/code] on each component. </description> </method> <method name="orthonormalized"> diff --git a/doc/classes/Color.xml b/doc/classes/Color.xml index deba30712e..1d4225542a 100644 --- a/doc/classes/Color.xml +++ b/doc/classes/Color.xml @@ -157,6 +157,7 @@ <argument index="0" name="color" type="Color"> </argument> <description> + Returns [code]true[/code] if this color and [code]color[/code] are approximately equal, by running [method @GDScript.is_equal_approx] on each component. </description> </method> <method name="lightened"> diff --git a/doc/classes/MeshLibrary.xml b/doc/classes/MeshLibrary.xml index 44dc4f334f..49278be44e 100644 --- a/doc/classes/MeshLibrary.xml +++ b/doc/classes/MeshLibrary.xml @@ -4,7 +4,7 @@ Library of meshes. </brief_description> <description> - A library of meshes. Contains a list of [Mesh] resources, each with a name and ID. This resource is used in [GridMap]. + A library of meshes. Contains a list of [Mesh] resources, each with a name and ID. Each item can also include collision and navigation shapes. This resource is used in [GridMap]. </description> <tutorials> </tutorials> @@ -22,7 +22,8 @@ <argument index="0" name="id" type="int"> </argument> <description> - Create a new item in the library, supplied as an ID. + Creates a new item in the library with the given ID. + You can get an unused ID from [method get_last_unused_item_id]. </description> </method> <method name="find_item_by_name" qualifiers="const"> @@ -31,13 +32,14 @@ <argument index="0" name="name" type="String"> </argument> <description> + Returns the first item with the given name. </description> </method> <method name="get_item_list" qualifiers="const"> <return type="PoolIntArray"> </return> <description> - Returns the list of items. + Returns the list of item IDs in use. </description> </method> <method name="get_item_mesh" qualifiers="const"> @@ -46,7 +48,7 @@ <argument index="0" name="id" type="int"> </argument> <description> - Returns the mesh of the item. + Returns the item's mesh. </description> </method> <method name="get_item_name" qualifiers="const"> @@ -55,7 +57,7 @@ <argument index="0" name="id" type="int"> </argument> <description> - Returns the name of the item. + Returns the item's name. </description> </method> <method name="get_item_navmesh" qualifiers="const"> @@ -64,6 +66,7 @@ <argument index="0" name="id" type="int"> </argument> <description> + Returns the item's navigation mesh. </description> </method> <method name="get_item_navmesh_transform" qualifiers="const"> @@ -72,6 +75,7 @@ <argument index="0" name="id" type="int"> </argument> <description> + Returns the transform applied to the item's navigation mesh. </description> </method> <method name="get_item_preview" qualifiers="const"> @@ -90,6 +94,8 @@ <argument index="0" name="id" type="int"> </argument> <description> + Returns an item's collision shapes. + The array consists of each [Shape] followed by its [Transform]. </description> </method> <method name="get_last_unused_item_id" qualifiers="const"> @@ -128,6 +134,7 @@ </argument> <description> Sets the item's name. + This name is shown in the editor. It can also be used to look up the item later using [method find_item_by_name]. </description> </method> <method name="set_item_navmesh"> @@ -138,6 +145,7 @@ <argument index="1" name="navmesh" type="NavigationMesh"> </argument> <description> + Sets the item's navigation mesh. </description> </method> <method name="set_item_navmesh_transform"> @@ -148,6 +156,7 @@ <argument index="1" name="navmesh" type="Transform"> </argument> <description> + Sets the transform to apply to the item's navigation mesh. </description> </method> <method name="set_item_preview"> @@ -158,6 +167,7 @@ <argument index="1" name="texture" type="Texture"> </argument> <description> + Sets a texture to use as the item's preview icon in the editor. </description> </method> <method name="set_item_shapes"> @@ -168,6 +178,8 @@ <argument index="1" name="shapes" type="Array"> </argument> <description> + Sets an item's collision shapes. + The array should consist of [Shape] objects, each followed by a [Transform] that will be applied to it. For shapes that should not have a transform, use [constant Transform.IDENTITY]. </description> </method> </methods> diff --git a/doc/classes/Plane.xml b/doc/classes/Plane.xml index bb72f2734e..f179041327 100644 --- a/doc/classes/Plane.xml +++ b/doc/classes/Plane.xml @@ -122,6 +122,7 @@ <argument index="0" name="plane" type="Plane"> </argument> <description> + Returns [code]true[/code] if this plane and [code]plane[/code] are approximately equal, by running [method @GDScript.is_equal_approx] on each component. </description> </method> <method name="is_point_over"> diff --git a/doc/classes/Quat.xml b/doc/classes/Quat.xml index f5ee99d30c..eeb633f480 100644 --- a/doc/classes/Quat.xml +++ b/doc/classes/Quat.xml @@ -100,6 +100,7 @@ <argument index="0" name="quat" type="Quat"> </argument> <description> + Returns [code]true[/code] if this quaterion and [code]quat[/code] are approximately equal, by running [method @GDScript.is_equal_approx] on each component. </description> </method> <method name="is_normalized"> diff --git a/doc/classes/Rect2.xml b/doc/classes/Rect2.xml index 07fa7777fe..90dd996691 100644 --- a/doc/classes/Rect2.xml +++ b/doc/classes/Rect2.xml @@ -143,6 +143,7 @@ <argument index="0" name="rect" type="Rect2"> </argument> <description> + Returns [code]true[/code] if this [Rect2] and [code]rect[/code] are approximately equal, by calling [code]is_equal_approx[/code] on each component. </description> </method> <method name="merge"> @@ -151,7 +152,7 @@ <argument index="0" name="b" type="Rect2"> </argument> <description> - Returns a larger Rect2 that contains this Rect2 and [code]b[/code]. + Returns a larger [Rect2] that contains this [Rect2] and [code]b[/code]. </description> </method> </methods> diff --git a/doc/classes/Script.xml b/doc/classes/Script.xml index e8a88acdb5..91014580d3 100644 --- a/doc/classes/Script.xml +++ b/doc/classes/Script.xml @@ -4,7 +4,7 @@ A class stored as a resource. </brief_description> <description> - A class stored as a resource. A script exends the functionality of all objects that instance it. + A class stored as a resource. A script extends the functionality of all objects that instance it. The [code]new[/code] method of a script subclass creates a new instance. [method Object.set_script] extends an existing object, if that object's class matches one of the script's base classes. </description> <tutorials> diff --git a/doc/classes/Transform.xml b/doc/classes/Transform.xml index 034a1b2f5b..4c4022b3b5 100644 --- a/doc/classes/Transform.xml +++ b/doc/classes/Transform.xml @@ -95,6 +95,7 @@ <argument index="0" name="transform" type="Transform"> </argument> <description> + Returns [code]true[/code] if this transform and [code]transform[/code] are approximately equal, by calling [code]is_equal_approx[/code] on each component. </description> </method> <method name="looking_at"> diff --git a/doc/classes/Transform2D.xml b/doc/classes/Transform2D.xml index 89ccffc2e9..6288bb074c 100644 --- a/doc/classes/Transform2D.xml +++ b/doc/classes/Transform2D.xml @@ -112,6 +112,7 @@ <argument index="0" name="transform" type="Transform2D"> </argument> <description> + Returns [code]true[/code] if this transform and [code]transform[/code] are approximately equal, by calling [code]is_equal_approx[/code] on each component. </description> </method> <method name="orthonormalized"> diff --git a/doc/classes/Vector2.xml b/doc/classes/Vector2.xml index 8ae5caf68c..b23c69de60 100644 --- a/doc/classes/Vector2.xml +++ b/doc/classes/Vector2.xml @@ -159,6 +159,7 @@ <argument index="0" name="v" type="Vector2"> </argument> <description> + Returns [code]true[/code] if this vector and [code]v[/code] are approximately equal, by running [method @GDScript.is_equal_approx] on each component. </description> </method> <method name="is_normalized"> diff --git a/doc/classes/Vector3.xml b/doc/classes/Vector3.xml index 29c24709e2..d838e6d2f7 100644 --- a/doc/classes/Vector3.xml +++ b/doc/classes/Vector3.xml @@ -135,6 +135,7 @@ <argument index="0" name="v" type="Vector3"> </argument> <description> + Returns [code]true[/code] if this vector and [code]v[/code] are approximately equal, by running [method @GDScript.is_equal_approx] on each component. </description> </method> <method name="is_normalized"> diff --git a/doc/tools/makerst.py b/doc/tools/makerst.py index ef38299680..de53259827 100755 --- a/doc/tools/makerst.py +++ b/doc/tools/makerst.py @@ -148,6 +148,8 @@ class State: setter = property.get("setter") or None # Use or None so '' gets turned into None. getter = property.get("getter") or None default_value = property.get("default") or None + if default_value is not None: + default_value = escape_rst(default_value) overridden = property.get("override") or False property_def = PropertyDef(property_name, type_name, setter, getter, property.text, default_value, overridden) @@ -622,6 +624,40 @@ def make_class_list(class_list, columns): # type: (List[str], int) -> None f.close() +def escape_rst(text, until_pos=-1): # type: (str) -> str + # Escape \ character, otherwise it ends up as an escape character in rst + pos = 0 + while True: + pos = text.find('\\', pos, until_pos) + if pos == -1: + break + text = text[:pos] + "\\\\" + text[pos + 1:] + pos += 2 + + # Escape * character to avoid interpreting it as emphasis + pos = 0 + while True: + pos = text.find('*', pos, until_pos) + if pos == -1: + break + text = text[:pos] + "\*" + text[pos + 1:] + pos += 2 + + # Escape _ character at the end of a word to avoid interpreting it as an inline hyperlink + pos = 0 + while True: + pos = text.find('_', pos, until_pos) + if pos == -1: + break + if not text[pos + 1].isalnum(): # don't escape within a snake_case word + text = text[:pos] + "\_" + text[pos + 1:] + pos += 2 + else: + pos += 1 + + return text + + def rstize_text(text, state): # type: (str, State) -> str # Linebreak + tabs in the XML should become two line breaks unless in a "codeblock" pos = 0 @@ -677,36 +713,7 @@ def rstize_text(text, state): # type: (str, State) -> str pos += 2 next_brac_pos = text.find('[') - - # Escape \ character, otherwise it ends up as an escape character in rst - pos = 0 - while True: - pos = text.find('\\', pos, next_brac_pos) - if pos == -1: - break - text = text[:pos] + "\\\\" + text[pos + 1:] - pos += 2 - - # Escape * character to avoid interpreting it as emphasis - pos = 0 - while True: - pos = text.find('*', pos, next_brac_pos) - if pos == -1: - break - text = text[:pos] + "\*" + text[pos + 1:] - pos += 2 - - # Escape _ character at the end of a word to avoid interpreting it as an inline hyperlink - pos = 0 - while True: - pos = text.find('_', pos, next_brac_pos) - if pos == -1: - break - if not text[pos + 1].isalnum(): # don't escape within a snake_case word - text = text[:pos] + "\_" + text[pos + 1:] - pos += 2 - else: - pos += 1 + text = escape_rst(text, next_brac_pos) # Handle [tags] inside_code = False |