stuppid_bot

Untitled

May 26th, 2013
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. function foo(str, context) {
  2. return str.replace(/\{(\w+(?:\.\w+)*)\}/g, function(match, name) {
  3. var keys = name.split('.'), k, v = context;
  4. while ( k = keys.shift() ) {
  5. if (v[k] == undefined) {
  6. v = '';
  7. break;
  8. }
  9. v = v[k];
  10. }
  11. return v;
  12. });
  13. }
  14.  
  15. function parse(str) {
  16. var re = /\{\{(.?)\}\}|\{%(.*?)%\}/g;
  17.  
  18.  
  19. }
  20.  
  21. template = '<ul class="comments">{% for comment in comments %}<li><a href="{{comment.author_link}}">{{comment.author_name}}</a>, <time>{{comment.datetime}}</time><p>{{comment.text}}</p></li>{% /for %}</ul>';
Advertisement
Add Comment
Please, Sign In to add comment