diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/classes/@GDScript.xml | 6 | ||||
-rw-r--r-- | doc/classes/AnimatedSprite.xml | 1 | ||||
-rw-r--r-- | doc/classes/AnimationNodeStateMachine.xml | 2 | ||||
-rw-r--r-- | doc/classes/Array.xml | 2 | ||||
-rw-r--r-- | doc/classes/BaseButton.xml | 6 | ||||
-rw-r--r-- | doc/classes/CanvasItem.xml | 42 | ||||
-rw-r--r-- | doc/classes/CheckButton.xml | 4 | ||||
-rw-r--r-- | doc/classes/Font.xml | 10 | ||||
-rw-r--r-- | doc/classes/FuncRef.xml | 6 | ||||
-rw-r--r-- | doc/classes/HeightMapShape.xml | 2 | ||||
-rw-r--r-- | doc/classes/Image.xml | 2 | ||||
-rw-r--r-- | doc/classes/KinematicBody2D.xml | 2 | ||||
-rw-r--r-- | doc/classes/MultiMesh.xml | 20 | ||||
-rw-r--r-- | doc/classes/OptionButton.xml | 4 | ||||
-rw-r--r-- | doc/classes/PopupMenu.xml | 4 | ||||
-rw-r--r-- | doc/classes/ProjectSettings.xml | 4 | ||||
-rw-r--r-- | doc/classes/String.xml | 1 | ||||
-rw-r--r-- | doc/classes/VisualServer.xml | 22 | ||||
-rwxr-xr-x | doc/tools/makerst.py | 15 |
19 files changed, 103 insertions, 52 deletions
diff --git a/doc/classes/@GDScript.xml b/doc/classes/@GDScript.xml index 2f7f05b2e4..63b9ef13fd 100644 --- a/doc/classes/@GDScript.xml +++ b/doc/classes/@GDScript.xml @@ -259,12 +259,12 @@ </description> </method> <method name="decimals"> - <return type="float"> + <return type="int"> </return> <argument index="0" name="step" type="float"> </argument> <description> - Deprecated alias for "[method step_decimals]". + Deprecated alias for "[method step_decimals]". </description> </method> <method name="dectime"> @@ -1020,7 +1020,7 @@ </description> </method> <method name="step_decimals"> - <return type="float"> + <return type="int"> </return> <argument index="0" name="step" type="float"> </argument> diff --git a/doc/classes/AnimatedSprite.xml b/doc/classes/AnimatedSprite.xml index 2d4dd0e4b2..5e63f8aec0 100644 --- a/doc/classes/AnimatedSprite.xml +++ b/doc/classes/AnimatedSprite.xml @@ -61,6 +61,7 @@ If [code]true[/code], the [member animation] is currently playing. </member> <member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale"> + The animation speed is multiplied by this value. </member> </members> <signals> diff --git a/doc/classes/AnimationNodeStateMachine.xml b/doc/classes/AnimationNodeStateMachine.xml index b80069095b..e46a40c4de 100644 --- a/doc/classes/AnimationNodeStateMachine.xml +++ b/doc/classes/AnimationNodeStateMachine.xml @@ -7,7 +7,7 @@ [codeblock] var state_machine = anim_tree["parameters/StateMachine/playback"] state_machine.travel("SomeState") - [codeblock] + [/codeblock] </description> <tutorials> </tutorials> diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml index ecafc3514c..75194fbf76 100644 --- a/doc/classes/Array.xml +++ b/doc/classes/Array.xml @@ -291,7 +291,7 @@ </method> <method name="shuffle"> <description> - Shuffles the array such that the items will have a random order. + Shuffles the array such that the items will have a random order. This method uses the global random number generator common to methods such as [method @GDScript.randi]. Call [method @GDScript.randomize] to ensure that a new seed will be used each time if you want non-reproducible shuffling. </description> </method> <method name="size"> diff --git a/doc/classes/BaseButton.xml b/doc/classes/BaseButton.xml index c65d545f3e..7bd346ed5a 100644 --- a/doc/classes/BaseButton.xml +++ b/doc/classes/BaseButton.xml @@ -57,6 +57,9 @@ <member name="group" type="ButtonGroup" setter="set_button_group" getter="get_button_group"> [ButtonGroup] associated to the button. </member> + <member name="keep_pressed_outside" type="bool" setter="set_keep_pressed_outside" getter="is_keep_pressed_outside"> + If [code]true[/code], the button stays pressed when moving the cursor outside the button while pressing it. Default value: [code]false[/code]. + </member> <member name="pressed" type="bool" setter="set_pressed" getter="is_pressed"> If [code]true[/code], the button's state is pressed. Means the button is pressed down or toggled (if toggle_mode is active). </member> @@ -69,9 +72,6 @@ <member name="toggle_mode" type="bool" setter="set_toggle_mode" getter="is_toggle_mode"> If [code]true[/code], the button is in toggle mode. Makes the button flip state between pressed and unpressed each time its area is clicked. </member> - <member name="keep_pressed_outside" type="bool" setter="set_keep_pressed_outside" getter="is_keep_pressed_outside"> - If [code]true[/code], the button stays pressed when moving the cursor outside the button while pressing it. Default value: [code]false[/code]. - </member> </members> <signals> <signal name="button_down"> diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml index 82a5679172..8ba3990933 100644 --- a/doc/classes/CanvasItem.xml +++ b/doc/classes/CanvasItem.xml @@ -4,10 +4,10 @@ Base class of anything 2D. </brief_description> <description> - Base class of anything 2D. Canvas items are laid out in a tree and children inherit and extend the transform of their parent. CanvasItem is extended by [Control], for anything GUI related, and by [Node2D] for anything 2D engine related. - Any CanvasItem can draw. For this, the "update" function must be called, then NOTIFICATION_DRAW will be received on idle time to request redraw. Because of this, canvas items don't need to be redraw on every frame, improving the performance significantly. Several functions for drawing on the CanvasItem are provided (see draw_* functions). They can only be used inside the notification, signal or _draw() overrides function, though. - Canvas items are draw in tree order. By default, children are on top of their parents so a root CanvasItem will be drawn behind everything (this can be changed per item though). - Canvas items can also be hidden (hiding also their subtree). They provide many means for changing standard parameters such as opacity (for it and the subtree) and self opacity, blend mode. + Base class of anything 2D. Canvas items are laid out in a tree; children inherit and extend their parent's transform. CanvasItem is extended by [Control] for anything GUI-related, and by [Node2D] for anything related to the 2D engine. + Any CanvasItem can draw. For this, [method update] must be called, then [constant NOTIFICATION_DRAW] will be received on idle time to request redraw. Because of this, canvas items don't need to be redrawn on every frame, improving the performance significantly. Several functions for drawing on the CanvasItem are provided (see [code]draw_*[/code] functions). However, they can only be used inside the [method Object._notification], signal or [method _draw] virtual functions. + Canvas items are drawn in tree order. By default, children are on top of their parents so a root CanvasItem will be drawn behind everything. This behavior can be changed on a per-item basis. + A CanvasItem can also be hidden, which will also hide its children. It provides many ways to change parameters such as modulation (for itself and its children) and self modulation (only for itself), as well as its blend mode. Ultimately, a transform notification can be requested, which will notify the node that its global position changed in case the parent tree changed. </description> <tutorials> @@ -36,7 +36,7 @@ <argument index="4" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )"> </argument> <description> - Draws a string character using a custom font. Returns the advance, depending on the char width and kerning with an optional next char. + Draws a string character using a custom font. Returns the advance, depending on the character width and kerning with an optional next character. </description> </method> <method name="draw_circle"> @@ -116,7 +116,7 @@ <argument index="3" name="antialiased" type="bool" default="false"> </argument> <description> - Draws multiple, parallel lines with a uniform [code]color[/code] and [code]width[/code] and optional antialiasing. + Draws multiple, parallel lines with a uniform [code]color[/code]. [code]width[/code] and [code]antialiased[/code] are currently not implemented and have no effect. </description> </method> <method name="draw_multiline_colors"> @@ -211,7 +211,7 @@ <argument index="5" name="normal_map" type="Texture" default="null"> </argument> <description> - Draws a custom primitive, 1 point for a point, 2 points for a line, 3 points for a triangle and 4 points for a quad. + Draws a custom primitive. 1 point for a point, 2 points for a line, 3 points for a triangle and 4 points for a quad. </description> </method> <method name="draw_rect"> @@ -308,7 +308,7 @@ <argument index="5" name="normal_map" type="Texture" default="null"> </argument> <description> - Draws a textured rectangle at a given position, optionally modulated by a color. Transpose swaps the x and y coordinates when reading the texture. + Draws a textured rectangle at a given position, optionally modulated by a color. If [code]transpose[/code] is [code]true[/code], the texture will have its X and Y coordinates swapped. </description> </method> <method name="draw_texture_rect_region"> @@ -329,7 +329,7 @@ <argument index="6" name="clip_uv" type="bool" default="true"> </argument> <description> - Draws a textured rectangle region at a given position, optionally modulated by a color. Transpose swaps the x and y coordinates when reading the texture. + Draws a textured rectangle region at a given position, optionally modulated by a color. If [code]transpose[/code] is [code]true[/code], the texture will have its X and Y coordinates swapped. </description> </method> <method name="force_update_transform"> @@ -419,7 +419,7 @@ <return type="void"> </return> <description> - Hide the CanvasItem currently visible. + Hide the CanvasItem if it's currently visible. </description> </method> <method name="is_local_transform_notification_enabled" qualifiers="const"> @@ -433,7 +433,7 @@ <return type="bool"> </return> <description> - Return if set as toplevel. See [method set_as_toplevel]. + Returns [code]true[/code] if the node is set as top-level. See [method set_as_toplevel]. </description> </method> <method name="is_transform_notification_enabled" qualifiers="const"> @@ -474,7 +474,7 @@ <argument index="0" name="enable" type="bool"> </argument> <description> - Sets as top level. This means that it will not inherit transform from parent canvas items. + If [code]enable[/code] is [code]true[/code], the node won't inherit its transform from parent canvas items. </description> </method> <method name="set_notify_local_transform"> @@ -499,14 +499,14 @@ <return type="void"> </return> <description> - Show the CanvasItem currently hidden. For controls that inherit [Popup], the correct way to make them visible is to call one of the multiple popup*() functions instead. + Show the CanvasItem if it's currently hidden. For controls that inherit [Popup], the correct way to make them visible is to call one of the multiple [code]popup*()[/code] functions instead. </description> </method> <method name="update"> <return type="void"> </return> <description> - Queue the CanvasItem for update. [code]NOTIFICATION_DRAW[/code] will be called on idle time to request redraw. + Queue the CanvasItem for update. [constant NOTIFICATION_DRAW] will be called on idle time to request redraw. </description> </method> </methods> @@ -533,7 +533,7 @@ If [code]true[/code], the parent [CanvasItem]'s [member material] property is used as this one's material. Default value: [code]false[/code]. </member> <member name="visible" type="bool" setter="set_visible" getter="is_visible"> - If [code]true[/code], this [CanvasItem] is drawn. Default value: [code]true[/code]. For controls that inherit [Popup], the correct way to make them visible is to call one of the multiple popup*() functions instead. + If [code]true[/code], this [CanvasItem] is drawn. Default value: [code]true[/code]. For controls that inherit [Popup], the correct way to make them visible is to call one of the multiple [code]popup*()[/code] functions instead. </member> </members> <signals> @@ -575,22 +575,22 @@ Mix blending mode. Colors are assumed to be premultiplied by the alpha (opacity) value. </constant> <constant name="BLEND_MODE_DISABLED" value="5" enum="BlendMode"> - Disable blending mode. Colors including alpha are written as is. Only applicable for render targets with a transparent background. No lighting will be applied. + Disable blending mode. Colors including alpha are written as-is. Only applicable for render targets with a transparent background. No lighting will be applied. </constant> <constant name="NOTIFICATION_TRANSFORM_CHANGED" value="2000"> - Canvas item transform has changed. Notification is only received if enabled by [method set_notify_transform] or [method set_notify_local_transform]. + The CanvasItem's transform has changed. This notification is only received if enabled by [method set_notify_transform] or [method set_notify_local_transform]. </constant> <constant name="NOTIFICATION_DRAW" value="30"> - CanvasItem is requested to draw. + The CanvasItem is requested to draw. </constant> <constant name="NOTIFICATION_VISIBILITY_CHANGED" value="31"> - Canvas item visibility has changed. + The CanvasItem's visibility has changed. </constant> <constant name="NOTIFICATION_ENTER_CANVAS" value="32"> - Canvas item has entered the canvas. + The CanvasItem has entered the canvas. </constant> <constant name="NOTIFICATION_EXIT_CANVAS" value="33"> - Canvas item has exited the canvas. + The CanvasItem has exited the canvas. </constant> </constants> </class> diff --git a/doc/classes/CheckButton.xml b/doc/classes/CheckButton.xml index 94e4eececd..04344c1834 100644 --- a/doc/classes/CheckButton.xml +++ b/doc/classes/CheckButton.xml @@ -41,8 +41,12 @@ </theme_item> <theme_item name="off" type="Texture"> </theme_item> + <theme_item name="off_disabled" type="Texture"> + </theme_item> <theme_item name="on" type="Texture"> </theme_item> + <theme_item name="on_disabled" type="Texture"> + </theme_item> <theme_item name="pressed" type="StyleBox"> </theme_item> </theme_items> diff --git a/doc/classes/Font.xml b/doc/classes/Font.xml index bd189928b0..5792b539e0 100644 --- a/doc/classes/Font.xml +++ b/doc/classes/Font.xml @@ -77,6 +77,16 @@ Return the size of a string, taking kerning and advance into account. </description> </method> + <method name="get_wordwrap_string_size" qualifiers="const"> + <return type="Vector2"> + </return> + <argument index="0" name="string" type="String"> + </argument> + <argument index="1" name="p_width" type="float"> + </argument> + <description> + </description> + </method> <method name="has_outline" qualifiers="const"> <return type="bool"> </return> diff --git a/doc/classes/FuncRef.xml b/doc/classes/FuncRef.xml index 3f84316503..e35d7a68c5 100644 --- a/doc/classes/FuncRef.xml +++ b/doc/classes/FuncRef.xml @@ -17,6 +17,12 @@ Calls the referenced function previously set by [method set_function] or [method @GDScript.funcref]. </description> </method> + <method name="is_valid" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> <method name="set_function"> <return type="void"> </return> diff --git a/doc/classes/HeightMapShape.xml b/doc/classes/HeightMapShape.xml index 5ffeda1c10..22896535b9 100644 --- a/doc/classes/HeightMapShape.xml +++ b/doc/classes/HeightMapShape.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="HeightMapShape" inherits="Shape" category="Core" version="3.2"> <brief_description> - Height map shape for 3D physics (bullet only) + Height map shape for 3D physics (Bullet only). </brief_description> <description> Height map shape resource, which can be added to a [PhysicsBody] or [Area]. diff --git a/doc/classes/Image.xml b/doc/classes/Image.xml index 641bd64599..8dfabdd884 100644 --- a/doc/classes/Image.xml +++ b/doc/classes/Image.xml @@ -603,6 +603,8 @@ If the image does not have mipmaps, they will be generated and used internally, but no mipmaps will be generated on the resulting image. (Note that if you intend to scale multiple copies of the original image, it's better to call [code]generate_mipmaps[/code] on it in advance, to avoid wasting processing power in generating them again and again.) On the other hand, if the image already has mipmaps, they will be used, and a new set will be generated for the resulting image. </constant> + <constant name="INTERPOLATE_LANCZOS" value="4" enum="Interpolation"> + </constant> <constant name="ALPHA_NONE" value="0" enum="AlphaMode"> </constant> <constant name="ALPHA_BIT" value="1" enum="AlphaMode"> diff --git a/doc/classes/KinematicBody2D.xml b/doc/classes/KinematicBody2D.xml index 05a8129cc5..b7ff4bac84 100644 --- a/doc/classes/KinematicBody2D.xml +++ b/doc/classes/KinematicBody2D.xml @@ -9,6 +9,8 @@ Kinematic Characters: KinematicBody2D also has an API for moving objects (the [method move_and_collide] and [method move_and_slide] methods) while performing collision tests. This makes them really useful to implement characters that collide against a world, but that don't require advanced physics. </description> <tutorials> + <link>https://docs.godotengine.org/en/latest/tutorials/physics/kinematic_character_2d.html</link> + <link>https://docs.godotengine.org/en/latest/tutorials/physics/using_kinematic_body_2d.html</link> </tutorials> <methods> <method name="get_floor_velocity" qualifiers="const"> diff --git a/doc/classes/MultiMesh.xml b/doc/classes/MultiMesh.xml index 7148871e8c..1532fac206 100644 --- a/doc/classes/MultiMesh.xml +++ b/doc/classes/MultiMesh.xml @@ -44,7 +44,7 @@ <argument index="0" name="instance" type="int"> </argument> <description> - Return the transform of a specific instance. + Return the [Transform] of a specific instance. </description> </method> <method name="get_instance_transform_2d" qualifiers="const"> @@ -53,6 +53,18 @@ <argument index="0" name="instance" type="int"> </argument> <description> + Return the [Transform2D] of a specific instance. + </description> + </method> + <method name="set_as_bulk_array"> + <return type="void"> + </return> + <argument index="0" name="array" type="PoolRealArray"> + </argument> + <description> + Set all data related to the instances in one go. This is especially useful when loading the data from disk or preparing the data from GDNative. + All data is packed in one large float array. An array may look like this: Transform for instance 1, color data for instance 1, custom data for instance 1, transform for instance 2, color data for instance 2, etc... + [Transform] is stored as 12 floats, [Transform2D] is stored as 8 floats, COLOR_8BIT / CUSTOM_DATA_8BIT is stored as 1 float (4 bytes as is) and COLOR_FLOAT / CUSTOM_DATA_FLOAT is stored as 4 floats. </description> </method> <method name="set_instance_color"> @@ -86,7 +98,7 @@ <argument index="1" name="transform" type="Transform"> </argument> <description> - Set the transform for a specific instance. + Set the [Transform] for a specific instance. </description> </method> <method name="set_instance_transform_2d"> @@ -97,6 +109,7 @@ <argument index="1" name="transform" type="Transform2D"> </argument> <description> + Set the [Transform2D] for a specific instance. </description> </method> </methods> @@ -108,7 +121,7 @@ Format of custom data in custom data array that gets passed to shader. </member> <member name="instance_count" type="int" setter="set_instance_count" getter="get_instance_count"> - Number of instances that will get drawn. + Number of instances that will get drawn. This clears and (re)sizes the buffers. By default all instances are drawn but you can limit this with [member visible_instance_count]. </member> <member name="mesh" type="Mesh" setter="set_mesh" getter="get_mesh"> Mesh to be drawn. @@ -117,6 +130,7 @@ Format of transform used to transform mesh, either 2D or 3D. </member> <member name="visible_instance_count" type="int" setter="set_visible_instance_count" getter="get_visible_instance_count"> + Limits the number of instances drawn, -1 draws all instances. Changing this does not change the sizes of the buffers. </member> </members> <constants> diff --git a/doc/classes/OptionButton.xml b/doc/classes/OptionButton.xml index 51d2cbc867..06b4cb165e 100644 --- a/doc/classes/OptionButton.xml +++ b/doc/classes/OptionButton.xml @@ -202,14 +202,14 @@ </members> <signals> <signal name="item_focused"> - <argument index="0" name="ID" type="int"> + <argument index="0" name="id" type="int"> </argument> <description> This signal is emitted when user navigated to an item using [code]ui_up[/code] or [code]ui_down[/code] action. ID of the item selected is passed as argument. </description> </signal> <signal name="item_selected"> - <argument index="0" name="ID" type="int"> + <argument index="0" name="id" type="int"> </argument> <description> This signal is emitted when the current item was changed by the user. Index of the item selected is passed as argument. diff --git a/doc/classes/PopupMenu.xml b/doc/classes/PopupMenu.xml index 4924175b6e..a91f765d41 100644 --- a/doc/classes/PopupMenu.xml +++ b/doc/classes/PopupMenu.xml @@ -527,14 +527,14 @@ </members> <signals> <signal name="id_focused"> - <argument index="0" name="ID" type="int"> + <argument index="0" name="id" type="int"> </argument> <description> This event is emitted when user navigated to an item of some id using [code]ui_up[/code] or [code]ui_down[/code] action. </description> </signal> <signal name="id_pressed"> - <argument index="0" name="ID" type="int"> + <argument index="0" name="id" type="int"> </argument> <description> This event is emitted when an item of some id is pressed or its accelerator is activated. diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 46a4a70a9b..4b5500d077 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -281,7 +281,7 @@ If [code]true[/code], enables warnings when using a property as if it was a function. </member> <member name="debug/gdscript/warnings/return_value_discarded" type="bool" setter="" getter=""> - If [code]true[/code], enables warnings when calling a function without using its return value (by assigning it to a variable or using it as a function argument). Such return values are sometimes used to denote possible errors using the [Error] type. + If [code]true[/code], enables warnings when calling a function without using its return value (by assigning it to a variable or using it as a function argument). Such return values are sometimes used to denote possible errors using the [enum Error] enum. </member> <member name="debug/gdscript/warnings/shadowed_variable" type="bool" setter="" getter=""> If [code]true[/code], enables warnings when defining a local or subclass member variable that would shadow a variable at an upper level (such as a member variable). @@ -717,7 +717,7 @@ Shaders have a time variable that constantly increases. At some point, it needs to be rolled back to zero to avoid precision errors on shader animations. This setting specifies when (in seconds). </member> <member name="rendering/quality/2d/gles2_use_nvidia_rect_flicker_workaround" type="bool" setter="" getter=""> - Some NVIDIA GPU drivers have a bug which produces flickering issues for the [code]draw_rect[/code] method, especially as used in [TileMap]. Refer to [url]https://github.com/godotengine/godot/issues/9913[/url] for details. + Some NVIDIA GPU drivers have a bug which produces flickering issues for the [code]draw_rect[/code] method, especially as used in [TileMap]. Refer to [url=https://github.com/godotengine/godot/issues/9913][/url] for details. If [code]true[/code], this option enables a "safe" code path for such NVIDIA GPUs at the cost of performance. This option only impacts the GLES2 rendering backend (so the bug stays if you use GLES3), and only desktop platforms. </member> <member name="rendering/quality/2d/use_pixel_snap" type="bool" setter="" getter=""> diff --git a/doc/classes/String.xml b/doc/classes/String.xml index 526a9427dc..e06f0738b8 100644 --- a/doc/classes/String.xml +++ b/doc/classes/String.xml @@ -7,6 +7,7 @@ This is the built-in string class (and the one used by GDScript). It supports Unicode and provides all necessary means for string handling. Strings are reference counted and use a copy-on-write approach, so passing them around is cheap in resources. </description> <tutorials> + <link>https://docs.godotengine.org/en/stable/getting_started/scripting/gdscript/gdscript_format_string.html</link> </tutorials> <methods> <method name="String"> diff --git a/doc/classes/VisualServer.xml b/doc/classes/VisualServer.xml index c85a2c4b38..dae120f09b 100644 --- a/doc/classes/VisualServer.xml +++ b/doc/classes/VisualServer.xml @@ -2003,17 +2003,6 @@ <description> </description> </method> - <method name="light_set_use_gi"> - <return type="void"> - </return> - <argument index="0" name="light" type="RID"> - </argument> - <argument index="1" name="enabled" type="bool"> - </argument> - <description> - Sets whether GI probes capture light information from this light. - </description> - </method> <method name="light_set_color"> <return type="void"> </return> @@ -2096,6 +2085,17 @@ <description> </description> </method> + <method name="light_set_use_gi"> + <return type="void"> + </return> + <argument index="0" name="light" type="RID"> + </argument> + <argument index="1" name="enabled" type="bool"> + </argument> + <description> + Sets whether GI probes capture light information from this light. + </description> + </method> <method name="lightmap_capture_create"> <return type="RID"> </return> diff --git a/doc/tools/makerst.py b/doc/tools/makerst.py index e81b4db13e..c3e15b2f9a 100755 --- a/doc/tools/makerst.py +++ b/doc/tools/makerst.py @@ -683,10 +683,16 @@ def rstize_text(text, state): # type: (str, State) -> str # Handle [tags] inside_code = False + inside_url = False + url_has_name = False + url_link = "" pos = 0 tag_depth = 0 + previous_pos = 0 while True: pos = text.find('[', pos) + if inside_url and (pos > previous_pos): + url_has_name = True if pos == -1: break @@ -795,12 +801,16 @@ def rstize_text(text, state): # type: (str, State) -> str elif cmd.find('image=') == 0: tag_text = "" # '![](' + cmd[6:] + ')' elif cmd.find('url=') == 0: - tag_text = ':ref:`' + cmd[4:] + '<' + cmd[4:] + ">`" + url_link = cmd[4:] + tag_text = ':ref:`' tag_depth += 1 + url_has_name = False + inside_url = True elif cmd == '/url': - tag_text = '' + tag_text = ('' if url_has_name else url_link) + '<' + url_link + ">`" tag_depth -= 1 escape_post = True + inside_url = False elif cmd == 'center': tag_depth += 1 tag_text = '' @@ -871,6 +881,7 @@ def rstize_text(text, state): # type: (str, State) -> str text = pre_text + tag_text + post_text pos = len(pre_text) + len(tag_text) + previous_pos = pos if tag_depth > 0: print_error("Tag depth mismatch: too many/little open/close tags, file: {}".format(state.current_class), state) |