Yaml-scalars-and-tags

提供:Dev Guides
移動先:案内検索

YAML-スカラーとタグ

Scalars in YAML are written in block format using a literal type which is denoted as(|). It denotes line breaks count. In YAML, scalars are written in folded style (>) where each line denotes a folded space which ends with an empty line *or more indented* line.

新しい行は、リテラルに保存されています-

ASCII Art
--- |
\//||\/||
//|| ||__

折り畳まれた改行は、以下に示すように、*インデントされた行*と*空白行*のために保持されます-

>
Sammy Sosa completed another
fine season with great stats.
63 Home Runs
0.288 Batting Average
What a year!

YAMLフロースカラーには、プレーンスタイルと引用符付きスタイルが含まれます。 二重引用符スタイルには、さまざまなエスケープシーケンスが含まれます。 フロースカラーには複数の行を含めることができます。この構造では、改行は常に折り畳まれます。

plain:
This unquoted scalar
spans many lines.
quoted: "So does this
quoted scalar.\n"

YAMLでは、タグなしのノードは特定のタイプのアプリケーションで指定されます。 タグ仕様の例では、通常、YAMLタグリポジトリに seq、map および str タイプを使用します。 タグは、以下のように言及されている例として表されます-

整数タグ

これらのタグには整数値が含まれます。 数値タグとも呼ばれます。

canonical: 12345
decimal: +12,345
sexagecimal: 3:25:45
octal: 014
hexadecimal: 0xC

浮動小数点数

これらのタグには、10進値と指数値が含まれます。 また、指数タグとも呼ばれます。

canonical: 1.23015e+3
exponential: 12.3015e+02
sexagecimal: 20:30.15
fixed: 1,230.15
negative infinity: -.inf
not a number: .NaN

その他のタグ

さまざまな整数値、浮動値、文字列値が埋め込まれています。 したがって、その他のタグと呼ばれます。

null: ~
true: y
false: n
string: '12345'