The new version can be downloaded here as always:
http://code.google.com/p/sgte/downloads/list
Changes from 0.5 version to 0.6 (this were yet undocumented):
- add support for nested proplists as data
An example:
1> {ok, T} = sgte:compile("$foo.bar$").
2> sgte:render(T, [{foo, [{bar, "a string"}]}]).
"a string"
This should ease handling of complex data structures.
- add API: sgte:rec_to_name_kv/2 and sgte:rec_to_kv/2
The main use meant for the two is this:
Suppose you have a record
-record(person, {name, age}).
P = #person{name="filippo", age=35}.
Calling
sgte:rec_to_name_kv(Person, record_info(fields, person)).
returns
{person, [{name, "filippo"},{age, 35}]}
And you can access the values as $person.name$ and $person.age$
using rec_to_kv would return instead [{name, "filippo"}, {age, 35}]
and you can choose the atom you prefer to reer to the data.
In the future I'll probably try to add parse_transforms as an
alternative to the two calls.
- add sgte_dict to manage that. This is basically a wrapper around dict
- switch to eunit for unit testing
Changes from 0.6 to 0.7:
- Sean Hinde modified the parser to store the compiled template in
binary format instead of strings. He also removed sme calls in
sgte_render to lists:flatten.
With these two changes now sgte_render returns a deep list of binaries
and strings. Yaws can manage this without problem. Other users might get
into problems so I added two new API call:
render_str/2 and render_str/3: works as render worked previously
returning a string
render_bin/2 and render_bin/3: return a list of binaries
- other minor changes to run sgte in erlhive
As you see there have been a lot of changes and probably there'll be
bugs to fix. You report them here or on the issue tracker:
http://code.google.com/p/sgte/issues/list
Best regards,
filippo