Fix links
This commit is contained in:
parent
b9c0fd87d3
commit
618beb1ac1
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ fn category_page(resolver: &dyn Resolver, category: &str) -> PageModel {
|
||||
// Skip grouped functions.
|
||||
if grouped
|
||||
.iter()
|
||||
.flat_map(|merge| &merge.functions)
|
||||
.flat_map(|group| &group.functions)
|
||||
.any(|f| f == info.name)
|
||||
{
|
||||
continue;
|
||||
|
@ -36,7 +36,7 @@ math: |
|
||||
{ x in RR | x "is natural" } $
|
||||
```
|
||||
|
||||
Math mode makes a wide selection of [symbols]($category/math/symbols) like
|
||||
Math mode makes a wide selection of [symbols]($category/symbols/sym) like
|
||||
`pi`, `dot.op`, or `RR` available. Many mathematical symbols are available in
|
||||
different variants. You can select between different variants by applying
|
||||
[modifiers]($type/symbol) to the symbol. Typst further recognizes a number of
|
||||
|
@ -239,8 +239,8 @@ $ v := vec(x_1, x_2, x_3) $
|
||||
```
|
||||
|
||||
Some functions are only available within math mode. For example, the
|
||||
[`cal`]($func/cal) function is used to typeset calligraphic letters commonly used for
|
||||
sets. The [math section of the reference]($category/math) provides a
|
||||
[`cal`]($func/cal) function is used to typeset calligraphic letters commonly
|
||||
used for sets. The [math section of the reference]($category/math) provides a
|
||||
complete list of all functions that math mode makes available.
|
||||
|
||||
One more thing: Many symbols, such as the arrow, have a lot of variants. You can
|
||||
@ -251,8 +251,9 @@ name:
|
||||
$ a arrow.squiggly b $
|
||||
```
|
||||
|
||||
This notation is also available in markup mode, but the complete symbol name
|
||||
with modifiers must then be enclosed in colons. See the documentation of the [text]($category/text) and [math sections]($category/math) for more details.
|
||||
This notation is also available in markup mode, but the symbol name must be
|
||||
preceded with `#sym.` there. See the [symbols section]($category/symbols/sym)
|
||||
for a list of all available symbols.
|
||||
|
||||
## Review
|
||||
You have now seen how to write a basic document in Typst. You learned how to
|
||||
|
Loading…
Reference in New Issue
Block a user