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

Clean up rustdoc IDs #86819

Merged
merged 1 commit into from
Jul 7, 2021
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
15 changes: 11 additions & 4 deletions src/librustdoc/html/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1358,7 +1358,10 @@ pub struct IdMap {

fn init_id_map() -> FxHashMap<String, usize> {
let mut map = FxHashMap::default();
// This is the list of IDs used by rustdoc templates.
// This is the list of IDs used in Javascript.
map.insert("help".to_owned(), 1);
// This is the list of IDs used in HTML generated in Rust (including the ones
// used in tera template files).
map.insert("mainThemeStyle".to_owned(), 1);
map.insert("themeStyle".to_owned(), 1);
map.insert("theme-picker".to_owned(), 1);
Expand All @@ -1375,14 +1378,14 @@ fn init_id_map() -> FxHashMap<String, usize> {
map.insert("rustdoc-vars".to_owned(), 1);
map.insert("sidebar-vars".to_owned(), 1);
map.insert("copy-path".to_owned(), 1);
map.insert("help".to_owned(), 1);
map.insert("TOC".to_owned(), 1);
map.insert("render-detail".to_owned(), 1);
// This is the list of IDs used by rustdoc sections.
// This is the list of IDs used by rustdoc sections (but still generated by
// rustdoc).
map.insert("fields".to_owned(), 1);
map.insert("variants".to_owned(), 1);
map.insert("implementors-list".to_owned(), 1);
map.insert("synthetic-implementors-list".to_owned(), 1);
map.insert("foreign-impls".to_owned(), 1);
Copy link
Member

@jyn514 jyn514 Jul 3, 2021

Choose a reason for hiding this comment

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

What does "rustdoc templates" mean in this context? I assume it's not related to Tera templates since we only just now started migrating those. https://github.com/rust-lang/rust/blob/398616f4d4b6854d37db994049a186711a05cc76/src/librustdoc/html/markdown.rs#L1361

Copy link
Member Author

Choose a reason for hiding this comment

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

It refers to the generation of HTML in rustdoc. Not the best naming but I guess at the time it sounded like a good enough idea. :)

Copy link
Member

Choose a reason for hiding this comment

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

Gotcha. Do you mind updating the comment to be more clear? Something like "This is the list of IDs used in HTML generated in Rust" and then "in JavaScript" respectively.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure.

map.insert("implementations".to_owned(), 1);
map.insert("trait-implementations".to_owned(), 1);
map.insert("synthetic-implementations".to_owned(), 1);
Expand All @@ -1393,6 +1396,10 @@ fn init_id_map() -> FxHashMap<String, usize> {
map.insert("provided-methods".to_owned(), 1);
map.insert("implementors".to_owned(), 1);
map.insert("synthetic-implementors".to_owned(), 1);
map.insert("trait-implementations-list".to_owned(), 1);
map.insert("synthetic-implementations-list".to_owned(), 1);
map.insert("blanket-implementations-list".to_owned(), 1);
map.insert("deref-methods".to_owned(), 1);
map
}

Expand Down