Skip to content
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

Highlight crate links like normal links #75842

Merged
merged 1 commit into from
Aug 27, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,11 @@ themePicker.onblur = handleThemeButtonsBlur;
krates
.iter()
.map(|s| {
format!("<li><a href=\"{}index.html\">{}</li>", ensure_trailing_slash(s), s)
format!(
"<li><a class=\"mod\" href=\"{}index.html\">{}</a></li>",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"<li><a class=\"mod\" href=\"{}index.html\">{}</a></li>",
"<li><a class='mod' href='{}index.html'>{}</a></li>",

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're using double quotes everywhere else, so for consistency, I think we should keep them.

Copy link
Contributor

@pickfire pickfire Aug 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw that we also use single quotes for quite a lot of place too. From what I see, maybe more than double quotes.

Copy link
Member

@GuillaumeGomez GuillaumeGomez Aug 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

179 single quotes and 230 double quotes (looking for =' and =\"). I wonder how we ended up in this mess... We should clean that up.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just make all single quotes? We don't need to escape that way..

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could change that to

<div onclick="func('clicked');">...</div>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or to:

<div onclick='func("clicked");'>...</div>

😛

ensure_trailing_slash(s),
s
)
Comment on lines -1069 to +1073
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a missing closing </a> tag also.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the other link class="mod" was also added.

})
.collect::<String>()
);
Expand Down