@@ -6,24 +6,24 @@ use crate::engine::Engine;
6
6
use crate :: foundations:: { func, scope, Str , Value } ;
7
7
use crate :: loading:: { DataSource , Load , Readable } ;
8
8
9
- /// Reads structured data from a YAML file.
9
+ /// YAMLファイルから構造化データを読み込む。
10
10
///
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タグは無視されますが、読み込まれた値はそのまま保持されます。
18
18
///
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
+ /// 近似値になる可能性があることに留意してください。
21
21
///
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
+ /// サブマッピングのシーケンスが含まれています。
25
25
///
26
- /// # Example
26
+ /// # 例
27
27
/// ```example
28
28
/// #let bookshelf(contents) = {
29
29
/// for (author, works) in contents {
@@ -41,7 +41,7 @@ use crate::loading::{DataSource, Load, Readable};
41
41
#[ func( scope, title = "YAML" ) ]
42
42
pub fn yaml (
43
43
engine : & mut Engine ,
44
- /// A [path ]($syntax/#paths) to a YAML file or raw YAML bytes.
44
+ /// YAMLファイルの[パス ]($syntax/#paths)、または生のYAMLバイト列。
45
45
source : Spanned < DataSource > ,
46
46
) -> SourceResult < Value > {
47
47
let data = source. load ( engine. world ) ?;
@@ -52,21 +52,21 @@ pub fn yaml(
52
52
53
53
#[ scope]
54
54
impl yaml {
55
- /// Reads structured data from a YAML string/bytes.
55
+ /// YAMLの文字列やバイト列から構造化データを読み込む。
56
56
#[ func( title = "Decode YAML" ) ]
57
- #[ deprecated = "`yaml.decode` is deprecated, directly pass bytes to `yaml` instead " ]
57
+ #[ deprecated = "`yaml.decode`は非推奨です。代わりにバイト列を直接 `yaml`に渡してください。 " ]
58
58
pub fn decode (
59
59
engine : & mut Engine ,
60
- /// YAML data.
60
+ /// YAMLデータ。
61
61
data : Spanned < Readable > ,
62
62
) -> SourceResult < Value > {
63
63
yaml ( engine, data. map ( Readable :: into_source) )
64
64
}
65
65
66
- /// Encode structured data into a YAML string.
66
+ /// 構造化データをYAML文字列にエンコードする。
67
67
#[ func( title = "Encode YAML" ) ]
68
68
pub fn encode (
69
- /// Value to be encoded.
69
+ /// エンコード対象の値。
70
70
value : Spanned < Value > ,
71
71
) -> SourceResult < Str > {
72
72
let Spanned { v : value, span } = value;
0 commit comments