{"action":"created","comment":{"url":"https://api.github.com/repos/HubSpot/jinjava/pulls/comments/61137104","id":61137104,"diff_hunk":"@@ -145,4 +148,59 @@ public static int movePointerToJustBeforeLastWord(int pointer, String s) {\n     return pointer + 1;\n   }\n \n+  @JinjavaDoc(value = \"<p>Return a list containing an arithmetic progression of integers.</p>\" +\n+      \"<p>With one parameter, range will return a list from 0 up to or down to the value. \" +\n+      \" With two parameters, the range will start at the first value and end at the second value. \" +\n+      \" The third parameter specifies the step increment.</p> <p>All values can be negative.</p>\" +\n+      \"<p>Ranges can generate a maximum of \" + RANGE_LIMIT + \" values.</p>\",\n+      params = {\n+          @JinjavaParam(value = \"start\", type = \"number\", defaultValue = \"0\"),\n+          @JinjavaParam(value = \"end\", type = \"number\"),\n+          @JinjavaParam(value = \"step\", type = \"number\", defaultValue = \"1\")})\n+  public static List<Integer> range(Object arg1, Object... args) {\n+\n+    List<Integer> result = new ArrayList<>();\n+\n+    int start = 0;\n+    int end;\n+    int step = 1;\n+\n+    switch (args.length) {\n+      case 0:\n+        end = Integer.parseInt(arg1.toString());\n+        break;\n+      case 1:\n+        start = Integer.parseInt(arg1.toString());\n+        end = Integer.parseInt(args[0].toString());\n+        break;\n+      default:\n+        start = Integer.parseInt(arg1.toString());\n+        end = Integer.parseInt(args[0].toString());\n+        step = Integer.parseInt(args[1].toString());\n+    }\n+\n+    if (start < end) {\n+      for (int i = start; i < end; i += step) {\n+        if (result.size() >= RANGE_LIMIT) {\n+          break;\n+        }\n+        result.add(i);\n+      }\n+    } else {\n+\n+      // make sure we're decrementing","path":"src/main/java/com/hubspot/jinjava/lib/fn/Functions.java","position":61,"original_position":61,"commit_id":"997909894f7a5b649802cc2de2cf374497a4d1dc","original_commit_id":"997909894f7a5b649802cc2de2cf374497a4d1dc","user":{"login":"boulter","id":152548,"avatar_url":"https://avatars.githubusercontent.com/u/152548?v=3","gravatar_id":"","url":"https://api.github.com/users/boulter","html_url":"https://github.com/boulter","followers_url":"https://api.github.com/users/boulter/followers","following_url":"https://api.github.com/users/boulter/following{/other_user}","gists_url":"https://api.github.com/users/boulter/gists{/gist_id}","starred_url":"https://api.github.com/users/boulter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boulter/subscriptions","organizations_url":"https://api.github.com/users/boulter/orgs","repos_url":"https://api.github.com/users/boulter/repos","events_url":"https://api.github.com/users/boulter/events{/privacy}","received_events_url":"https://api.github.com/users/boulter/received_events","type":"User","site_admin":false},"body":"python is not as lenient. I'll make it compatible.","created_at":"2016-04-26T18:17:22Z","updated_at":"2016-04-26T18:17:22Z","html_url":"https://github.com/HubSpot/jinjava/pull/53#discussion_r61137104","pull_request_url":"https://api.github.com/repos/HubSpot/jinjava/pulls/53","_links":{"self":{"href":"https://api.github.com/repos/HubSpot/jinjava/pulls/comments/61137104"},"html":{"href":"https://github.com/HubSpot/jinjava/pull/53#discussion_r61137104"},"pull_request":{"href":"https://api.github.com/repos/HubSpot/jinjava/pulls/53"}}},"pull_request":{"url":"https://api.github.com/repos/HubSpot/jinjava/pulls/53","id":67791801,"html_url":"https://github.com/HubSpot/jinjava/pull/53","diff_url":"https://github.com/HubSpot/jinjava/pull/53.diff","patch_url":"https://github.com/HubSpot/jinjava/pull/53.patch","issue_url":"https://api.github.com/repos/HubSpot/jinjava/issues/53","number":53,"state":"open","locked":false,"title":"add range function","user":{"login":"boulter","id":152548,"avatar_url":"https://avatars.githubusercontent.com/u/152548?v=3","gravatar_id":"","url":"https://api.github.com/users/boulter","html_url":"https://github.com/boulter","followers_url":"https://api.github.com/users/boulter/followers","following_url":"https://api.github.com/users/boulter/following{/other_user}","gists_url":"https://api.github.com/users/boulter/gists{/gist_id}","starred_url":"https://api.github.com/users/boulter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boulter/subscriptions","organizations_url":"https://api.github.com/users/boulter/orgs","repos_url":"https://api.github.com/users/boulter/repos","events_url":"https://api.github.com/users/boulter/events{/privacy}","received_events_url":"https://api.github.com/users/boulter/received_events","type":"User","site_admin":false},"body":"Implements `range()` ala Jinja2: http://jinja.pocoo.org/docs/dev/templates/\r\n\r\nFixes #49\r\n\r\nExamples: \r\n\r\n` System.out.println(jinjava.render(\"| {% for num in range(2) %} {{ num }}, {% endfor %}|\", context));`\r\n`|  0,  1, |`\r\n`System.out.println(jinjava.render(\"| {% for num in range(2, 8, 2) %} {{ num }}, {% endfor %}|\", context));`\r\n`|  2,  4,  6, |` \r\n`System.out.println(jinjava.render(\"| {% for num in range(2, -4, -2) %} {{ num }}, {% endfor %}|\", context));`\r\n`|  2,  0,  -2, |`\r\n","created_at":"2016-04-25T21:32:06Z","updated_at":"2016-04-26T18:17:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a4d4c7c9924a15826b4a4b1bb42b346899400aaf","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/HubSpot/jinjava/pulls/53/commits","review_comments_url":"https://api.github.com/repos/HubSpot/jinjava/pulls/53/comments","review_comment_url":"https://api.github.com/repos/HubSpot/jinjava/pulls/comments{/number}","comments_url":"https://api.github.com/repos/HubSpot/jinjava/issues/53/comments","statuses_url":"https://api.github.com/repos/HubSpot/jinjava/statuses/997909894f7a5b649802cc2de2cf374497a4d1dc","head":{"label":"HubSpot:range-function","ref":"range-function","sha":"997909894f7a5b649802cc2de2cf374497a4d1dc","user":{"login":"HubSpot","id":326419,"avatar_url":"https://avatars.githubusercontent.com/u/326419?v=3","gravatar_id":"","url":"https://api.github.com/users/HubSpot","html_url":"https://github.com/HubSpot","followers_url":"https://api.github.com/users/HubSpot/followers","following_url":"https://api.github.com/users/HubSpot/following{/other_user}","gists_url":"https://api.github.com/users/HubSpot/gists{/gist_id}","starred_url":"https://api.github.com/users/HubSpot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HubSpot/subscriptions","organizations_url":"https://api.github.com/users/HubSpot/orgs","repos_url":"https://api.github.com/users/HubSpot/repos","events_url":"https://api.github.com/users/HubSpot/events{/privacy}","received_events_url":"https://api.github.com/users/HubSpot/received_events","type":"Organization","site_admin":false},"repo":{"id":25169896,"name":"jinjava","full_name":"HubSpot/jinjava","owner":{"login":"HubSpot","id":326419,"avatar_url":"https://avatars.githubusercontent.com/u/326419?v=3","gravatar_id":"","url":"https://api.github.com/users/HubSpot","html_url":"https://github.com/HubSpot","followers_url":"https://api.github.com/users/HubSpot/followers","following_url":"https://api.github.com/users/HubSpot/following{/other_user}","gists_url":"https://api.github.com/users/HubSpot/gists{/gist_id}","starred_url":"https://api.github.com/users/HubSpot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HubSpot/subscriptions","organizations_url":"https://api.github.com/users/HubSpot/orgs","repos_url":"https://api.github.com/users/HubSpot/repos","events_url":"https://api.github.com/users/HubSpot/events{/privacy}","received_events_url":"https://api.github.com/users/HubSpot/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/HubSpot/jinjava","description":"Jinja template engine for Java","fork":false,"url":"https://api.github.com/repos/HubSpot/jinjava","forks_url":"https://api.github.com/repos/HubSpot/jinjava/forks","keys_url":"https://api.github.com/repos/HubSpot/jinjava/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HubSpot/jinjava/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HubSpot/jinjava/teams","hooks_url":"https://api.github.com/repos/HubSpot/jinjava/hooks","issue_events_url":"https://api.github.com/repos/HubSpot/jinjava/issues/events{/number}","events_url":"https://api.github.com/repos/HubSpot/jinjava/events","assignees_url":"https://api.github.com/repos/HubSpot/jinjava/assignees{/user}","branches_url":"https://api.github.com/repos/HubSpot/jinjava/branches{/branch}","tags_url":"https://api.github.com/repos/HubSpot/jinjava/tags","blobs_url":"https://api.github.com/repos/HubSpot/jinjava/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HubSpot/jinjava/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HubSpot/jinjava/git/refs{/sha}","trees_url":"https://api.github.com/repos/HubSpot/jinjava/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HubSpot/jinjava/statuses/{sha}","languages_url":"https://api.github.com/repos/HubSpot/jinjava/languages","stargazers_url":"https://api.github.com/repos/HubSpot/jinjava/stargazers","contributors_url":"https://api.github.com/repos/HubSpot/jinjava/contributors","subscribers_url":"https://api.github.com/repos/HubSpot/jinjava/subscribers","subscription_url":"https://api.github.com/repos/HubSpot/jinjava/subscription","commits_url":"https://api.github.com/repos/HubSpot/jinjava/commits{/sha}","git_commits_url":"https://api.github.com/repos/HubSpot/jinjava/git/commits{/sha}","comments_url":"https://api.github.com/repos/HubSpot/jinjava/comments{/number}","issue_comment_url":"https://api.github.com/repos/HubSpot/jinjava/issues/comments{/number}","contents_url":"https://api.github.com/repos/HubSpot/jinjava/contents/{+path}","compare_url":"https://api.github.com/repos/HubSpot/jinjava/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HubSpot/jinjava/merges","archive_url":"https://api.github.com/repos/HubSpot/jinjava/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HubSpot/jinjava/downloads","issues_url":"https://api.github.com/repos/HubSpot/jinjava/issues{/number}","pulls_url":"https://api.github.com/repos/HubSpot/jinjava/pulls{/number}","milestones_url":"https://api.github.com/repos/HubSpot/jinjava/milestones{/number}","notifications_url":"https://api.github.com/repos/HubSpot/jinjava/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HubSpot/jinjava/labels{/name}","releases_url":"https://api.github.com/repos/HubSpot/jinjava/releases{/id}","deployments_url":"https://api.github.com/repos/HubSpot/jinjava/deployments","created_at":"2014-10-13T17:39:22Z","updated_at":"2016-04-24T15:02:41Z","pushed_at":"2016-04-26T17:42:09Z","git_url":"git://github.com/HubSpot/jinjava.git","ssh_url":"git@github.com:HubSpot/jinjava.git","clone_url":"https://github.com/HubSpot/jinjava.git","svn_url":"https://github.com/HubSpot/jinjava","homepage":"","size":1168,"stargazers_count":122,"watchers_count":122,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":22,"mirror_url":null,"open_issues_count":8,"forks":22,"open_issues":8,"watchers":122,"default_branch":"master"}},"base":{"label":"HubSpot:master","ref":"master","sha":"f2939ae6dda06dab37199bff8857bfd48508fe68","user":{"login":"HubSpot","id":326419,"avatar_url":"https://avatars.githubusercontent.com/u/326419?v=3","gravatar_id":"","url":"https://api.github.com/users/HubSpot","html_url":"https://github.com/HubSpot","followers_url":"https://api.github.com/users/HubSpot/followers","following_url":"https://api.github.com/users/HubSpot/following{/other_user}","gists_url":"https://api.github.com/users/HubSpot/gists{/gist_id}","starred_url":"https://api.github.com/users/HubSpot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HubSpot/subscriptions","organizations_url":"https://api.github.com/users/HubSpot/orgs","repos_url":"https://api.github.com/users/HubSpot/repos","events_url":"https://api.github.com/users/HubSpot/events{/privacy}","received_events_url":"https://api.github.com/users/HubSpot/received_events","type":"Organization","site_admin":false},"repo":{"id":25169896,"name":"jinjava","full_name":"HubSpot/jinjava","owner":{"login":"HubSpot","id":326419,"avatar_url":"https://avatars.githubusercontent.com/u/326419?v=3","gravatar_id":"","url":"https://api.github.com/users/HubSpot","html_url":"https://github.com/HubSpot","followers_url":"https://api.github.com/users/HubSpot/followers","following_url":"https://api.github.com/users/HubSpot/following{/other_user}","gists_url":"https://api.github.com/users/HubSpot/gists{/gist_id}","starred_url":"https://api.github.com/users/HubSpot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HubSpot/subscriptions","organizations_url":"https://api.github.com/users/HubSpot/orgs","repos_url":"https://api.github.com/users/HubSpot/repos","events_url":"https://api.github.com/users/HubSpot/events{/privacy}","received_events_url":"https://api.github.com/users/HubSpot/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/HubSpot/jinjava","description":"Jinja template engine for Java","fork":false,"url":"https://api.github.com/repos/HubSpot/jinjava","forks_url":"https://api.github.com/repos/HubSpot/jinjava/forks","keys_url":"https://api.github.com/repos/HubSpot/jinjava/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HubSpot/jinjava/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HubSpot/jinjava/teams","hooks_url":"https://api.github.com/repos/HubSpot/jinjava/hooks","issue_events_url":"https://api.github.com/repos/HubSpot/jinjava/issues/events{/number}","events_url":"https://api.github.com/repos/HubSpot/jinjava/events","assignees_url":"https://api.github.com/repos/HubSpot/jinjava/assignees{/user}","branches_url":"https://api.github.com/repos/HubSpot/jinjava/branches{/branch}","tags_url":"https://api.github.com/repos/HubSpot/jinjava/tags","blobs_url":"https://api.github.com/repos/HubSpot/jinjava/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HubSpot/jinjava/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HubSpot/jinjava/git/refs{/sha}","trees_url":"https://api.github.com/repos/HubSpot/jinjava/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HubSpot/jinjava/statuses/{sha}","languages_url":"https://api.github.com/repos/HubSpot/jinjava/languages","stargazers_url":"https://api.github.com/repos/HubSpot/jinjava/stargazers","contributors_url":"https://api.github.com/repos/HubSpot/jinjava/contributors","subscribers_url":"https://api.github.com/repos/HubSpot/jinjava/subscribers","subscription_url":"https://api.github.com/repos/HubSpot/jinjava/subscription","commits_url":"https://api.github.com/repos/HubSpot/jinjava/commits{/sha}","git_commits_url":"https://api.github.com/repos/HubSpot/jinjava/git/commits{/sha}","comments_url":"https://api.github.com/repos/HubSpot/jinjava/comments{/number}","issue_comment_url":"https://api.github.com/repos/HubSpot/jinjava/issues/comments{/number}","contents_url":"https://api.github.com/repos/HubSpot/jinjava/contents/{+path}","compare_url":"https://api.github.com/repos/HubSpot/jinjava/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HubSpot/jinjava/merges","archive_url":"https://api.github.com/repos/HubSpot/jinjava/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HubSpot/jinjava/downloads","issues_url":"https://api.github.com/repos/HubSpot/jinjava/issues{/number}","pulls_url":"https://api.github.com/repos/HubSpot/jinjava/pulls{/number}","milestones_url":"https://api.github.com/repos/HubSpot/jinjava/milestones{/number}","notifications_url":"https://api.github.com/repos/HubSpot/jinjava/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HubSpot/jinjava/labels{/name}","releases_url":"https://api.github.com/repos/HubSpot/jinjava/releases{/id}","deployments_url":"https://api.github.com/repos/HubSpot/jinjava/deployments","created_at":"2014-10-13T17:39:22Z","updated_at":"2016-04-24T15:02:41Z","pushed_at":"2016-04-26T17:42:09Z","git_url":"git://github.com/HubSpot/jinjava.git","ssh_url":"git@github.com:HubSpot/jinjava.git","clone_url":"https://github.com/HubSpot/jinjava.git","svn_url":"https://github.com/HubSpot/jinjava","homepage":"","size":1168,"stargazers_count":122,"watchers_count":122,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":22,"mirror_url":null,"open_issues_count":8,"forks":22,"open_issues":8,"watchers":122,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/HubSpot/jinjava/pulls/53"},"html":{"href":"https://github.com/HubSpot/jinjava/pull/53"},"issue":{"href":"https://api.github.com/repos/HubSpot/jinjava/issues/53"},"comments":{"href":"https://api.github.com/repos/HubSpot/jinjava/issues/53/comments"},"review_comments":{"href":"https://api.github.com/repos/HubSpot/jinjava/pulls/53/comments"},"review_comment":{"href":"https://api.github.com/repos/HubSpot/jinjava/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/HubSpot/jinjava/pulls/53/commits"},"statuses":{"href":"https://api.github.com/repos/HubSpot/jinjava/statuses/997909894f7a5b649802cc2de2cf374497a4d1dc"}}}}