-
Notifications
You must be signed in to change notification settings - Fork 13.3k
In [-] doc buttons, change hyphen ‘-’ to minus ‘−’ #24797
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
Conversation
The minus sign ‘−’ is the same width as the plus sign ‘+’, so the button’s transition between the two symbols will look more smooth.
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see CONTRIBUTING.md for more information. |
You can also use |
HTML files should be updated too. |
I agree with @killercup that it may be best to use the HTML escape sequences here instead as otherwise it's pretty subtle to miss in a refactoring. |
So that if people accidentally delete the character, they won’t re-type it as a hyphen, which would cause bugs. I changed ‘+’ too, even though it won’t be re-typed incorrectly, so that it is easier to see when plus is used as a symbol for the button, and when it is used as an operator in code. It also makes it clearer that the use of an entity for minus is on purpose, so people won’t be tempted to replace the entity incorrectly with a hyphen character.
Thanks for the comments. I have made those changes. |
📌 Commit 72e8f7b has been approved by |
The minus sign ‘−’ is the same width as the plus sign ‘+’, so the button’s transition between the two symbols will look slightly smoother. If you don’t want to use literal Unicode characters, I can change ‘−’ to `\u2212`. I’m not starting with that suggestion because ‘−’ is easier to read and understand, and if I used `\u2212`, it would probably be necessary to also comment the usage on each line to explain what character is being used.
The toggle all button (upper right hand corner) seems to have broken. |
The problem seems to be (see this StackOverflow question) that jQuery sees the unicode character, not the html entity. Rolling back the last commit 72e8f7b fixes this problem. |
Or using "\u2212" for the minus sign, which is less likely to be deleted accidentally. |
the toggle [-]/[+] is broken: #24918 |
How about revert this, and use a monospaced font (to make |
The cause of the problem is described here: rust-lang#24797 (comment) . I tested this new `main.js` by changing the `main.js` content of a rendered docs page to this new content. The [−] button worked again.
My change in #24797 had a bug, described in that issue’s comments, and first discovered in issue #24918. This fixes it. I tested this new `main.js` by changing the `main.js` content of [a rendered docs page](https://doc.rust-lang.org/std/option/) to this new content. The ‘[−]’ button worked again. I am also including another related fix, because it would require manual merging if I made a separate pull request for it. The page-global ‘[−]’ button currently adds `#` to the end of the URL whenever it is clicked. I am changing its `href` from `#` to `javascript:void(0)` (the same as the `href` for section-specific ‘[−]’ links) to fix that.
The minus sign ‘−’ is the same width as the plus sign ‘+’, so the button’s transition between the two symbols will look slightly smoother.
If you don’t want to use literal Unicode characters, I can change ‘−’ to
\u2212
. I’m not starting with that suggestion because ‘−’ is easier to read and understand, and if I used\u2212
, it would probably be necessary to also comment the usage on each line to explain what character is being used.