Skip to content

Commit

Permalink
Merge pull request #7418 from imclerran/issue-7417
Browse files Browse the repository at this point in the history
Fix for issue 7417 - Fix links generated for submodules
  • Loading branch information
lukewilliamboswell authored Dec 28, 2024
2 parents 3c49462 + 7c611c2 commit 005e9ad
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions crates/docs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ pub fn generate_docs_html(root_file: PathBuf, build_dir: &Path) {
exposed_module_docs
.iter()
.map(|(_, module)| {
let href = module.name.as_str();
let module_href = module.name.replace('.', "/");
let href = module_href.as_str();

format!(r#"<link rel="prefetch" href="{href}"/>"#)
})
Expand Down Expand Up @@ -237,7 +238,7 @@ fn render_package_index(docs_by_module: &[(ModuleId, ModuleDocumentation)]) -> S
push_html(
&mut link_buf,
"a",
[("href", module.name.as_str())],
[("href", module.name.replace('.', "/").as_str())],
module.name.as_str(),
);

Expand Down Expand Up @@ -462,7 +463,8 @@ fn render_sidebar<'a, I: Iterator<Item = &'a ModuleDocumentation>>(modules: I) -
let mut buf = String::new();

for module in modules {
let href = module.name.as_str();
let module_href = module.name.replace('.', "/");
let href = module_href.as_str();
let mut sidebar_entry_content = String::new();
let mut module_link_content = String::new();

Expand Down Expand Up @@ -573,7 +575,7 @@ fn render_search_type_ahead<'a, I: Iterator<Item = &'a ModuleDocumentation>>(mod

let mut entry_href = String::new();

entry_href.push_str(module_name);
entry_href.push_str(&module_name.replace('.', "/"));
entry_href.push('#');
entry_href.push_str(&doc_def.name);

Expand Down

0 comments on commit 005e9ad

Please sign in to comment.