{"action":"created","comment":{"url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/pulls/comments/190535543","pull_request_review_id":122929441,"id":190535543,"diff_hunk":"@@ -480,45 +503,28 @@ def('toc',\n     [$.String, $.String],\n     pipe([matchAll(/<(h[1-6]) id=\"([^\"]*)\">(.*)<[/]\\1>/g),\n           map(prop('groups')),\n-          map(justs),\n-          reduce(({level, tagName, html}) => ([hN, id, _innerHtml]) => {\n-            const level$ = Number(hN[1]);\n-            const level$$ = level$ > level ? hN === tagName ? level : level + 1 : level$;\n-\n-            const pattern = '<a [^>]*>([^<]*)</a>';\n-            const innerHtml =\n-            pipe([replace(regex('', pattern), '<b>$1</b>'),\n-                  replace(regex('g', pattern), '$1')],\n-                 _innerHtml);\n-\n-            const html$ =\n-            html + '\\n' +\n-            (level$$ > level ?\n-               pad(2 * level$$ - 2) + '<ul' + (level === 1 ? ' id=\"toc\"' : '') + '>\\n' +\n-               pad(2 * level$$ - 1) + '<li>\\n' +\n-               pad(2 * level$$ - 0) :\n-             level$$ < level ?\n-               pad(2 * level$$ + 1) + '</li>\\n' +\n-               pad(2 * level$$ - 0) + '</ul>\\n' +\n-               pad(2 * level$$ - 1) + '</li>\\n' +\n-               pad(2 * level$$ - 1) + '<li>\\n' +\n-               pad(2 * level$$ - 0) :\n-             // else\n-               pad(2 * level$$ - 1) + '</li>\\n' +\n-               pad(2 * level$$ - 1) + '<li>\\n' +\n-               pad(2 * level$$ - 0)) +\n-            el('a', {href: '#' + id}, innerHtml);\n-\n-            return {level: level$$, tagName: hN, html: html$};\n-          }, {level: 1, tagName: 'h1', html: ''}),\n-          over(lensProp('level'),\n-               compose(j,\n-                       unfoldr(level => level > 1 ?\n-                                 Just(['\\n' + pad(2 * level - 1) + '</li>' +\n-                                       '\\n' + pad(2 * level - 2) + '</ul>',\n-                                      level - 1]) :\n-                                 Nothing))),\n-          lift2(concat, prop('html'), prop('level'))]));\n+          map(map(fromJust)),","path":"scripts/generate","position":128,"original_position":128,"commit_id":"26bccdd1b4699258471304de57f89443da645a88","original_commit_id":"26bccdd1b4699258471304de57f89443da645a88","user":{"login":"davidchambers","id":210406,"avatar_url":"https://avatars2.githubusercontent.com/u/210406?v=4","gravatar_id":"","url":"https://api.github.com/users/davidchambers","html_url":"https://github.com/davidchambers","followers_url":"https://api.github.com/users/davidchambers/followers","following_url":"https://api.github.com/users/davidchambers/following{/other_user}","gists_url":"https://api.github.com/users/davidchambers/gists{/gist_id}","starred_url":"https://api.github.com/users/davidchambers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidchambers/subscriptions","organizations_url":"https://api.github.com/users/davidchambers/orgs","repos_url":"https://api.github.com/users/davidchambers/repos","events_url":"https://api.github.com/users/davidchambers/events{/privacy}","received_events_url":"https://api.github.com/users/davidchambers/received_events","type":"User","site_admin":false},"body":"Semantically, `map (fromJust)` is more appropriate than `justs` because it asserts that none of the groups is `Nothing`. This in turn ensures that the `[tagName, id, html]` destructuring will succeed.\r\n","created_at":"2018-05-24T10:17:43Z","updated_at":"2018-05-24T10:17:43Z","html_url":"https://github.com/sanctuary-js/sanctuary-site/pull/49#discussion_r190535543","pull_request_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/pulls/49","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/sanctuary-js/sanctuary-site/pulls/comments/190535543"},"html":{"href":"https://github.com/sanctuary-js/sanctuary-site/pull/49#discussion_r190535543"},"pull_request":{"href":"https://api.github.com/repos/sanctuary-js/sanctuary-site/pulls/49"}}},"pull_request":{"url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/pulls/49","id":190237185,"html_url":"https://github.com/sanctuary-js/sanctuary-site/pull/49","diff_url":"https://github.com/sanctuary-js/sanctuary-site/pull/49.diff","patch_url":"https://github.com/sanctuary-js/sanctuary-site/pull/49.patch","issue_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/issues/49","number":49,"state":"open","locked":false,"title":"simplify code for generating table of contents","user":{"login":"davidchambers","id":210406,"avatar_url":"https://avatars2.githubusercontent.com/u/210406?v=4","gravatar_id":"","url":"https://api.github.com/users/davidchambers","html_url":"https://github.com/davidchambers","followers_url":"https://api.github.com/users/davidchambers/followers","following_url":"https://api.github.com/users/davidchambers/following{/other_user}","gists_url":"https://api.github.com/users/davidchambers/gists{/gist_id}","starred_url":"https://api.github.com/users/davidchambers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidchambers/subscriptions","organizations_url":"https://api.github.com/users/davidchambers/orgs","repos_url":"https://api.github.com/users/davidchambers/repos","events_url":"https://api.github.com/users/davidchambers/events{/privacy}","received_events_url":"https://api.github.com/users/davidchambers/received_events","type":"User","site_admin":false},"body":"I will soon open a pull request to improve the presentation of the table of contents. To facilitate that user-facing change I have simplified the relevant code. This pull request splits the monolithic `toc` function into two functions: `toc` and `tocListItem`. The former creates a data structure containing the document's headings; the latter recursively generates markup from these headings. The subsequent pull request will include changes to `tocListItem` but not to `toc`.\r\n","created_at":"2018-05-24T10:12:47Z","updated_at":"2018-05-24T10:17:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6859456ff48b8964dd6ae2ff984c88ca85b7076a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/pulls/49/commits","review_comments_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/pulls/49/comments","review_comment_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/issues/49/comments","statuses_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/statuses/26bccdd1b4699258471304de57f89443da645a88","head":{"label":"sanctuary-js:davidchambers/toc","ref":"davidchambers/toc","sha":"26bccdd1b4699258471304de57f89443da645a88","user":{"login":"sanctuary-js","id":18357498,"avatar_url":"https://avatars1.githubusercontent.com/u/18357498?v=4","gravatar_id":"","url":"https://api.github.com/users/sanctuary-js","html_url":"https://github.com/sanctuary-js","followers_url":"https://api.github.com/users/sanctuary-js/followers","following_url":"https://api.github.com/users/sanctuary-js/following{/other_user}","gists_url":"https://api.github.com/users/sanctuary-js/gists{/gist_id}","starred_url":"https://api.github.com/users/sanctuary-js/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sanctuary-js/subscriptions","organizations_url":"https://api.github.com/users/sanctuary-js/orgs","repos_url":"https://api.github.com/users/sanctuary-js/repos","events_url":"https://api.github.com/users/sanctuary-js/events{/privacy}","received_events_url":"https://api.github.com/users/sanctuary-js/received_events","type":"Organization","site_admin":false},"repo":{"id":52643796,"name":"sanctuary-site","full_name":"sanctuary-js/sanctuary-site","owner":{"login":"sanctuary-js","id":18357498,"avatar_url":"https://avatars1.githubusercontent.com/u/18357498?v=4","gravatar_id":"","url":"https://api.github.com/users/sanctuary-js","html_url":"https://github.com/sanctuary-js","followers_url":"https://api.github.com/users/sanctuary-js/followers","following_url":"https://api.github.com/users/sanctuary-js/following{/other_user}","gists_url":"https://api.github.com/users/sanctuary-js/gists{/gist_id}","starred_url":"https://api.github.com/users/sanctuary-js/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sanctuary-js/subscriptions","organizations_url":"https://api.github.com/users/sanctuary-js/orgs","repos_url":"https://api.github.com/users/sanctuary-js/repos","events_url":"https://api.github.com/users/sanctuary-js/events{/privacy}","received_events_url":"https://api.github.com/users/sanctuary-js/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sanctuary-js/sanctuary-site","description":"Sanctuary's website","fork":false,"url":"https://api.github.com/repos/sanctuary-js/sanctuary-site","forks_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/forks","keys_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/teams","hooks_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/hooks","issue_events_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/issues/events{/number}","events_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/events","assignees_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/assignees{/user}","branches_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/branches{/branch}","tags_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/tags","blobs_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/git/refs{/sha}","trees_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/statuses/{sha}","languages_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/languages","stargazers_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/stargazers","contributors_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/contributors","subscribers_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/subscribers","subscription_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/subscription","commits_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/commits{/sha}","git_commits_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/git/commits{/sha}","comments_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/comments{/number}","issue_comment_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/issues/comments{/number}","contents_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/contents/{+path}","compare_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/merges","archive_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/downloads","issues_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/issues{/number}","pulls_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/pulls{/number}","milestones_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/milestones{/number}","notifications_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/labels{/name}","releases_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/releases{/id}","deployments_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/deployments","created_at":"2016-02-27T01:27:07Z","updated_at":"2018-05-18T14:31:07Z","pushed_at":"2018-05-24T10:12:48Z","git_url":"git://github.com/sanctuary-js/sanctuary-site.git","ssh_url":"git@github.com:sanctuary-js/sanctuary-site.git","clone_url":"https://github.com/sanctuary-js/sanctuary-site.git","svn_url":"https://github.com/sanctuary-js/sanctuary-site","homepage":"http://sanctuary.js.org","size":771,"stargazers_count":4,"watchers_count":4,"language":"HTML","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":4,"license":null,"forks":6,"open_issues":4,"watchers":4,"default_branch":"gh-pages"}},"base":{"label":"sanctuary-js:gh-pages","ref":"gh-pages","sha":"ec71e2c779cea6a67cd2516ebb42c4a9f3403e5e","user":{"login":"sanctuary-js","id":18357498,"avatar_url":"https://avatars1.githubusercontent.com/u/18357498?v=4","gravatar_id":"","url":"https://api.github.com/users/sanctuary-js","html_url":"https://github.com/sanctuary-js","followers_url":"https://api.github.com/users/sanctuary-js/followers","following_url":"https://api.github.com/users/sanctuary-js/following{/other_user}","gists_url":"https://api.github.com/users/sanctuary-js/gists{/gist_id}","starred_url":"https://api.github.com/users/sanctuary-js/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sanctuary-js/subscriptions","organizations_url":"https://api.github.com/users/sanctuary-js/orgs","repos_url":"https://api.github.com/users/sanctuary-js/repos","events_url":"https://api.github.com/users/sanctuary-js/events{/privacy}","received_events_url":"https://api.github.com/users/sanctuary-js/received_events","type":"Organization","site_admin":false},"repo":{"id":52643796,"name":"sanctuary-site","full_name":"sanctuary-js/sanctuary-site","owner":{"login":"sanctuary-js","id":18357498,"avatar_url":"https://avatars1.githubusercontent.com/u/18357498?v=4","gravatar_id":"","url":"https://api.github.com/users/sanctuary-js","html_url":"https://github.com/sanctuary-js","followers_url":"https://api.github.com/users/sanctuary-js/followers","following_url":"https://api.github.com/users/sanctuary-js/following{/other_user}","gists_url":"https://api.github.com/users/sanctuary-js/gists{/gist_id}","starred_url":"https://api.github.com/users/sanctuary-js/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sanctuary-js/subscriptions","organizations_url":"https://api.github.com/users/sanctuary-js/orgs","repos_url":"https://api.github.com/users/sanctuary-js/repos","events_url":"https://api.github.com/users/sanctuary-js/events{/privacy}","received_events_url":"https://api.github.com/users/sanctuary-js/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sanctuary-js/sanctuary-site","description":"Sanctuary's website","fork":false,"url":"https://api.github.com/repos/sanctuary-js/sanctuary-site","forks_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/forks","keys_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/teams","hooks_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/hooks","issue_events_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/issues/events{/number}","events_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/events","assignees_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/assignees{/user}","branches_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/branches{/branch}","tags_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/tags","blobs_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/git/refs{/sha}","trees_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/statuses/{sha}","languages_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/languages","stargazers_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/stargazers","contributors_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/contributors","subscribers_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/subscribers","subscription_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/subscription","commits_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/commits{/sha}","git_commits_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/git/commits{/sha}","comments_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/comments{/number}","issue_comment_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/issues/comments{/number}","contents_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/contents/{+path}","compare_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/merges","archive_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/downloads","issues_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/issues{/number}","pulls_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/pulls{/number}","milestones_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/milestones{/number}","notifications_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/labels{/name}","releases_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/releases{/id}","deployments_url":"https://api.github.com/repos/sanctuary-js/sanctuary-site/deployments","created_at":"2016-02-27T01:27:07Z","updated_at":"2018-05-18T14:31:07Z","pushed_at":"2018-05-24T10:12:48Z","git_url":"git://github.com/sanctuary-js/sanctuary-site.git","ssh_url":"git@github.com:sanctuary-js/sanctuary-site.git","clone_url":"https://github.com/sanctuary-js/sanctuary-site.git","svn_url":"https://github.com/sanctuary-js/sanctuary-site","homepage":"http://sanctuary.js.org","size":771,"stargazers_count":4,"watchers_count":4,"language":"HTML","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":4,"license":null,"forks":6,"open_issues":4,"watchers":4,"default_branch":"gh-pages"}},"_links":{"self":{"href":"https://api.github.com/repos/sanctuary-js/sanctuary-site/pulls/49"},"html":{"href":"https://github.com/sanctuary-js/sanctuary-site/pull/49"},"issue":{"href":"https://api.github.com/repos/sanctuary-js/sanctuary-site/issues/49"},"comments":{"href":"https://api.github.com/repos/sanctuary-js/sanctuary-site/issues/49/comments"},"review_comments":{"href":"https://api.github.com/repos/sanctuary-js/sanctuary-site/pulls/49/comments"},"review_comment":{"href":"https://api.github.com/repos/sanctuary-js/sanctuary-site/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sanctuary-js/sanctuary-site/pulls/49/commits"},"statuses":{"href":"https://api.github.com/repos/sanctuary-js/sanctuary-site/statuses/26bccdd1b4699258471304de57f89443da645a88"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"davidchambers"}}