Development build 586e1bd4
Typst文档简体中文版v0.15.1 + dev 586e1bd4

version0.9.0起可用Go to source

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 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 as 0, 0.0, 0.0.0, and so on.

The current version of the Typst compiler is available as sys.version.

You can convert a version to an array of explicitly given components using the array constructor.

构造函数
Question mark
0.9.0起可用Go to source

Creates a new version.

It can have any number of components (even zero).

Expand展开示例:Constructing versions
#version() \ #version(1) \ #version(1, 2, 3, 4) \ #version((1, 2, 3, 4)) \ #version((1, 2), 3)

As a practical use case, this allows comparing the current version (sys.version) to a specific one.

Expand展开示例:Comparing with the current version
Current version: #sys.version \ #(sys.version >= version(0, 14, 0)) \ #(version(3, 2, 0) > version(4, 1, 0))
version(..intarray) → version

components
int or array
必需参数
Question mark
位置参数
Question mark
变长参数
Question mark

The components of the version (array arguments are flattened)

定义
Question mark

at0.9.0起可用Go to source

Retrieves a component of a version.

The returned integer is always non-negative. Returns 0 if the version isn’t specified to the necessary length.

self.at(int) → int

index
int
必需参数
Question mark
位置参数
Question mark

The index at which to retrieve the component. If negative, indexes from the back of the explicitly given components.