{"action":"created","comment":{"url":"https://api.github.com/repos/onespacemedia/osm-styleguide/pulls/comments/89810424","pull_request_review_id":10344185,"id":89810424,"diff_hunk":"@@ -0,0 +1,102 @@\n+# Jinja and Django template styles\n+\n+## Spacing\n+\n+Always put a space between the delimiters of a 'print' or of a template tag, and its name. This makes it much more readable:\n+\n+```\n+{# Prints should have spaces inside the curlies. #}\n+<h1>Hello, {{ name }}!</h1>\n+\n+<ul>\n+  {# Tags and statements should have a space before and after the percent. #}\n+  {% for animal in animals %}\n+    <li>{{ animal }}</li>\n+  {% endfor %}\n+</ul>\n+```\n+\n+## Indentation\n+\n+Indentation should be with two spaces.\n+\n+You should not have more than one consecutive empty line.\n+\n+A statement block, which is to say any tag that has a corresponding `end` tag, should have its contents indented and on a new line if it contains any substantial amount of content.\n+\n+It's fine to use a one liner to override a short string, as we quite often want to do with `{% block %}`:\n+\n+```\n+{% extends 'base.html' %}\n+\n+{% block title %}I'm a mere short title{% endblock %}\n+\n+{% block body_class %}body-IAmAcceptableToo{% endblock %}\n+\n+{% block content %}\n+  <p>As I contain a block-level HTML element and more than a trivial quantity\n+  of text, I start a new line and a new indentation level.</p>\n+{% endblock %}\n+````\n+\n+There are times you should feel free to not do this to avoid unnecessary whitespace. For example, we can't put the `if` on its own line here because it would cause an ungrammatical space before the comma:\n+\n+```\n+Filed under {% for category in categories %}{{ category }}{% if not forloop.last %}, {% endif %}{% endfor %}\n+```\n+\n+Block-level tags, which is to say those with a corresponding `end` tag, should usually have an empty line between them and any other items at the same indentation level.\n+\n+```\n+{% block content %}\n+  <h1>{{ person.name }}</h1>\n+\n+  {% if person.nickname %}\n+    <p>{{ person.nickname }}</p>\n+  {% endif %}\n+\n+  {% with person.pet_set.all() as animals %}\n+    {% if animals %} {# No empty line as it starts a new indentation level. #}\n+      <h2>Pets</h2>\n+\n+      <ul>\n+        {% for animal in animals %}\n+          <li>{{ animal }}</li>\n+        {% endfor %}\n+      </ul>\n+    {% endif %}\n+  {% endwith %}\n+{% endblock %}\n+```\n+\n+An empty line between two HTML elements at the same indentation level is optional. In the above case, there's one between our `<h2>` and `<ul>` because they have obviously distinct roles.\n+\n+Blocks should never be padded with an empty line:\n+\n+```\n+{% if some_condition %}\n+\n+  <p>Don't do this!</p>\n+\n+{% endif %}\n+```\n+\n+## Jinja2 specifics\n+\n+`{% set %}` and `{% with %}` assignments should have a space before and after the equals, just as one would in the generally-accepted Python style:","path":"jinja-django-templates.md","position":86,"original_position":86,"commit_id":"0f6dc4b624cf6c95ac718ee2a60eba7564eb6fd7","original_commit_id":"0f6dc4b624cf6c95ac718ee2a60eba7564eb6fd7","user":{"login":"danielsamuels","id":1781176,"avatar_url":"https://avatars.githubusercontent.com/u/1781176?v=3","gravatar_id":"","url":"https://api.github.com/users/danielsamuels","html_url":"https://github.com/danielsamuels","followers_url":"https://api.github.com/users/danielsamuels/followers","following_url":"https://api.github.com/users/danielsamuels/following{/other_user}","gists_url":"https://api.github.com/users/danielsamuels/gists{/gist_id}","starred_url":"https://api.github.com/users/danielsamuels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielsamuels/subscriptions","organizations_url":"https://api.github.com/users/danielsamuels/orgs","repos_url":"https://api.github.com/users/danielsamuels/repos","events_url":"https://api.github.com/users/danielsamuels/events{/privacy}","received_events_url":"https://api.github.com/users/danielsamuels/received_events","type":"User","site_admin":false},"body":"It might be worth giving an example where two values are returned, it shows the worth of the spacing.\r\n\r\n```\r\n{% set articles, num_articles = get_news_articles_and_count(featured=True) %}\r\n```","created_at":"2016-11-28T15:55:26Z","updated_at":"2016-11-28T15:55:26Z","html_url":"https://github.com/onespacemedia/osm-styleguide/pull/3#discussion_r89810424","pull_request_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/onespacemedia/osm-styleguide/pulls/comments/89810424"},"html":{"href":"https://github.com/onespacemedia/osm-styleguide/pull/3#discussion_r89810424"},"pull_request":{"href":"https://api.github.com/repos/onespacemedia/osm-styleguide/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/onespacemedia/osm-styleguide/pulls/3","id":94870110,"html_url":"https://github.com/onespacemedia/osm-styleguide/pull/3","diff_url":"https://github.com/onespacemedia/osm-styleguide/pull/3.diff","patch_url":"https://github.com/onespacemedia/osm-styleguide/pull/3.patch","issue_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/issues/3","number":3,"state":"open","locked":false,"title":"First attempt at codifying template style guidelines.","user":{"login":"lewiscollard","id":4973097,"avatar_url":"https://avatars.githubusercontent.com/u/4973097?v=3","gravatar_id":"","url":"https://api.github.com/users/lewiscollard","html_url":"https://github.com/lewiscollard","followers_url":"https://api.github.com/users/lewiscollard/followers","following_url":"https://api.github.com/users/lewiscollard/following{/other_user}","gists_url":"https://api.github.com/users/lewiscollard/gists{/gist_id}","starred_url":"https://api.github.com/users/lewiscollard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lewiscollard/subscriptions","organizations_url":"https://api.github.com/users/lewiscollard/orgs","repos_url":"https://api.github.com/users/lewiscollard/repos","events_url":"https://api.github.com/users/lewiscollard/events{/privacy}","received_events_url":"https://api.github.com/users/lewiscollard/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-11-22T18:21:12Z","updated_at":"2016-11-28T15:55:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c0a3c59b7f1fbf2d90a3bd8e58ed2b525577a527","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/pulls/3/commits","review_comments_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/pulls/3/comments","review_comment_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/pulls/comments{/number}","comments_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/issues/3/comments","statuses_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/statuses/0f6dc4b624cf6c95ac718ee2a60eba7564eb6fd7","head":{"label":"onespacemedia:template-style","ref":"template-style","sha":"0f6dc4b624cf6c95ac718ee2a60eba7564eb6fd7","user":{"login":"onespacemedia","id":4577273,"avatar_url":"https://avatars.githubusercontent.com/u/4577273?v=3","gravatar_id":"","url":"https://api.github.com/users/onespacemedia","html_url":"https://github.com/onespacemedia","followers_url":"https://api.github.com/users/onespacemedia/followers","following_url":"https://api.github.com/users/onespacemedia/following{/other_user}","gists_url":"https://api.github.com/users/onespacemedia/gists{/gist_id}","starred_url":"https://api.github.com/users/onespacemedia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onespacemedia/subscriptions","organizations_url":"https://api.github.com/users/onespacemedia/orgs","repos_url":"https://api.github.com/users/onespacemedia/repos","events_url":"https://api.github.com/users/onespacemedia/events{/privacy}","received_events_url":"https://api.github.com/users/onespacemedia/received_events","type":"Organization","site_admin":false},"repo":{"id":74487217,"name":"osm-styleguide","full_name":"onespacemedia/osm-styleguide","owner":{"login":"onespacemedia","id":4577273,"avatar_url":"https://avatars.githubusercontent.com/u/4577273?v=3","gravatar_id":"","url":"https://api.github.com/users/onespacemedia","html_url":"https://github.com/onespacemedia","followers_url":"https://api.github.com/users/onespacemedia/followers","following_url":"https://api.github.com/users/onespacemedia/following{/other_user}","gists_url":"https://api.github.com/users/onespacemedia/gists{/gist_id}","starred_url":"https://api.github.com/users/onespacemedia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onespacemedia/subscriptions","organizations_url":"https://api.github.com/users/onespacemedia/orgs","repos_url":"https://api.github.com/users/onespacemedia/repos","events_url":"https://api.github.com/users/onespacemedia/events{/privacy}","received_events_url":"https://api.github.com/users/onespacemedia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/onespacemedia/osm-styleguide","description":"A styleguide for our HTML / CSS / Javascript / Python code","fork":false,"url":"https://api.github.com/repos/onespacemedia/osm-styleguide","forks_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/forks","keys_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/keys{/key_id}","collaborators_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/teams","hooks_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/hooks","issue_events_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/issues/events{/number}","events_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/events","assignees_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/assignees{/user}","branches_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/branches{/branch}","tags_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/tags","blobs_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/git/refs{/sha}","trees_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/git/trees{/sha}","statuses_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/statuses/{sha}","languages_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/languages","stargazers_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/stargazers","contributors_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/contributors","subscribers_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/subscribers","subscription_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/subscription","commits_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/commits{/sha}","git_commits_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/git/commits{/sha}","comments_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/comments{/number}","issue_comment_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/issues/comments{/number}","contents_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/contents/{+path}","compare_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/compare/{base}...{head}","merges_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/merges","archive_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/downloads","issues_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/issues{/number}","pulls_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/pulls{/number}","milestones_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/milestones{/number}","notifications_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/labels{/name}","releases_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/releases{/id}","deployments_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/deployments","created_at":"2016-11-22T15:39:57Z","updated_at":"2016-11-22T15:39:57Z","pushed_at":"2016-11-22T18:21:12Z","git_url":"git://github.com/onespacemedia/osm-styleguide.git","ssh_url":"git@github.com:onespacemedia/osm-styleguide.git","clone_url":"https://github.com/onespacemedia/osm-styleguide.git","svn_url":"https://github.com/onespacemedia/osm-styleguide","homepage":null,"size":5,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"onespacemedia:master","ref":"master","sha":"6df5e5c0043490c08b10bc98d2e12c424b1d127b","user":{"login":"onespacemedia","id":4577273,"avatar_url":"https://avatars.githubusercontent.com/u/4577273?v=3","gravatar_id":"","url":"https://api.github.com/users/onespacemedia","html_url":"https://github.com/onespacemedia","followers_url":"https://api.github.com/users/onespacemedia/followers","following_url":"https://api.github.com/users/onespacemedia/following{/other_user}","gists_url":"https://api.github.com/users/onespacemedia/gists{/gist_id}","starred_url":"https://api.github.com/users/onespacemedia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onespacemedia/subscriptions","organizations_url":"https://api.github.com/users/onespacemedia/orgs","repos_url":"https://api.github.com/users/onespacemedia/repos","events_url":"https://api.github.com/users/onespacemedia/events{/privacy}","received_events_url":"https://api.github.com/users/onespacemedia/received_events","type":"Organization","site_admin":false},"repo":{"id":74487217,"name":"osm-styleguide","full_name":"onespacemedia/osm-styleguide","owner":{"login":"onespacemedia","id":4577273,"avatar_url":"https://avatars.githubusercontent.com/u/4577273?v=3","gravatar_id":"","url":"https://api.github.com/users/onespacemedia","html_url":"https://github.com/onespacemedia","followers_url":"https://api.github.com/users/onespacemedia/followers","following_url":"https://api.github.com/users/onespacemedia/following{/other_user}","gists_url":"https://api.github.com/users/onespacemedia/gists{/gist_id}","starred_url":"https://api.github.com/users/onespacemedia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onespacemedia/subscriptions","organizations_url":"https://api.github.com/users/onespacemedia/orgs","repos_url":"https://api.github.com/users/onespacemedia/repos","events_url":"https://api.github.com/users/onespacemedia/events{/privacy}","received_events_url":"https://api.github.com/users/onespacemedia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/onespacemedia/osm-styleguide","description":"A styleguide for our HTML / CSS / Javascript / Python code","fork":false,"url":"https://api.github.com/repos/onespacemedia/osm-styleguide","forks_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/forks","keys_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/keys{/key_id}","collaborators_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/teams","hooks_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/hooks","issue_events_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/issues/events{/number}","events_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/events","assignees_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/assignees{/user}","branches_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/branches{/branch}","tags_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/tags","blobs_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/git/refs{/sha}","trees_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/git/trees{/sha}","statuses_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/statuses/{sha}","languages_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/languages","stargazers_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/stargazers","contributors_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/contributors","subscribers_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/subscribers","subscription_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/subscription","commits_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/commits{/sha}","git_commits_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/git/commits{/sha}","comments_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/comments{/number}","issue_comment_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/issues/comments{/number}","contents_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/contents/{+path}","compare_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/compare/{base}...{head}","merges_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/merges","archive_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/downloads","issues_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/issues{/number}","pulls_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/pulls{/number}","milestones_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/milestones{/number}","notifications_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/labels{/name}","releases_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/releases{/id}","deployments_url":"https://api.github.com/repos/onespacemedia/osm-styleguide/deployments","created_at":"2016-11-22T15:39:57Z","updated_at":"2016-11-22T15:39:57Z","pushed_at":"2016-11-22T18:21:12Z","git_url":"git://github.com/onespacemedia/osm-styleguide.git","ssh_url":"git@github.com:onespacemedia/osm-styleguide.git","clone_url":"https://github.com/onespacemedia/osm-styleguide.git","svn_url":"https://github.com/onespacemedia/osm-styleguide","homepage":null,"size":5,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/onespacemedia/osm-styleguide/pulls/3"},"html":{"href":"https://github.com/onespacemedia/osm-styleguide/pull/3"},"issue":{"href":"https://api.github.com/repos/onespacemedia/osm-styleguide/issues/3"},"comments":{"href":"https://api.github.com/repos/onespacemedia/osm-styleguide/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/onespacemedia/osm-styleguide/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/onespacemedia/osm-styleguide/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/onespacemedia/osm-styleguide/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/onespacemedia/osm-styleguide/statuses/0f6dc4b624cf6c95ac718ee2a60eba7564eb6fd7"}}}}
{"actor":{"display_login":"danielsamuels"}}