Skip to content
Closed
Changes from 2 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
74 changes: 37 additions & 37 deletions crates/typst/src/model/footnote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,30 @@ use crate::text::{SuperElem, TextElem, TextSize};
use crate::utils::NonZeroExt;
use crate::visualize::{LineElem, Stroke};

/// A footnote.
/// 脚注。
///
/// Includes additional remarks and references on the same page with footnotes.
/// A footnote will insert a superscript number that links to the note at the
/// bottom of the page. Notes are numbered sequentially throughout your document
/// and can break across multiple pages.
/// 脚注を用いて追加のコメントや参考文献を同じページに記述します。
/// 脚注は、ページ下部の注釈にリンクする上付きの番号を挿入します。
/// 注釈は文書全体で連続してナンバリングされ、
/// 複数のページにまたがることができます。
///
/// To customize the appearance of the entry in the footnote listing, see
/// [`footnote.entry`]($footnote.entry). The footnote itself is realized as a
/// normal superscript, so you can use a set rule on the [`super`] function to
/// customize it. You can also apply a show rule to customize only the footnote
/// marker (superscript number) in the running text.
/// 脚注リストの項目の外観をカスタマイズするには、
/// [`footnote.entry`]($footnote.entry)を参照してください。
/// 脚注自体は通常の上付き文字として実現されているため、
/// [`super`]関数に対してsetルールを適用してカスタマイズ出来ます。
/// また、showルールを適用して、本文中の脚注マーカー(上付き番号)のみをカスタマイズすることもできます。
///
/// # Example
/// #
/// ```example
/// Check the docs for more details.
/// #footnote[https://typst.app/docs]
/// ```
///
/// The footnote automatically attaches itself to the preceding word, even if
/// there is a space before it in the markup. To force space, you can use the
/// string `[#" "]` or explicit [horizontal spacing]($h).
/// 脚注は、マークアップにおいて前の単語との間にスペースがあったとしても、
/// 自動的にその単語に付加されます。
/// スペースを強制するには、文字列の`[#" "]`や明示的な[horizontal spacing]($h)を使用できます。
///
/// By giving a label to a footnote, you can have multiple references to it.
/// 脚注にラベルをつけることにより、脚注に対して複数の参照を持つことができます。
///
/// ```example
/// You can edit Typst documents online.
Expand All @@ -46,18 +46,18 @@ use crate::visualize::{LineElem, Stroke};
/// And the online app. #footnote(<fn>)
/// ```
///
/// _Note:_ Set and show rules in the scope where `footnote` is called may not
/// apply to the footnote's content. See [here][issue] for more information.
/// _注意:_ `footnote`が呼び出されるスコープ内でのsetルールやshowルールは、脚注の内容に適用されない場合があります。
/// 詳細については[こちら][issue]を参照してください。
///
/// [issue]: https://github.com/typst/typst/issues/1467#issuecomment-1588799440
#[elem(scope, Locatable, Show, Count)]
pub struct FootnoteElem {
/// How to number footnotes.
/// 脚注のナンバリング方法。
///
/// By default, the footnote numbering continues throughout your document.
/// If you prefer per-page footnote numbering, you can reset the footnote
/// [counter] in the page [header]($page.header). In the future, there might
/// be a simpler way to achieve this.
/// デフォルトでは、脚注のナンバリングは文書全体で連続します。
/// ページごとに脚注のナンバリングを行いたい場合は、
/// ページの[header]($page.header)で脚注の[counter]をリセットできます。
/// 将来的には、これを簡単に実現する方法が提供されるかもしれません。
///
/// ```example
/// #set footnote(numbering: "*")
Expand All @@ -70,8 +70,8 @@ pub struct FootnoteElem {
#[default(Numbering::Pattern(NumberingPattern::from_str("1").unwrap()))]
pub numbering: Numbering,

/// The content to put into the footnote. Can also be the label of another
/// footnote this one should point to.
/// 脚注に挿入するコンテンツ。
/// この脚注が参照すべき他の脚注のラベルを指定することもできます。
#[required]
pub body: FootnoteBody,
}
Expand Down Expand Up @@ -174,10 +174,10 @@ cast! {
v: Label => Self::Reference(v),
}

/// An entry in a footnote list.
/// 脚注リストの項目。
///
/// This function is not intended to be called directly. Instead, it is used in
/// set and show rules to customize footnote listings.
/// この関数は直接呼び出されることを意図されていません。
/// 代わりに、setルールやshowルールで脚注リストをカスタマイズするために使用されます。
///
/// ```example
/// #show footnote.entry: set text(red)
Expand All @@ -187,14 +187,14 @@ cast! {
/// has red text!
/// ```
///
/// _Note:_ Footnote entry properties must be uniform across each page run (a
/// page run is a sequence of pages without an explicit pagebreak in between).
/// For this reason, set and show rules for footnote entries should be defined
/// before any page content, typically at the very start of the document.
/// _注意:_ 脚注項目のプロパティは、
/// 各ページラン(ページ間に明示的な改ページがないページ群)全体で一貫している必要があります。
/// このため、脚注項目に対するsetルールやshowルールは通常はドキュメントの最初の部分など、
/// ページコンテンツの前に定義される必要があります。
#[elem(name = "entry", title = "Footnote Entry", Show, ShowSet)]
pub struct FootnoteEntry {
/// The footnote for this entry. It's location can be used to determine
/// the footnote counter state.
/// この項目の脚注。
/// その位置を指定して、脚注カウンターの状態を決定する事ができます。
///
/// ```example
/// #show footnote.entry: it => {
Expand All @@ -212,7 +212,7 @@ pub struct FootnoteEntry {
#[required]
pub note: Packed<FootnoteElem>,

/// The separator between the document body and the footnote listing.
/// 文書の本文と脚注リストの間の区切り記号。
///
/// ```example
/// #set footnote.entry(
Expand All @@ -236,7 +236,7 @@ pub struct FootnoteEntry {
)]
pub separator: Content,

/// The amount of clearance between the document body and the separator.
/// 文書の本文と区切り記号の間の余白の量。
///
/// ```example
/// #set footnote.entry(clearance: 3em)
Expand All @@ -250,7 +250,7 @@ pub struct FootnoteEntry {
#[resolve]
pub clearance: Length,

/// The gap between footnote entries.
/// 脚注項目同士の間隔。
///
/// ```example
/// #set footnote.entry(gap: 0.8em)
Expand All @@ -263,7 +263,7 @@ pub struct FootnoteEntry {
#[resolve]
pub gap: Length,

/// The indent of each footnote entry.
/// 各脚注項目の字下げ。
///
/// ```example
/// #set footnote.entry(indent: 0em)
Expand Down