@@ -6,24 +6,24 @@ use crate::engine::Engine;
66use crate :: foundations:: { func, scope, Str , Value } ;
77use crate :: loading:: { DataSource , Load , Readable } ;
88
9- /// Reads structured data from a YAML file.
9+ /// YAMLファイルから構造化データを読み込む。
1010///
11- /// The file must contain a valid YAML object or array. YAML mappings will be
12- /// converted into Typst dictionaries, and YAML sequences will be converted into
13- /// Typst arrays. Strings and booleans will be converted into the Typst
14- /// equivalents, null-values (`null`, `~` or empty ``) will be converted into
15- /// ` {none}`, and numbers will be converted to floats or integers depending on
16- /// whether they are whole numbers. Custom YAML tags are ignored, though the
17- /// loaded value will still be present.
11+ /// 読み込むファイルには有効なYAMLオブジェクトまたは配列が含まれていなければなりません。
12+ /// YAMLのマッピングはTypstの辞書に、
13+ /// YAMLのシーケンスはTypstの配列に変換されます。
14+ /// 文字列やブール値はTypstの対応する型に変換され、
15+ /// ヌル値(`null`、`~`、または空の``)は` {none}`に、
16+ /// 数値は整数値であれば整数型に、そうでなければ浮動小数点数型に変換されます。
17+ /// カスタムYAMLタグは無視されますが、読み込まれた値はそのまま保持されます。
1818///
19- /// Be aware that integers larger than 2<sup>63</sup>-1 will be converted to
20- /// floating point numbers, which may give an approximative value.
19+ /// 2<sup>63</sup>-1より大きな整数は浮動小数点数に変換されるため、
20+ /// 近似値になる可能性があることに留意してください。
2121///
22- /// The YAML files in the example contain objects with authors as keys,
23- /// each with a sequence of their own submapping with the keys
24- /// "title" and "published"
22+ /// この例におけるYAMLファイルには著者名をキーとするオブジェクトが含まれており、
23+ /// それぞれの著者には`title`と`published`というキーを持つ
24+ /// サブマッピングのシーケンスが含まれています。
2525///
26- /// # Example
26+ /// # 例
2727/// ```example
2828/// #let bookshelf(contents) = {
2929/// for (author, works) in contents {
@@ -41,7 +41,7 @@ use crate::loading::{DataSource, Load, Readable};
4141#[ func( scope, title = "YAML" ) ]
4242pub fn yaml (
4343 engine : & mut Engine ,
44- /// A [path ]($syntax/#paths) to a YAML file or raw YAML bytes.
44+ /// YAMLファイルの[パス ]($syntax/#paths)、または生のYAMLバイト列。
4545 source : Spanned < DataSource > ,
4646) -> SourceResult < Value > {
4747 let data = source. load ( engine. world ) ?;
@@ -52,21 +52,21 @@ pub fn yaml(
5252
5353#[ scope]
5454impl yaml {
55- /// Reads structured data from a YAML string/bytes.
55+ /// YAMLの文字列やバイト列から構造化データを読み込む。
5656 #[ func( title = "Decode YAML" ) ]
57- #[ deprecated = "`yaml.decode` is deprecated, directly pass bytes to `yaml` instead " ]
57+ #[ deprecated = "`yaml.decode`は非推奨です。代わりにバイト列を直接 `yaml`に渡してください。 " ]
5858 pub fn decode (
5959 engine : & mut Engine ,
60- /// YAML data.
60+ /// YAMLデータ。
6161 data : Spanned < Readable > ,
6262 ) -> SourceResult < Value > {
6363 yaml ( engine, data. map ( Readable :: into_source) )
6464 }
6565
66- /// Encode structured data into a YAML string.
66+ /// 構造化データをYAML文字列にエンコードする。
6767 #[ func( title = "Encode YAML" ) ]
6868 pub fn encode (
69- /// Value to be encoded.
69+ /// エンコード対象の値。
7070 value : Spanned < Value > ,
7171 ) -> SourceResult < Str > {
7272 let Spanned { v : value, span } = value;
0 commit comments