-
Notifications
You must be signed in to change notification settings - Fork 13
/docs/reference/introspection/location
の翻訳
#320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 6 commits
d9999d6
846224d
26c73cc
25b1bbe
dc5c701
86574bc
ce990e7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -8,19 +8,17 @@ use crate::foundations::{func, scope, ty, Repr}; | |||||
use crate::layout::Position; | ||||||
use crate::model::Numbering; | ||||||
|
||||||
/// Identifies an element in the document. | ||||||
/// 文書中の要素の識別。 | ||||||
/// | ||||||
/// A location uniquely identifies an element in the document and lets you | ||||||
/// access its absolute position on the pages. You can retrieve the current | ||||||
/// location with the [`here`] function and the location of a queried or shown | ||||||
/// element with the [`location()`]($content.location) method on content. | ||||||
/// locationは文書中の要素を一意に識別し、ページ中での絶対位置へのアクセスを提供します。 | ||||||
/// [`here`]関数を用いて現在位置を取得可能です。 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
/// また、検索した位置や表示された要素の位置は、コンテンツの[`location()`]($content.location)メソッドを使って取得できます。 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
/// | ||||||
/// # Locatable elements { #locatable } | ||||||
/// Currently, only a subset of element functions is locatable. Aside from | ||||||
/// headings and figures, this includes equations, references, quotes and all | ||||||
/// elements with an explicit label. As a result, you _can_ query for e.g. | ||||||
/// [`strong`] elements, but you will find only those that have an explicit | ||||||
/// label attached to them. This limitation will be resolved in the future. | ||||||
/// # ロケータブル要素 { #locatable } | ||||||
/// 現在、要素関数の一部のみがロケータブルです。 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ここは訳としては間違ってはいないのですが、説明になっていないので
Suggested change
で良いですかね? |
||||||
/// 見出しと図表の他に、数式、参照、引用、全ての明示的なラベルを持つ要素が該当します。 | ||||||
ultimatile marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
/// したがって、例えば[`strong`]要素に対してクエリが実行 _可能_ ですが、見つかるのは明示的にラベルが付けられたもののみです。 | ||||||
/// この制限は将来的に解消される予定です。 | ||||||
ultimatile marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
#[ty(scope)] | ||||||
#[derive(Copy, Clone, Eq, PartialEq, Hash)] | ||||||
pub struct Location(u128); | ||||||
|
@@ -48,16 +46,13 @@ impl Location { | |||||
|
||||||
#[scope] | ||||||
impl Location { | ||||||
/// Returns the page number for this location. | ||||||
/// このlocationのページ番号を返します。 | ||||||
ultimatile marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
/// | ||||||
/// Note that this does not return the value of the [page counter]($counter) | ||||||
/// at this location, but the true page number (starting from one). | ||||||
/// このlocationの[ページカウンター]($counter)の値を返すのではなく、(1始まりの)実際のページ番号を返すことに注意してください。 | ||||||
/// | ||||||
/// If you want to know the value of the page counter, use | ||||||
/// `{counter(page).at(loc)}` instead. | ||||||
/// ページカウンターの値が知りたい場合は代わりに`{counter(page).at(loc)}`を使用してください。 | ||||||
ultimatile marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
/// | ||||||
/// Can be used with [`here`] to retrieve the physical page position | ||||||
/// of the current context: | ||||||
/// [`here`]と組み合わせることで現在のコンテキストにおける実際のページ番号が取得できます。 | ||||||
/// ```example | ||||||
/// #context [ | ||||||
/// I am located on | ||||||
|
@@ -69,24 +64,20 @@ impl Location { | |||||
engine.introspector.page(self) | ||||||
} | ||||||
|
||||||
/// Returns a dictionary with the page number and the x, y position for this | ||||||
/// location. The page number starts at one and the coordinates are measured | ||||||
/// from the top-left of the page. | ||||||
/// このlocationのページ番号とx座標とy座標を辞書で返します。 | ||||||
/// ページ番号は1始まりで、座標はページの左上から測ります。 | ||||||
ultimatile marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
/// | ||||||
/// If you only need the page number, use `page()` instead as it allows | ||||||
/// Typst to skip unnecessary work. | ||||||
/// ページ番号のみに興味がある場合は、代わりに`page()`を使用すると不要な処理を省略できます。 | ||||||
#[func] | ||||||
pub fn position(self, engine: &mut Engine) -> Position { | ||||||
engine.introspector.position(self) | ||||||
} | ||||||
|
||||||
/// Returns the page numbering pattern of the page at this location. This | ||||||
/// can be used when displaying the page counter in order to obtain the | ||||||
/// local numbering. This is useful if you are building custom indices or | ||||||
/// outlines. | ||||||
/// このlocationのページ番号の番号付けパターンを返します。 | ||||||
/// これにより、ページカウンターの表示する際に、その位置での番号付けを取得できます。 | ||||||
/// これは独自の索引やアウトラインを作成する場合に便利です。 | ||||||
ultimatile marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
/// | ||||||
/// If the page numbering is set to `{none}` at that location, this function | ||||||
/// returns `{none}`. | ||||||
/// その位置でのページの番号付けが`{none}`に設定されていた場合、`{none}`を返します。 | ||||||
ultimatile marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
#[func] | ||||||
pub fn page_numbering(self, engine: &mut Engine) -> Option<Numbering> { | ||||||
engine.introspector.page_numbering(self).cloned() | ||||||
|
Uh oh!
There was an error while loading. Please reload this page.