11 March 2007 - sgte Google project
I created a Google project for sgte development and a Google group for discussion.
I uploaded the files to the project:
source code and a test module.
The tests use a small library (sgeunit) I wrote when I started learning Erlang. The source of the library is included.
Here are the links:
sgte project home pagesgte google group
Comments (0) -
Leave a Comment
5 March 2007 - Update to the map code
A few days ago after some feedback from Eric Merritt I made a small change to the way the map works. It breaks the old code and I hadn't documented it yet since I was the only user. Now sgte is getting some attention on the yaws mailinglist, so it's better if I update the doc :-) .
The old map worked like this:
{ok, C} = sgte:compile("$map:{<li><b>$attr$</b></li>} names$").
sgte:render(C4, [{names, ["foo", "bar", "baz"]}]).
here the element taken from the list is implicitely called attr and it gets the values "foo", "bar", "baz".
I made a change and now I iter over a list of {key, value} tuples so I can do something like this.
{ok, C} = sgte:compile("$map:{<li><b>$first_name$ $last_name$</b></li>} names$").
sgte:render(C4, [{names, [
[{first_name, "filippo"}, {last_name, "pacini"}],
[{first_name, "foo"}, {last_name, "bar"}]
]
}]).
To get:
<li>filippo pacini</li>
<li>foo bar</li>
This seems much better than how I previously used it. I think in the future I could also support the old way it worked adding a mapList feature, or something like that.
Comments (0) -
Leave a Comment