diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-02-14 14:39:19 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-02-14 14:39:19 +0100 |
| commit | 618beb1ac1cd04b203654d5a019c0ed04e4c26cb (patch) | |
| tree | dffebe04a10cfdc9a046938c3c0653e0c203bdc3 /docs/src/html.rs | |
| parent | b9c0fd87d304942db315ca6fdbccddf233d045cd (diff) | |
Fix links
Diffstat (limited to 'docs/src/html.rs')
| -rw-r--r-- | docs/src/html.rs | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/docs/src/html.rs b/docs/src/html.rs index 9fbb4fd8..ac48952d 100644 --- a/docs/src/html.rs +++ b/docs/src/html.rs @@ -125,15 +125,10 @@ impl<'a> Handler<'a> { "unsupported link type: {ty:?}", ); - let mut link = self + *dest = self .handle_link(dest) - .unwrap_or_else(|| panic!("invalid link: {dest}")); - - if !link.contains('#') && !link.ends_with('/') { - link.push('/'); - } - - *dest = link.into(); + .unwrap_or_else(|| panic!("invalid link: {dest}")) + .into(); } // Inline raw. @@ -226,16 +221,36 @@ impl<'a> Handler<'a> { let info = func.info()?; route.push_str(info.category); route.push('/'); - route.push_str(name); - route.push('/'); - if let Some(param) = param { - route.push_str("#parameters--"); - route.push_str(param); + + if let Some(group) = GROUPS + .iter() + .find(|group| group.functions.iter().any(|func| func == info.name)) + { + route.push_str(&group.name); + route.push_str("/#"); + route.push_str(info.name); + if let Some(param) = param { + route.push_str("-parameters--"); + route.push_str(param); + } else { + route.push_str("-summary"); + } + } else { + route.push_str(name); + route.push('/'); + if let Some(param) = param { + route.push_str("#parameters--"); + route.push_str(param); + } } } else { route.push_str(rest); } + if !route.contains('#') && !route.ends_with('/') { + route.push('/'); + } + Some(route) } } |
