码迷,mamicode.com
首页 > 其他好文 > 详细

YAML Tutorial

时间:2015-10-02 13:47:02      阅读:335      评论:0      收藏:0      [点我收藏+]

标签:

YAML Rules

  • Applicable YAML files: all files with a .yml extension.
    • Essentials uses a config.yml file.
  • Tabs are NOT allowed, use spaces ONLY.
  • You MUST indent your properties and lists with 1 or more spaces.
  • All keys/properties are case-sensitive. ("ThIs", is not the same as "thiS")

YAML Parser

ALWAYS check your YAML config files against this parser:  YAML ParserWhen using the parser,  CORRECT output looks like this:  Image:Output.pngThe file used for the tutorial and for the output is here:  HelloWorld


Text Editor Use

Please use  notepad++ (free) or another program to convert your TABs to spaces if you want to easily edit your YAML config files using the TAB key. If you do  NOT have a program which can convert TABs to spaces, then  do NOT use the TAB key to indent your YAML.


Within  notepad++ Click Settings  -> Preferences  -> Language Menu/Tab Settings, which will take you to the following screen. 技术分享


YAML Key-Property Structure Tutorial

技术分享
技术分享
Notice that the properties are spaced 2 from the margin. This is called indenting. YAML is very strict with indentation and it MUST be done every time you add a new property to a key.


技术分享
技术分享
Notice that this key-property structure and the above one are similar, but are fundamentally different (by YAML standards that is).


"The keys helloworld and HelloWorld are identical except for their case. Don‘t forget this. YAML will treat these keys as two separate and unrelated keys."


技术分享
技术分享
Take notice of the different types of values and how you‘re able to use them with stand-alone keys. No, you do not need the keyword key for those to be valid keys. Keys can have any name as long as the name only contains letters.


技术分享
技术分享
Your lists structure must look IDENTICAL to the one below or errors will occur. You might be able to get away with a little more indentation before the "-", but that‘s it.

YAML Tutorial

标签:

原文地址:http://my.oschina.net/uniquejava/blog/513190

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!