文法とか
Clouder氏が運営する有名ブログ Clouder::Blogger の 2006年4月5日 のエントリ のエントリを見て思った事をメモ。
YAMLで改行を含む値を表現する方法
key: | this is example this is exampleってやるみたい。
改行を含む値を表現するには '|' を使う以外に、下記の方法もある。
key : "this is example?nthis is example"
※例によって・・・「¥」が「?」になってる orz
逆に改行を無視する方法として、下記の二つの方法がある。
foo : 'this is example ?n this is example' bar : > this is example this is example
ちなみに今一番知りたいのは、YAMLファイルで上の方で定義した値を下の方で使いたい場合どうするか。教えてエロい人!
foo: 1 bar: 2 baz: ***←ここでfooとかbarの値を使いたい。例えば 123 を表現したいとか。「$foo _ $bar _ 3」とかできないのかなと
頑張っても、こんな感じゃないかなぁと。
foo : &foo 1 bar : &bar 2 baz : - *foo - *bar - 3
私も方法が知りたい・・・。
上記全ての参照元はココ→ http://yaml.org/spec/current.html