mirror of
https://github.com/typst/typst
synced 2025-05-19 11:35:27 +08:00
Docs fixes
This commit is contained in:
parent
987e97cc2c
commit
9c29dbf84f
@ -180,8 +180,8 @@ fn category_page(resolver: &dyn Resolver, category: &str) -> PageModel {
|
|||||||
// Add groups.
|
// Add groups.
|
||||||
for mut group in GROUPS.iter().filter(|g| g.category == category).cloned() {
|
for mut group in GROUPS.iter().filter(|g| g.category == category).cloned() {
|
||||||
let mut focus = module;
|
let mut focus = module;
|
||||||
if group.name == "calc" {
|
if matches!(group.name.as_str(), "calc" | "sys") {
|
||||||
focus = get_module(focus, "calc").unwrap();
|
focus = get_module(focus, &group.name).unwrap();
|
||||||
group.functions = focus
|
group.functions = focus
|
||||||
.scope()
|
.scope()
|
||||||
.iter()
|
.iter()
|
||||||
@ -369,8 +369,8 @@ fn param_model(resolver: &dyn Resolver, info: &ParamInfo) -> ParamModel {
|
|||||||
let mut types = vec![];
|
let mut types = vec![];
|
||||||
let mut strings = vec![];
|
let mut strings = vec![];
|
||||||
casts(resolver, &mut types, &mut strings, &info.input);
|
casts(resolver, &mut types, &mut strings, &info.input);
|
||||||
if !strings.is_empty() && !types.contains(&"string") {
|
if !strings.is_empty() && !types.contains(&"str") {
|
||||||
types.push("string");
|
types.push("str");
|
||||||
}
|
}
|
||||||
types.sort_by_key(|ty| type_index(ty));
|
types.sort_by_key(|ty| type_index(ty));
|
||||||
|
|
||||||
|
@ -9,15 +9,18 @@ use super::{cast, func, scope, ty, Repr};
|
|||||||
use crate::diag::{bail, error, StrResult};
|
use crate::diag::{bail, error, StrResult};
|
||||||
use crate::util::pretty_array_like;
|
use crate::util::pretty_array_like;
|
||||||
|
|
||||||
/// A version, with any number of components.
|
/// A version with an arbitrary number of components.
|
||||||
|
///
|
||||||
|
/// The first three components have names that can be used as fields: `major`,
|
||||||
|
/// `minor`, `patch`. All following components do not have names.
|
||||||
///
|
///
|
||||||
/// The list of components is semantically extended by an infinite list of
|
/// The list of components is semantically extended by an infinite list of
|
||||||
/// zeros. This means that, for example, `0.8` is the same as `0.8.0`. As a
|
/// zeros. This means that, for example, `0.8` is the same as `0.8.0`. As a
|
||||||
/// special case, the empty version (that has no components at all) is the same
|
/// special case, the empty version (that has no components at all) is the same
|
||||||
/// as `0`, `0.0`, `0.0.0`, and so on.
|
/// as `0`, `0.0`, `0.0.0`, and so on.
|
||||||
///
|
///
|
||||||
/// The first three components have names: `major`, `minor`, `patch`. All
|
/// You can convert a version to an array of explicitly given components using
|
||||||
/// components after that do not have names.
|
/// the [`array`]($array) constructor.
|
||||||
#[ty(scope)]
|
#[ty(scope)]
|
||||||
#[derive(Debug, Default, Clone, Hash)]
|
#[derive(Debug, Default, Clone, Hash)]
|
||||||
#[allow(clippy::derived_hash_with_manual_eq)]
|
#[allow(clippy::derived_hash_with_manual_eq)]
|
||||||
@ -88,10 +91,10 @@ impl Version {
|
|||||||
version
|
version
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get a component of a version.
|
/// Retrieves a component of a version.
|
||||||
///
|
///
|
||||||
/// Always non-negative. Returns `0` if the version isn't specified to the
|
/// The returned integer is always non-negative. Returns `0` if the version
|
||||||
/// necessary length.
|
/// isn't specified to the necessary length.
|
||||||
#[func]
|
#[func]
|
||||||
pub fn at(
|
pub fn at(
|
||||||
&self,
|
&self,
|
||||||
|
@ -109,8 +109,19 @@
|
|||||||
category: foundations
|
category: foundations
|
||||||
path: ["calc"]
|
path: ["calc"]
|
||||||
description: |
|
description: |
|
||||||
Calculations and processing of numeric values.
|
Module for calculations and processing of numeric values.
|
||||||
|
|
||||||
These functions are part of the `calc` module and not imported by default.
|
These definitions are part of the `calc` module and not imported by default.
|
||||||
In addition to the functions listed below, the `calc` module also defines
|
In addition to the functions listed below, the `calc` module also defines
|
||||||
the constants `pi`, `tau`, `e`, `inf`, and `nan`.
|
the constants `pi`, `tau`, `e`, `inf`, and `nan`.
|
||||||
|
|
||||||
|
- name: sys
|
||||||
|
display: System
|
||||||
|
category: foundations
|
||||||
|
path: ["sys"]
|
||||||
|
description: |
|
||||||
|
Module for system interactions.
|
||||||
|
|
||||||
|
Currently, this module defines a single item: The `sys.version` constant
|
||||||
|
(of type [`version`]($version)), that specifies the currently active
|
||||||
|
Typst compiler version.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user