An ordered sequence of anonymous map nodes. |
A YAML node can be one of three types: list, scalar, map. Every node may optionally have a class. |
# comment
# list An ordered sequence of zero or more nodes.
# Nodes are included by reference,
# thus they may be part of more than one list or map.
men: [tester1, tester2]
women:
- tester3
- tester4
# scalar: An ordered sequence of zero or more bits.
# Where bits are an atomic construct able to have a value of one or zero.
name: lqwangxg
career: it
age: 40
# map(key, value)
# An un-ordered sequence of zero or more (key, node) tuples
# where the key is unique within the sequence.
- {name: lqwangxg, career: it}
- name: tester1
career: test
#key: A sequence of zero or more characters.
#class: An opaque object that has a serialization which complies with the class production.The serialization model adds an anchor attribute to every node, and introduces the reference node. The reference node advertises an anchor to indicate the repetition of a node previously encountered.
#anchor An additional attribute added to each node that provides for identification of the node within a given node sequence. Only nodes which could be referenced further in the sequence must be given an anchor. It is not necessary that the anchor is unique.
# reference An additional node type consisting of an anchor which is used to indicate the repetition of the node with the same anchor most previously encountered.
# indent縮進(通常2space)でレベルを分ける
table:
- column1
- size
- type
- column2
- size
- type
--- 複数YMLDocumentを一つファイルに記載1
- stringParam1
- stringParam2
--- 複数YMLDocumentを一つファイルに記載2
[stringParam3, stringParam4]
#各行の改行を維持
--- |
先頭行にspace無しデータStart
先頭にspace有りデータ1
先頭にspace有りデータ2
先頭行にspace無しデータEnd
#最終行の改行を維持,ほかは1spaceに置換え
--- >
先頭行にspace無しデータStart
先頭にspace有りデータ
先頭行にspace無しデータEnd
#置き換え後の結果:
先頭行にspace無しデータStart 先頭にspace有りデータ 先頭行にspace無しデータEnd
#Indicators Type説明
imap ::= '%' /*indicate a map node*/
ilist ::= '@' /*indicate a list node*/
iquote ::='"' /*indicate a quoted string*/
ikey ::=':' /*separate a key from a node*/
iblk ::='|' /*indicate a block scalar */
iblkend ::='\' /*indicate end of a block*/
iescape ::='\' /*indicate an escape sequence*/
iref ::='*' /*indicate a reference node*/
iclass ::='#' /*indicate a class attribute*/
inull ::='~' /*indicate a null node*/
ianchor ::='&' /*indicate an anchor attribute*/
ibin ::='[' /*indicate begin of binary scalar*/
ibinend ::=']' /*indicate end of binary scalar*/
ireserved ::='^' | '!' | ';' | '`' | ',' | '.' | '(' | ')' | '{' | '}' /* reserved*/
#Block Scalar
first: |This is a block scalar, with significant
|whitespace, and the use of " @, etc.
|The \ is used to signify the end of the block.
| Whitespace *is* significant.
\
#Quoted Scalar
second: "Escape sequences can be used
to removed or \ add white\
space, \\ and \" must be escapted"
#Binary Scalar
binary: [R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAO
fn515eXvPz7Y6OjuDg4J+fn5OTk6enp56enmlp
aWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f
/++f/++f/++f/++f/++f/++f/++f/++SH+Dk1h
ZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLCAgjo
EwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYN
G84BwwEeECcgggoBADs=]
desc: "A binary scalar uses the base64 encoding.
Base64 strings are a sequence of base64 characters intermixed with
whitespace which is ignored by the base64 processor.
An additional constraint is that no more than 76 sequential characters
are allowed without at least one intermediate whitespace character. "
参考: https://ja.wikipedia.org/wiki/YAML
https://yaml.org/spec/history/2001-05-26.html
没有评论:
发表评论