mirror of
https://github.com/typst/typst
synced 2025-07-27 14:27:56 +08:00
Merge 77db88eb98f08b707c6f0a4cee9ac9b99bb71a38 into e9f1b5825a9d37ca0c173a7b2830ba36a27ca9e0
This commit is contained in:
commit
a71ad9b90a
@ -415,6 +415,8 @@ impl Counter {
|
||||
/// - If it is a [selector], counts through elements that matches with the
|
||||
/// selector. For example,
|
||||
/// - provide an element function: counts elements of that type,
|
||||
/// - provide a [`where`]($function.where) selector:
|
||||
/// counts a type of elements with specific fields,
|
||||
/// - provide a [`{<label>}`]($label): counts elements with that label.
|
||||
key: CounterKey,
|
||||
) -> Counter {
|
||||
|
@ -397,6 +397,12 @@ impl LocalName for PageElem {
|
||||
/// == Compound Theory
|
||||
/// In 1984, the first ...
|
||||
/// ```
|
||||
///
|
||||
/// Note that even without manual page breaks, the content will be automatically
|
||||
/// paginated based on the size of the content and the page. You could adjust
|
||||
/// [costs]($text.costs) to fine-tune the algorithm that prevents widows and
|
||||
/// orphans. You can also set [the page height]($page.height) to `{auto}` to
|
||||
/// let the page grow dynamically until a manual page break occurs.
|
||||
#[elem(title = "Page Break")]
|
||||
pub struct PagebreakElem {
|
||||
/// If `{true}`, the page break is skipped if the current page is already
|
||||
|
@ -189,6 +189,37 @@ pub struct FigureElem {
|
||||
/// supplement: [Atom],
|
||||
/// )
|
||||
/// ```
|
||||
///
|
||||
/// If you want to modify a counter to skip a number or reset the counter,
|
||||
/// you can access the [counter] of each kind of figures from
|
||||
/// a [`where`]($function.where) selector:
|
||||
///
|
||||
/// - For [tables]($table): `{counter(figure.where(kind: table))}`
|
||||
/// - For [images]($image): `{counter(figure.where(kind: image))}`
|
||||
/// - For a custom kind: `{counter(figure.where(kind: kind))}`
|
||||
///
|
||||
/// ```example
|
||||
/// #figure(
|
||||
/// table(columns: 2, $n$, $1$),
|
||||
/// caption: [The first table.],
|
||||
/// )
|
||||
///
|
||||
/// #counter(figure.where(kind: table)).update(41)
|
||||
///
|
||||
/// #figure(
|
||||
/// table(columns: 2, $n$, $42$),
|
||||
/// caption: [Jumped to the 42nd table.],
|
||||
/// )
|
||||
///
|
||||
/// #figure(
|
||||
/// rect[Image],
|
||||
/// caption: [And it doesn't affect images.],
|
||||
/// )
|
||||
/// ```
|
||||
///
|
||||
/// There is also a convenience field called `counter` to simplify general
|
||||
/// [show rules]($styling/#show-rules). There is an example
|
||||
/// [show rule that customizes `figure.caption`]($figure.caption.body) below.
|
||||
pub kind: Smart<FigureKind>,
|
||||
|
||||
/// The figure's supplement.
|
||||
@ -228,8 +259,8 @@ pub struct FigureElem {
|
||||
/// Convenience field to get access to the counter for this figure.
|
||||
///
|
||||
/// The counter only depends on the `kind`:
|
||||
/// - For (tables)[@table]: `{counter(figure.where(kind: table))}`
|
||||
/// - For (images)[@image]: `{counter(figure.where(kind: image))}`
|
||||
/// - For [tables]($table): `{counter(figure.where(kind: table))}`
|
||||
/// - For [images]($image): `{counter(figure.where(kind: image))}`
|
||||
/// - For a custom kind: `{counter(figure.where(kind: kind))}`
|
||||
///
|
||||
/// These are the counters you'll need to modify if you want to skip a
|
||||
|
@ -411,6 +411,9 @@ pub struct TextElem {
|
||||
/// = Einleitung
|
||||
/// In diesem Dokument, ...
|
||||
/// ```
|
||||
///
|
||||
/// The language code is case-insensitive, and will be normalized to
|
||||
/// lowercase before made available to the [context]($context).
|
||||
#[default(Lang::ENGLISH)]
|
||||
#[ghost]
|
||||
pub lang: Lang,
|
||||
@ -418,6 +421,9 @@ pub struct TextElem {
|
||||
/// An [ISO 3166-1 alpha-2 region code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
|
||||
///
|
||||
/// This lets the text processing pipeline make more informed choices.
|
||||
///
|
||||
/// The region code is case-insensitive, and will be normalized to
|
||||
/// uppercase before made available to the [context]($context).
|
||||
#[ghost]
|
||||
pub region: Option<Region>,
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user