# yaml

作者: HotKeyIt 最近更新时间: 20100725

Yaml has got very simple syntax.
It is easy to read and use.
Yaml parser was build to give more possibilities than ini.
You can create Yaml database from text as well as from file, you can add, set get, delete keys, clone the database, insert existing sets of data to an existing database and much more.

Yaml_Add(pYaml,key1="",key2="")
Yaml_Assign(pYaml,parent!="" ? (parent "." 0)
Yaml_Clone(pYaml)
Yaml_Delete(pYaml,key)
Yaml_DeleteAll(pYaml)
Yaml_Dump(pYaml,ByRef Output,key="")
Yaml_Exist(pYaml,Key="")
Yaml_Get(pYaml,key1="")
Yaml_Init(Yaml_File="?",pointerYaml="")
Yaml_Insert(_pYaml,Yaml_File,MainItem0)
Yaml_Save(pYaml,ToFile="")
Yaml_Set(pYaml,key1="",key2="")

关于函数的参数和返回值, 请参阅其源码.

#### 备注

To get all files from documentation, I *Tuncay* have saved the first page with ScrapBook, setting to follow 1 level deep on links. Then exported the saved page with all files.
Look at http://yaml.kwiki.org/index.cgi?YamlInFiveMinutes for learning about Yaml.

关于此函数(集)的更新细节和注意事项, 请参见 AutoHotkey 论坛: http://www.autohotkey.com/forum/viewtopic.php?t=60670

#### 许可

不存在

#### 示例

    ; #Include yaml.ahk
    #NoEnv
    SendMode Input
    SetWorkingDir %A_ScriptDir%

    ; Example copied from posting of HotKeyIt.

    yamlText= ;example yaml data
    (
    `%yaml
    --- testdata, this is a comment only
    Settings:
      Size:
        width: 1
        height: 2
      Colors:
        background: blue
        foreground: black
        text: white
      ButtonText:
        Button1: AutoHotkey
        Button2: OK
    )
    yml:=Yaml_Init(yamlText) ;create database from text
    MsgBox % Yaml_Get(yml,"Settings.Colors.background") ;get a key
    Yaml_Add(yml,"Settings.ButtonText.Button3","Exit") ;add a key
    MsgBox % Yaml_Save(yml) ;Show dump of database