Uh oh!
There was an error while loading. Please reload this page.
Highlight crate links like normal links - #75842
Conversation
rust-highfive
commented
Aug 23, 2020
r? @ollie27 (rust_highfive has picked a reviewer for you, use r? to override) |
camelid
commented
Aug 23, 2020
@rustbot modify labels: T-rustdoc |
Uh oh!
There was an error while loading. Please reload this page.
camelid
commented
Aug 23, 2020
I'm waiting on a rustc build to see if this works - for some reason it's rebuilding LLVM... :( |
85482a6 to
4419e04Comparecamelid
commented
Aug 23, 2020
Fixed formatting |
| format!("<li><a href=\"{}index.html\">{}</li>", ensure_trailing_slash(s), s) | ||
| format!( | ||
| "<li><a class=\"mod\" href=\"{}index.html\">{}</a></li>", | ||
| ensure_trailing_slash(s), | ||
| s | ||
| ) |
There was a problem hiding this comment.
Using class mod should probably be temporary (I should probably be a separate class crate). However, the ul that this is in (starting on line 1065) already has class mod!
There was a problem hiding this comment.
I added a missing closing </a> tag also.
There was a problem hiding this comment.
In the other link class="mod" was also added.
camelid
commented
Aug 23, 2020
r? @jyn514 |
jyn514
commented
Aug 23, 2020
I think ollie might actually have been a better reviewer, I don't know this part of the code very well ... let's since he has so much free time ;) |
GuillaumeGomez
commented
Aug 23, 2020
Looks good to me. Is there anything else to be done here?
😝 |
camelid
commented
Aug 23, 2020
I think I should add a new CSS class |
camelid
commented
Aug 23, 2020
Actually, since we want the styles to be the same, it might be better to not add a separate class since it might get out of date if the module styles are updated. |
camelid
commented
Aug 23, 2020
I wasn't able to verify that the styling looks correct since I've been having some issues building the compiler (https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/ICE.20when.20compiling). |
One final thing which is somewhat unrelated is that the title, description, and heading for the index page are all different: rust/src/librustdoc/html/render/mod.rs Lines 1047 to 1057 in d02a209 It might be good to consolidate them, but that could be done in a separate PR. |
| .map(|s| { | ||
| format!("<li><a href=\"{}index.html\">{}</li>", ensure_trailing_slash(s), s) | ||
| format!( | ||
| "<li><a class=\"mod\" href=\"{}index.html\">{}</a></li>", |
There was a problem hiding this comment.
| "<li><a class=\"mod\" href=\"{}index.html\">{}</a></li>", | |
| "<li><a class='mod' href='{}index.html'>{}</a></li>", |
There was a problem hiding this comment.
We're using double quotes everywhere else, so for consistency, I think we should keep them.
There was a problem hiding this comment.
I saw that we also use single quotes for quite a lot of place too. From what I see, maybe more than double quotes.
There was a problem hiding this comment.
179 single quotes and 230 double quotes (looking for =' and =\"). I wonder how we ended up in this mess... We should clean that up.
There was a problem hiding this comment.
Why not just make all single quotes? We don't need to escape that way..
There was a problem hiding this comment.
Had some cases where I saw:
<div onclick='func('clicked');'>...</div>
So mostly irrelevant here but still afraid me. Even more considering that for now, the generated UI isn't tested.
There was a problem hiding this comment.
We could change that to
<div onclick="func('clicked');">...</div>
There was a problem hiding this comment.
Or to:
<div onclick='func("clicked");'>...</div>
😛
camelid
commented
Aug 26, 2020
@GuillaumeGomez I think this PR is ready. Do you want to merge? @pickfire or someone else could do a follow-up PR to make the quote character consistent in this file if that's what's decided upon. |
jyn514
commented
Aug 26, 2020
Can you post a screenshot of what this now looks like? |
GuillaumeGomez
commented
Aug 26, 2020
Yes, just a screenshot before/after and then I think we're good to go! |
camelid
commented
Aug 26, 2020
Still waiting on my build :) The before is at https://doc.rust-lang.org/nightly/nightly-rustc: |
camelid
commented
Aug 26, 2020
Wow, my build is taking forever. I just stopped and started it in case that’s the issue. |
jyn514
commented
Aug 26, 2020
Yes, that sounds right. Try running with |
camelid
commented
Aug 26, 2020
I have several gigabytes of free memory though, so would that still help? |
jyn514
commented
Aug 27, 2020
@bors r+ |
bors
commented
Aug 27, 2020
📌 Commit 4419e04 has been approved by |
camelid
commented
Aug 27, 2020
Never could get my build to finish :( |
bors
commented
Aug 27, 2020
bors
commented
Aug 27, 2020
☀️ Test successful - checks-actions, checks-azure |
GuillaumeGomez
commented
Aug 27, 2020
@camelid In case you want to retry to build doc locally: |
camelid
commented
Aug 30, 2020
@GuillaumeGomez Thanks, I'll try that! |
camelid
commented
Aug 30, 2020
The build completed successfully, but that index page is not the crate index, so it is not affected by this PR. I think I have to document the compiler to get the right page. |
jyn514
commented
Aug 30, 2020
@camelid try |
camelid
commented
Aug 30, 2020
@jyn514 I'm curious: is there a reason that is not the default? |
jyn514
commented
Aug 30, 2020
Not sure, sorry. You could ask on zulip. My guess though is that most of the compiler docs are maintained out of tree at rustc-dev-guide.rust-lang.org so people don't look at the API docs as much? I use the online ones a lot though. |
Use double quote for rustdoc html r? `@GuillaumeGomez` Feels scary without escaping stuff when I looked at the code, probably susceptible to XSS. Follow up of rust-lang#75842


Fixes#75823.
Cc @jyn514