Skip to content

Commit

Permalink
Fix Rebel Engine API documentation not displaying images (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielaOrtner authored Jan 30, 2024
2 parents 2c4b0d4 + 9f69246 commit 5597f82
Show file tree
Hide file tree
Showing 11 changed files with 1,157 additions and 1,265 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/static_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ jobs:
- name: Documentation syntax checks
run: |
tools/scripts/make_rst.py --dry-run docs modules
tools/scripts/rst_from_xml.py --dry-run docs modules
2 changes: 1 addition & 1 deletion docs/Color.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ SPDX-License-Identifier: MIT
You can also create a color from standardized color names by using [method @GDScript.ColorN] or directly using the color constants defined here. The standardized color set is based on the [url=https://en.wikipedia.org/wiki/X11_color_names]X11 color names[/url].
If you want to supply values in a range of 0 to 255, you should use [method @GDScript.Color8].
[b]Note:[/b] In a boolean context, a Color will evaluate to [code]false[/code] if it's equal to [code]Color(0, 0, 0, 1)[/code] (opaque black). Otherwise, a Color will always evaluate to [code]true[/code].
[url=https://raw.githubusercontent.com/RebelToolbox/RebelDocumentation/main/img/color_constants.png]Color constants cheatsheet[/url]
[img caption="Color constants cheatsheet"]/img/color_constants.png[/img]
</description>
<tutorials>
</tutorials>
Expand Down
2 changes: 1 addition & 1 deletion docs/Node2D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ SPDX-License-Identifier: MIT
<argument index="0" name="point" type="Vector2" />
<description>
Returns the angle between the node and the [code]point[/code] in radians.
[url=https://raw.githubusercontent.com/RebelToolbox/RebelDocumentation/main/img/node2d_get_angle_to.png]Illustration of the returned angle.[/url]
[img caption="Illustration of the returned angle"]/img/node2d_get_angle_to.png[/img]
</description>
</method>
<method name="get_relative_transform_to_parent" qualifiers="const">
Expand Down
2 changes: 1 addition & 1 deletion docs/Tween.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ SPDX-License-Identifier: MIT
[/codeblock]
Many methods require a property name, such as [code]"position"[/code] above. You can find the correct property name by hovering over the property in the Inspector. You can also provide the components of a property directly by using [code]"property:component"[/code] (e.g. [code]position:x[/code]), where it would only apply to that particular component.
Many of the methods accept [code]trans_type[/code] and [code]ease_type[/code]. The first accepts an [enum TransitionType] constant, and refers to the way the timing of the animation is handled (see [url=https://easings.net/]easings.net[/url] for some examples). The second accepts an [enum EaseType] constant, and controls where the [code]trans_type[/code] is applied to the interpolation (in the beginning, the end, or both). If you don't know which transition and easing to pick, you can try different [enum TransitionType] constants with [constant EASE_IN_OUT], and use the one that looks best.
[url=https://raw.githubusercontent.com/RebelToolbox/RebelDocumentation/main/img/tween_cheatsheet.png]Tween easing and transition types cheatsheet[/url]
[img caption="Tween easing and transition types cheatsheet"]/img/tween_cheatsheet.png[/img]
[b]Note:[/b] Tween methods will return [code]false[/code] if the requested operation cannot be completed.
</description>
<tutorials>
Expand Down
4 changes: 2 additions & 2 deletions docs/Vector2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ SPDX-License-Identifier: MIT
<description>
Returns this vector's angle with respect to the positive X axis, or [code](1, 0)[/code] vector, in radians.
For example, [code]Vector2.RIGHT.angle()[/code] will return zero, [code]Vector2.DOWN.angle()[/code] will return [code]PI / 2[/code] (a quarter turn, or 90 degrees), and [code]Vector2(1, -1).angle()[/code] will return [code]-PI / 4[/code] (a negative eighth turn, or -45 degrees).
[url=https://raw.githubusercontent.com/RebelToolbox/RebelDocumentation/main/img/vector2_angle.png]Illustration of the returned angle.[/url]
[img caption="Illustration of the returned angle"]/img/vector2_angle.png[/img]
Equivalent to the result of [method @GDScript.atan2] when called with the vector's [member y] and [member x] as parameters: [code]atan2(y, x)[/code].
</description>
</method>
Expand All @@ -57,7 +57,7 @@ SPDX-License-Identifier: MIT
<argument index="0" name="to" type="Vector2" />
<description>
Returns the angle between the line connecting the two points and the X axis, in radians.
[url=https://raw.githubusercontent.com/RebelToolbox/RebelDocumentation/main/img/vector2_angle_to_point.png]Illustration of the returned angle.[/url]
[img caption="Illustration of the returned angle"]/img/vector2_angle_to_point.png[/img]
</description>
</method>
<method name="aspect">
Expand Down
4 changes: 2 additions & 2 deletions modules/gdscript/docs/@GDScript.xml
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ SPDX-License-Identifier: MIT
- 1.0: Linear
- Greater than 1.0 (exclusive): Ease in
[/codeblock]
[url=https://raw.githubusercontent.com/RebelToolbox/RebelDocumentation/main/img/ease_cheatsheet.png]ease() curve values cheatsheet[/url]
[img caption="ease() curve values cheatsheet"]/img/ease_cheatsheet.png[/img]
See also [method smoothstep]. If you need to perform more advanced transitions, use [Tween] or [AnimationPlayer].
</description>
</method>
Expand Down Expand Up @@ -961,7 +961,7 @@ SPDX-License-Identifier: MIT
smoothstep(0, 2, 2.0) # Returns 1.0
[/codeblock]
Compared to [method ease] with a curve value of [code]-1.6521[/code], [method smoothstep] returns the smoothest possible curve with no sudden changes in the derivative. If you need to perform more advanced transitions, use [Tween] or [AnimationPlayer].
[url=https://raw.githubusercontent.com/RebelToolbox/RebelDocumentation/main/img/smoothstep_ease_comparison.png]Comparison between smoothstep() and ease(x, -1.6521) return values[/url]
[img caption="Comparison between smoothstep() and ease(x, -1.6521) return values"]/img/smoothstep_ease_comparison.png[/img]
</description>
</method>
<method name="sqrt">
Expand Down
8 changes: 4 additions & 4 deletions tools/hooks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Additional hooks can be added by updating the `hooks` variable.
There are currently three hooks:
- pre-commit-clang-format
- pre-commit-black
- pre-commit-make-rst
- pre-commit-documentation-checks

## `pre-commit-clang-format`

Expand All @@ -40,10 +40,10 @@ If there is a difference, use the version used by CI: currently version 17.
[`black`](https://pypi.org/project/black/)
Python style checks to all Python and SCons files.

## `pre-commit-make-rst`
## `pre-commit-documentation-checks`

`pre-commit-make-rst` checks the class reference syntax.
`pre-commit-make-rst` performs a dry run of `tools/scripts/make_rst.py`.
`pre-commit-make-documentation-checks` checks the API XML documentation syntax.
`pre-commit-make-documentation-checks` performs a dry run of `tools/scripts/rst_from_xml.py`.

## `pre-commit-style-check`

Expand Down
3 changes: 1 addition & 2 deletions tools/hooks/pre-commit-documentation-checks
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ else
echo "No spelling mistakes found."
fi

python3 tools/scripts/make_rst.py docs modules --dry-run

python3 tools/scripts/rst_from_xml.py docs modules --dry-run
4 changes: 2 additions & 2 deletions tools/scripts/extract_api_strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"link",
]

# Additional heading strings added by make_rst.py.
# Additional heading strings added by rst_from_xml.py.
HEADING_STRINGS = [
"Description",
"Tutorials",
Expand Down Expand Up @@ -155,7 +155,7 @@ def create_translation_template(unique_strings_filepaths, output):
with open(output, "w", encoding="utf8") as f:
f.write(HEADER)
for string in HEADING_STRINGS:
f.write("#: tools/scripts/make_rst.py\n")
f.write("#: tools/scripts/rst_from_xml.py\n")
f.write('msgid "{}"\n'.format(string))
f.write('msgstr ""\n\n')
for string in unique_strings_filepaths:
Expand Down
Loading

0 comments on commit 5597f82

Please sign in to comment.