1yaml(n)                         YAML processing                        yaml(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       yaml - YAML Format Encoder/Decoder
9

SYNOPSIS

11       package require Tcl  8.4
12
13       package require yaml  ?0.3.3?
14
15       ::yaml::yaml2dict ?options? txt
16
17       ::yaml::yaml2huddle ?options? txt
18
19       ::yaml::setOption ?options?
20
21       ::yaml::dict2yaml dict ?indent? ?wordwrap?
22
23       ::yaml::list2yaml list ?indent? ?wordwrap?
24
25       ::yaml::huddle2yaml huddle ?indent? ?wordwrap?
26
27_________________________________________________________________
28

DESCRIPTION

30       The  yaml  package  provides  a simple Tcl-only library for parsing the
31       YAML  http://www.yaml.org/  data  exchange  format  as   specified   in
32       http://www.yaml.org/spec/1.1/.
33
34       The  yaml  package returns data as a Tcl dict.  Either the dict package
35       or Tcl 8.5 is required for use.
36

COMMANDS

38       ::yaml::yaml2dict ?options? txt
39
40       ::yaml::yaml2huddle ?options? txt
41              Parse yaml formatted text txt into a Tcl dict/huddle and  return
42              the value.
43
44              -file  txt is a filename of YAML-stream.
45
46              -stream
47                     txt is just a YAML-stream.
48
49              -types list
50                     The  list  is a type list for the yaml-scalar types.(e.g.
51                     !!str !!timestamp !!integer !!true ...)
52                      -types {timestamp integer null true false}
53                     In this case, if a string matched "timestamp",  converted
54                     to       the       TCL      internal      timestamp.(e.g.
55                     "2001-12-15T02:59:43.1Z" => 1008385183)
56
57              -m:true param
58                     The param is two elements of list for the value of  true,
59                     and considered strings.
60                      -m:true {1 {true on + yes y}}
61                     In  this  case,  the  string  "yes" found in YAML Stream,
62                     automatically converted 1.
63
64              -m:false param
65                     The param is two elements of list for the value of false,
66                     and considered strings.
67                      -m:false {0 {false off - no n}}
68
69              -m:null param
70                     The  param is two elements of list for the value of null,
71                     and considered strings.
72                      -m:null {"" {null nil "" ~}}
73
74              -validate
75                     Experiment,old: Output stream contains  YAML's-tag,  each
76                     node.
77                     % puts [::yaml::load -validate {[aaa, bbb]}]
78                     =>
79                     !!seq {{!!str aaa} {!!str bbb}}
80
81
82       ::yaml::setOption ?options?
83              Change  implicit  options  for the library.  Now, the params are
84              the same as ::yaml::yaml2dict.  Arguments of::yaml::yaml2dict is
85              more priority than this setting.
86
87       ::yaml::dict2yaml dict ?indent? ?wordwrap?
88
89       ::yaml::list2yaml list ?indent? ?wordwrap?
90
91       ::yaml::huddle2yaml huddle ?indent? ?wordwrap?
92              Convert a dict/list/huddle object into YAML stream.
93
94              indent spaces  indent  of each block node.  currently default is
95                     2.
96
97              wordwrap
98                     word wrap for YAML stream.  currently default is 40.
99

EXAMPLES

101       An example of a yaml  stream  converted  to  Tcl.   A  yaml  stream  is
102       returned as a single item with multiple elements.
103
104       {
105       --- !<tag:clarkevans.com,2002:invoice>
106       invoice: 34843
107       date   : 2001-01-23
108       bill-to: &id001
109           given  : Chris
110           family : Dumars
111           address:
112               lines: |
113                   458 Walkman Dr.
114                   Suite #292
115               city    : Royal Oak
116               state   : MI
117               postal  : 48046
118       ship-to: *id001
119       product:
120           - sku         : BL394D
121             quantity    : 4
122             description : Basketball
123             price       : 450.00
124           - sku         : BL4438H
125             quantity    : 1
126             description : Super Hoop
127             price       : 2392.00
128       tax  : 251.42
129       total: 4443.52
130       comments:
131           Late afternoon is best.
132           Backup contact is Nancy
133           Billsmer @ 338-4338.
134       }
135       =>
136       invoice 34843 date 2001-01-23 bill-to {given Chris family Dumars address {lines {458 Walkman Dr.
137       Suite #292
138       } city {Royal Oak} state MI postal 48046}} ship-to {given Chris family Dumars address {lines {458 Walkman Dr.
139       Suite #292
140       } city {Royal Oak} state MI postal 48046}} product {{sku BL394D quantity 4 description Basketball price 450.00} {sku BL4438H quantity 1 description {Super Hoop} price 2392.00}} tax 251.42 total 4443.52 comments {Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338.}
141
142       An  example  of  a  yaml  object  converted  to  Tcl.  A yaml object is
143       returned as a multi-element list (a dict).
144
145       {
146       ---
147       - [name        , hr, avg  ]
148       - [Mark McGwire, 65, 0.278]
149       - [Sammy Sosa  , 63, 0.288]
150       -
151         Mark McGwire: {hr: 65, avg: 0.278}
152         Sammy Sosa: { hr: 63, avg: 0.288}
153       }
154       =>
155       {name hr avg} {{Mark McGwire} 65 0.278} {{Sammy Sosa} 63 0.288} {{Mark McGwire} {hr 65 avg 0.278} {Sammy Sosa} {hr 63 avg 0.288}}
156
157

LIMITATIONS

159       tag parser not implemented. currentry, tags are merely ignored.
160
161       Only Anchor => Aliases ordering. back alias-referring is not supported.
162
163       Too many braces, or too few braces.
164
165       Not enough character set of line feeds. Please use only  "\n"  as  line
166       breaks.
167

BUGS, IDEAS, FEEDBACK

169       This  document,  and the package it describes, will undoubtedly contain
170       bugs and other problems.  Please report such in the  category  yaml  of
171       the          Tcllib         SF         Trackers         [http://source
172       forge.net/tracker/?group_id=12883].  Please also report any  ideas  for
173       enhancements you may have for either package and/or documentation.
174

SEE ALSO

176       base64, huddle, json
177

KEYWORDS

179       data exchange, huddle, parsing, text processing, yaml
180
182       Copyright (c) 2008 KATO Kanryu <kanryu6@users.sourceforge.net>
183
184
185
186
187yaml                                 0.3.3                             yaml(n)
Impressum