Created
May 6, 2011 12:07
-
-
Save insin/958838 to your computer and use it in GitHub Desktop.
Leading-vs-trailing commas with a speculative DOM template API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Which of these would you rather play hunt-the-missing-comma with? | |
| $template({name: 'article_list', extends: 'article_base'}, | |
| $block('content', | |
| DIV({'class': 'articles'}, | |
| $for('article in articles', | |
| DIV({id: 'article{{ article.id }}'}, | |
| H2('{{ article.title }}'), | |
| DIV({'class': 'body'}, | |
| $html('{{ article.body }}') | |
| ) | |
| ), | |
| 'In Loop' | |
| ), | |
| 'Out of Loop' | |
| ), | |
| 'Out of Element' | |
| ) | |
| ) | |
| $template({name: 'article_list', extends: 'article_base'} | |
| , $block('content' | |
| , DIV({'class': 'articles'} | |
| , $for('article in articles' | |
| , DIV({id: 'article{{ article.id }}'} | |
| , H2('{{ article.title }}') | |
| , DIV({'class': 'body'} | |
| , $html('{{ article.body }}') | |
| ) | |
| ) | |
| , 'In Loop' | |
| ) | |
| , 'Out of Loop' | |
| ) | |
| , 'Out of Element' | |
| ) | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% extends "article_base.html" %} | |
| {% block content %} | |
| <div class="articles"> | |
| {% for article in articles %} | |
| <div id="article{{ article.id }}"> | |
| <h2>{{ article.title }}</h2> | |
| <div class="body"> | |
| {{ article.text }} | |
| </div> | |
| </div> | |
| In Loop | |
| {% endfor %} | |
| Out of Loop | |
| </div> | |
| Out of Element | |
| {% endblock %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment