yaml

Author: HotKeyIt Last Modified: 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="")

For the functions's parameters and return value, please see it's source code.

Remarks

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.

For update's details and remarks related to the functions, please see the AutoHotkey Forum: http://www.autohotkey.com/forum/viewtopic.php?t=60670

License

nonexistent

Example

; #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