Intercalate rendering of attributes

12 views
Skip to first unread message

Javier Calzado Sánchez

unread,
Jan 4, 2012, 7:26:34 AM1/4/12
to JavaScript Templates Engine PURE
Hi all the people,

I'm trying to render attributes interleaving, at the moment only
obtained the rendering of attributes via block, here's my code:

<html>
<head>
<script src="http://code.jquery.com/jquery-latest.min.js"></
script>
<script src="pure.js"></script>
</head>

<body>

<div class="template">
<li></li><img src="">
</div>

<script type="text/javascript" charset="utf-8">

var data = $.getJSON("http://api.flickr.com/services/feeds/
photos_public.gne?&tags=r2d2&tagmode=all&format=json&jsoncallback=?",
function(json){

directive = {
li:{
'it<-items':{
'.':'it.title'
}
},

img:{
'it<-items':{
'.@src':'it.media.m'
}
}
}

$('div.template').render(json, directive);
});
</script>


</body>
</html>


Sautti a tutti

Mic (BeeBole)

unread,
Jan 4, 2012, 7:38:22 AM1/4/12
to JavaScript Templates Engine PURE
Are you trying to do something like this?
https://gist.github.com/1559863

The IMG should be inside the LI.
And you can use +, to prepend/append text to a node.


On Jan 4, 1:26 pm, Javier Calzado Sánchez <jcalzadosanc...@gmail.com>
wrote:

Javier Calzado Sánchez

unread,
Jan 4, 2012, 8:44:32 AM1/4/12
to JavaScript Templates Engine PURE
Works! Thank you very much for the idea!

Congratulations for you work.

Cheers

On 4 ene, 13:38, "Mic (BeeBole)" <tch...@gmail.com> wrote:
> Are you trying to do something like this?https://gist.github.com/1559863
Reply all
Reply to author
Forward
0 new messages