Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions crates/typst-library/src/model/enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ use crate::model::{
/// ```
///
/// setルールを用いることで、
/// すべてのリストを異なるナンバリングスタイルに簡単に切り替えることができます
/// すべてのリストを異なる番号付けスタイルに簡単に切り替えることができます
/// ```example
/// #set enum(numbering: "a)")
///
Expand All @@ -64,7 +64,7 @@ use crate::model::{
/// この関数には専用の構文もあります。
///
/// - 行の先頭にプラス記号をつけると、
/// 自動的にナンバリングされたリスト項目が作成されます
/// 自動的に番号付けされたリスト項目が作成されます
/// - 行の先頭に数字とピリオドを付けると、
/// 明示的に番号を指定したリスト項目が作成されます。
///
Expand Down Expand Up @@ -97,10 +97,10 @@ pub struct EnumElem {
#[default(true)]
pub tight: bool,

/// リストをどのようにナンバリングするかを指定します
/// [ナンバリングパターンまたは関数]($numbering)を受け付けます。
/// リストをどのように番号付けするかを指定します
/// [番号付けパターンまたは関数]($numbering)を受け付けます。
///
/// ナンバリングのパターンに複数のカウント記号が含まれている場合
/// 番号付けのパターンに複数のカウント記号が含まれている場合
/// それらはネストされたリストに適用されます。
/// 関数が指定された場合、`full`が`{false}`の場合は1つの引数を受け取り、`{true}`の場合は複数の引数を受け取ります。
///
Expand Down Expand Up @@ -132,7 +132,7 @@ pub struct EnumElem {
pub start: Smart<usize>,

/// 親リストの番号も含めて、
/// 完全なナンバリングを表示するかどうかを指定します
/// 完全な番号付けを表示するかどうかを指定します
///
///
/// ```example
Expand All @@ -145,7 +145,7 @@ pub struct EnumElem {
#[default(false)]
pub full: bool,

/// このリストのナンバリングを逆順にするかどうかを指定します
/// このリストの番号付けを逆順にするかどうかを指定します
///
/// ```example
/// #set enum(reversed: true)
Expand All @@ -160,7 +160,7 @@ pub struct EnumElem {
#[resolve]
pub indent: Length,

/// 各項目のナンバリングと本文の間隔を指定します
/// 各項目の番号付けと本文の間隔を指定します
#[resolve]
#[default(Em::new(0.5).into())]
pub body_indent: Length,
Expand Down
65 changes: 26 additions & 39 deletions crates/typst-library/src/model/numbering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,15 @@ use crate::engine::Engine;
use crate::foundations::{cast, func, Context, Func, Str, Value};
use crate::text::Case;

/// Applies a numbering to a sequence of numbers.
/// 順序に応じた番号付け。
///
/// A numbering defines how a sequence of numbers should be displayed as
/// content. It is defined either through a pattern string or an arbitrary
/// function.
/// 番号付けは、一連の数値をコンテンツとしてどのように表示するかを定義します。
/// これはパターン文字列または任意の関数によって指定されます。
///
/// A numbering pattern consists of counting symbols, for which the actual
/// number is substituted, their prefixes, and one suffix. The prefixes and the
/// suffix are repeated as-is.
/// 番号付けパターンは、数値を置き換えるためのカウント記号、それらに付ける接頭辞、そして1つの接尾辞から構成されます。
/// 接頭辞と接尾辞は、そのままの形で繰り返し使用されます。
///
/// # Example
/// #
/// ```example
/// #numbering("1.1)", 1, 2, 3) \
/// #numbering("1.a.i", 1, 2) \
Expand All @@ -35,15 +33,12 @@ use crate::text::Case;
/// )
/// ```
///
/// # Numbering patterns and numbering functions
/// There are multiple instances where you can provide a numbering pattern or
/// function in Typst. For example, when defining how to number
/// [headings]($heading) or [figures]($figure). Every time, the expected format
/// is the same as the one described below for the
/// [`numbering`]($numbering.numbering) parameter.
/// # 番号付けのパターン指定と関数指定
/// Typstではパターン指定または関数指定で番号付けを定義できる場面がいくつかあります。
/// たとえば、[見出し]($heading)や[図表]($figure)などに番号を付ける際に使用します。
/// いずれの場合も、指定の形式は後述する[`numbering`]($numbering.numbering)パラメーターと同じです。
///
/// The following example illustrates that a numbering function is just a
/// regular [function] that accepts numbers and returns [`content`].
/// 次の例は、番号付け用の関数が、単に数値を受け取って[`content`]を返す通常の[function]であることを示しています。
/// ```example
/// #let unary(.., last) = "|" * last
/// #set heading(numbering: unary)
Expand All @@ -55,35 +50,27 @@ use crate::text::Case;
pub fn numbering(
engine: &mut Engine,
context: Tracked<Context>,
/// Defines how the numbering works.
/// 番号付けの表示形式を定義します。
///
/// **Counting symbols** are `1`, `a`, `A`, `i`, `I`, `α`, `Α`, `一`, `壹`,
/// `あ`, `い`, `ア`, `イ`, `א`, `가`, `ㄱ`, `*`, `١`, `۱`, `१`, `১`, `ক`,
/// `①`, and `⓵`. They are replaced by the number in the sequence,
/// preserving the original case.
/// **カウント記号** として使用できるパターン文字は `1`, `a`, `A`, `i`, `I`, `α`, `Α`, `一`, `壹`, `あ`, `い`, `ア`, `イ`, `א`, `가`, `ㄱ`, `*`, `١`, `۱`, `१`, `১`, `ক`, `①`, `⓵`があります。
/// これらの文字は、大文字・小文字を維持したまま、対応する順序の番号文字に置き換えられます。
///
/// The `*` character means that symbols should be used to count, in the
/// order of `*`, `†`, `‡`, `§`, `¶`, `‖`. If there are more than six
/// items, the number is represented using repeated symbols.
/// 記号`*`は `*`, `†`, `‡`, `§`, `¶`, `‖`の順序で番号付けすることを意味します。
/// 項目が6つ以上ある場合は、記号を繰り返し使用して番号を表現します。
///
/// **Suffixes** are all characters after the last counting symbol. They are
/// repeated as-is at the end of any rendered number.
/// **接尾辞** とは、最後のカウント記号の後ろに置く文字列です。
/// これらは、生成された番号文字の末尾にそのまま追加されます。
///
/// **Prefixes** are all characters that are neither counting symbols nor
/// suffixes. They are repeated as-is at in front of their rendered
/// equivalent of their counting symbol.
/// **接頭辞** は、カウント記号でも接尾辞でもない文字列です。
/// それぞれのカウント記号の前に、そのままの形で繰り返し表示されます。
///
/// This parameter can also be an arbitrary function that gets each number
/// as an individual argument. When given a function, the `numbering`
/// function just forwards the arguments to that function. While this is not
/// particularly useful in itself, it means that you can just give arbitrary
/// numberings to the `numbering` function without caring whether they are
/// defined as a pattern or function.
/// このパラメータには、数値を個別の引数として受け取る任意の関数も指定できます。
/// 関数が与えられた場合、`numbering`関数はその引数をそのまま関数に渡します。
/// これ自体は特に便利というわけではありませんが、番号付けがパターン指定であっても関数指定であっても、番号付けの定義を`numbering`関数に適用できるという意味を持ちます。
numbering: Numbering,
/// The numbers to apply the numbering to. Must be positive.
///
/// If `numbering` is a pattern and more numbers than counting symbols are
/// given, the last counting symbol with its prefix is repeated.
/// 番号付けを適用する対象の数値。正の数で与えてください。
///
/// 番号付けがパターン指定であり、カウント記号よりも多くの数値が指定された場合、最後のカウント記号とその接頭辞が繰り返されます。
#[variadic]
numbers: Vec<usize>,
) -> SourceResult<Value> {
Expand Down
1 change: 1 addition & 0 deletions docs/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ description: |
| figure | 図表 | キャプション付きの図表、`image`ではない |
| table | 表 | データや情報を整理して表示する要素 |
| supplement | 補足語 | [参照]($ref)されるものの種類を指す文字列、「図1」の「図」など |
| numbering | 番号付け | [見出し]($heading/#parameters-numbering)や[図表]($figure/#parameters-numbering)、[番号付きリスト]($enum/#parameters-numbering)などの番号の書式を定義する方法 |
2 changes: 1 addition & 1 deletion website/translation-status.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"/docs/reference/model/heading/": "translated",
"/docs/reference/model/link/": "translated",
"/docs/reference/model/enum/": "translated",
"/docs/reference/model/numbering/": "untranslated",
"/docs/reference/model/numbering/": "translated",
"/docs/reference/model/outline/": "untranslated",
"/docs/reference/model/par/": "translated",
"/docs/reference/model/parbreak/": "translated",
Expand Down