Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions crates/typst-library/src/model/cite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ pub struct CiteElem {
#[required]
pub key: Label,

/// ページ番号や章番号などの引用の補足
/// ページ番号や章番号などの引用の補足語
///
/// [References]($ref)の構文では、角括弧で囲むことで補足を追加できます
/// [References]($ref)の構文では、角括弧で囲むことで補足語を追加できます
///
/// ```example
/// This has been proven. @distress[p.~7]
Expand Down
8 changes: 4 additions & 4 deletions crates/typst-library/src/model/figure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ pub struct FigureElem {
/// - コンテンツに関わらず特定のカウンターを強制的に使用したい場合
///
/// 種類は、エレメント関数または文字列に設定できます。
/// [`{table}`]($table)、[`{raw}`](raw)、[`{image}`](image)以外のエレメント関数に設定した場合は、図表の補足(supplement)を手動で指定する必要があります。
/// [`{table}`]($table)、[`{raw}`](raw)、[`{image}`](image)以外のエレメント関数に設定した場合は、図表の補足語(supplement)を手動で指定する必要があります。
///
/// ```example
/// #figure(
Expand All @@ -174,10 +174,10 @@ pub struct FigureElem {
/// ```
pub kind: Smart<FigureKind>,

/// 図表の補足
/// 図表の補足語
///
/// `{auto}` に設定すると、図表は、種類や[テキスト言語]($text.lang)に基づいて、正しい補足を自動的に決定しようとします
/// 独自の図表タイプを使用している場合は、補足を手動で指定する必要があります
/// `{auto}` に設定すると、図表は、種類や[テキスト言語]($text.lang)に基づいて、正しい補足語を自動的に決定しようとします
/// 独自の図表タイプを使用している場合は、補足語を手動で指定する必要があります
///
/// 関数が指定された場合、その関数は指定された種類の最初の子孫要素(通常は図の本体)に渡され、内容を返す必要があります。
///
Expand Down
56 changes: 26 additions & 30 deletions crates/typst-library/src/model/reference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,20 @@ use crate::text::TextElem;

/// ラベルや参考文献への参照。
///
/// Takes a label and cross-references it. There are two kind of references,
/// determined by its [`form`]($ref.form): `{"normal"}` and `{"page"}`.
/// ラベルを指定して、その参照を生成します。
/// 参照の[`form`]($ref.form)には`{"normal"}``{"page"}`の2種類があります。
///
/// The default, a `{"normal"}` reference, produces a textual reference to a
/// label. For example, a reference to a heading will yield an appropriate
/// string such as "Section 1" for a reference to the first heading. The
/// references are also links to the respective element. Reference syntax can
/// also be used to [cite] from a bibliography.
/// デフォルトの`{"normal"}`参照では、ラベルに対するテキスト形式の参照が作られます。
/// たとえば見出しへの参照なら、"Section 1"などのような適切な文字列が表示されます。
/// この参照は、該当する要素へのリンクとしても機能します。
/// また、参照の構文は文献リストからの引用を行う[cite]にも使用できます。
///
/// As the default form requires a supplement and numbering, the label must be
/// attached to a _referenceable element_. Referenceable elements include
/// [headings]($heading), [figures]($figure), [equations]($math.equation), and
/// [footnotes]($footnote). To create a custom referenceable element like a
/// theorem, you can create a figure of a custom [`kind`]($figure.kind) and
/// write a show rule for it. In the future, there might be a more direct way
/// to define a custom referenceable element.
/// このデフォルト形式では補足語と番号が必要なため、ラベルは _参照可能な要素_ に付けなくてはなりません。
/// 参照可能な要素としては、
/// [headings]($heading)、[figures]($figure)、[equations]($math.equation)、[footnotes]($footnote)
/// などがあります。
/// 定理(theorem)などのカスタム参照可能要素を作成したい場合は、カスタム[`kind`]($figure.kind)の図表として作成し、それに対応するshowルールを書くことで作成可能です。
/// 将来的には、カスタム参照可能要素をもっと直接的に定義する方法が導入されるかもしれません。
///
/// # 例
/// ```example
Expand Down Expand Up @@ -61,11 +59,11 @@ use crate::text::TextElem;
/// ```
///
/// # Syntax
/// This function also has dedicated syntax: A `{"normal"}` reference to a
/// label can be created by typing an `@` followed by the name of the label
/// (e.g. `[= Introduction <intro>]` can be referenced by typing `[@intro]`).
/// この機能には専用の記法も用意されています。
/// `{"normal"}` の参照を作成するためには`@`に続けてラベル名を入力します。
/// (たとえば`[= Introduction <intro>]`というラベルを参照するには`[@intro]`と入力します。)
///
/// 補足をカスタマイズするには
/// 補足語をカスタマイズするには
/// `[@intro[Chapter]]`のように、参照の後に角括弧でコンテンツを追加します。
///
/// # カスタム
Expand Down Expand Up @@ -106,18 +104,16 @@ pub struct RefElem {
#[required]
pub target: Label,

/// 参照の補足
/// 参照の補足語
///
/// If the [`form`]($ref.form) is set to `{"normal"}`:
/// - For references to headings or figures, this is added before the
/// referenced number.
/// - For citations, this can be used to add a page number.
/// [`form`]($ref.form)が`{"normal"}`で設定されている場合は以下のとおりです。
/// - 見出しや図への参照では、この値が参照番号の前に追加されます。
/// - 文献引用の場合は、ページ番号などを追記するのに使えます。
///
/// If the [`form`]($ref.form) is set to `{"page"}`, then this is added
/// before the page number of the label referenced.
/// もし[`form`]($ref.form)`{"page"}`に設定されている場合には、
/// 参照先ラベルのページ番号の前にこの値が追加されます。
///
/// If a function is specified, it is passed the referenced element and
/// should return content.
/// また、関数が指定されている場合は、それに参照先の要素が渡され、戻り値のコンテンツが補足語となります。
///
/// ```example
/// #set heading(numbering: "1.")
Expand All @@ -140,7 +136,7 @@ pub struct RefElem {
#[borrowed]
pub supplement: Smart<Option<Supplement>>,

/// The kind of reference to produce.
/// 生成する参照の種類
///
/// ```example
/// #set page(numbering: "1")
Expand Down Expand Up @@ -360,10 +356,10 @@ cast! {
/// The form of the reference.
#[derive(Debug, Default, Copy, Clone, Eq, PartialEq, Hash, Cast)]
pub enum RefForm {
/// Produces a textual reference to a label.
/// ラベルに対して文字列での参照を生成します。
#[default]
Normal,
/// Produces a page reference to a label.
/// ラベルに対してページ番号での参照を生成します。
Page,
}

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: |
| markup | マークアップ | 标记 / 标记模式 | Typstのデフォルトモード |
| script | スクリプト | 脚本 / 脚本模式 | Typstのスクリプトモード、「#」で始まる行 |
| figure | 図表 | 图表 | キャプション付きの図表、`image`ではない |
| supplement | 補足語 | | [参照]($ref)されるものの種類を指す文字列、「図1」の「図」など |
Loading