-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Escape +/- key
in constant descriptions to avoid issues when generating RST
#82697
Escape +/- key
in constant descriptions to avoid issues when generating RST
#82697
Conversation
…inferred as bullet lists for the KEY_PLUS and KEY_MINUS enumerations after generating an .rst file from @GlobalScope.xml
+/- key
in constant descriptions to avoid issues when generating RST
It is also possible to fix this by editing doc/classes/@GlobalScope.xml in the godot repo. Specifically by subsituting the This is how cases like I personally think this is cleaner since it does not add any additional code and it mimics the approach made in other parts of the xml file |
This would pair well with #67037 , and with both merged we could also escape * the same way. |
@AsperTheDog I gave it a shot, but I didn't end up being successful. I did the following tests without any of the
The first approach didn't work since the \ character is also escaped in the The second approach didn't work since it will generate an unescaped - character in the generated .rst file, leading to an output of I've included a screenshot for completeness: Do you know if I'm missing something? To your point, I would prefer not to add any additional code to make_rst.py, so I'd really like this alternative approach to work. 🙏 |
@transistasis it seems like it does not work as I expected. My bad. This issue is only present in the online docs, and not in the local docs of the engine. To test it looked as it should I compiled the engine and ran it with --doctool. Since the docs appeared to be correct I assumed the fix was working correctly. So the approach I mention doesn't work. |
@AsperTheDog It's all good, thanks for taking another look at it! If you have any other ideas, let me know and I'll try them out. 🤘😼 |
NumPad keys' descriptions avoid this by starting with a word.
I think this can be done here as well, for all related descriptions. The proposed hack I don't think is a good idea, as it's based on a fragile relationship with the current phrasing, and a more general solution is not possible, because the format is currently ambiguous. |
Hey all, this is my first pull request here.
Problem Description
This PR fixes the problems raised in #8127. The issues stem from the + and - characters used in the
KEY_PLUS
andKEY_MINUS
enumeration descriptions not being escaped after the make_rst.py script is run. This results in the + and - characters being interpreted as bullet lists, rather than characters, as can be seen here.Problem Solution
The cleanest solution that I can think of is to add additional escape logic to the
escape_rst
method in make_rst.py for the + and - characters by searching for the strings"+ key"
and"- key"
. This will allow theKEY_PLUS
andKEY_MINUS
enumeration descriptions to display correctly after generating a .rst file from @GlobalScope.xml. This solution will be transparent to all of the other .xml files in the project.I looked at trying to escape these characters in the same way that the * is handled, but found that this can break bullet lists in .rst files generated from other .xml files, such as EditorCommandPalatte.xml. As a result, the proposed solution is the cleanest way that I can think of to fix the problem.
Results
Upon diffing the generated
_build/rst
folders before and after applying the fix, onlyclass_@globalscope.rst
is modified:Please let me know if someone has a cleaner solution!