{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/readability/pulls/comments/28884346","id":28884346,"diff_hunk":"@@ -245,10 +260,24 @@ Readability.prototype = {\n       if (curTitle.split(' ').length < 3)\n         curTitle = origTitle.replace(/[^\\|\\-]*[\\|\\-](.*)/gi,'$1');\n     } else if (curTitle.indexOf(': ') !== -1) {\n-      curTitle = origTitle.replace(/.*:(.*)/gi, '$1');\n+      // XXX check if we have an heading containing this exact string, so we\n+      // could assume it's the full title\n+      // var headings = [].concat.call([].slice.call(doc.getElementsByTagName('h1')),\n+      //                               [].slice.call(doc.getElementsByTagName('h2')));\n+      var headings = this._concatNodeLists(\n+        doc.getElementsByTagName('h1'),\n+        doc.getElementsByTagName('h2')\n+      );\n+      var match = this._someNode(headings, function(heading) {\n+        return heading.textContent === curTitle;\n+      });\n \n-      if (curTitle.split(' ').length < 3)\n-        curTitle = origTitle.replace(/[^:]*[:](.*)/gi,'$1');\n+      if (!match) {\n+        curTitle = origTitle.replace(/.*:(.*)/gi, '$1');\n+\n+        if (curTitle.split(' ').length < 3)\n+          curTitle = origTitle.replace(/[^:]*[:](.*)/gi,'$1');","path":"Readability.js","position":44,"original_position":45,"commit_id":"54cf0427e98aabec2fdf2642a81cf9cb074e7709","original_commit_id":"9b3ddc7cd6abe9dacc870e0eac797fae319fade0","user":{"login":"n1k0","id":41547,"avatar_url":"https://avatars.githubusercontent.com/u/41547?v=3","gravatar_id":"","url":"https://api.github.com/users/n1k0","html_url":"https://github.com/n1k0","followers_url":"https://api.github.com/users/n1k0/followers","following_url":"https://api.github.com/users/n1k0/following{/other_user}","gists_url":"https://api.github.com/users/n1k0/gists{/gist_id}","starred_url":"https://api.github.com/users/n1k0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/n1k0/subscriptions","organizations_url":"https://api.github.com/users/n1k0/orgs","repos_url":"https://api.github.com/users/n1k0/repos","events_url":"https://api.github.com/users/n1k0/events{/privacy}","received_events_url":"https://api.github.com/users/n1k0/received_events","type":"User","site_admin":false},"body":"We added no supplementary replace; previous code was:\r\n\r\n```js\r\n    } else if (curTitle.indexOf(': ') !== -1) {\r\n      curTitle = origTitle.replace(/.*:(.*)/gi, '$1');\r\n\r\n      if (curTitle.split(' ').length < 3)\r\n        curTitle = origTitle.replace(/[^:]*[:](.*)/gi,'$1');\r\n    } else if (curTitle.length > 150 || curTitle.length < 15) {\r\n```\r\n\r\nNew code is:\r\n\r\n```js\r\n    } else if (curTitle.indexOf(': ') !== -1) {\r\n      // Wheck if we have an heading containing this exact string, so we\r\n      // could assume it's the full title.\r\n      var headings = this._concatNodeLists(\r\n        doc.getElementsByTagName('h1'),\r\n        doc.getElementsByTagName('h2')\r\n      );\r\n      var match = this._someNode(headings, function(heading) {\r\n        return heading.textContent === curTitle;\r\n      });\r\n\r\n      // If we don't, let's extract the title out of the original title string.\r\n      if (!match) {\r\n        curTitle = origTitle.replace(/.*:(.*)/gi, '$1');\r\n\r\n        if (curTitle.split(' ').length < 3)\r\n          curTitle = origTitle.replace(/[^:]*[:](.*)/gi,'$1');\r\n      }\r\n    } else if (curTitle.length > 150 || curTitle.length < 15) {\r\n```\r\n\r\nThe previous code colon-test codeblock has been simply moved into the new `if (!match)` one.","created_at":"2015-04-22T15:35:47Z","updated_at":"2015-04-22T15:35:47Z","html_url":"https://github.com/mozilla/readability/pull/175#discussion_r28884346","pull_request_url":"https://api.github.com/repos/mozilla/readability/pulls/175","_links":{"self":{"href":"https://api.github.com/repos/mozilla/readability/pulls/comments/28884346"},"html":{"href":"https://github.com/mozilla/readability/pull/175#discussion_r28884346"},"pull_request":{"href":"https://api.github.com/repos/mozilla/readability/pulls/175"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/readability/pulls/175","id":33770576,"html_url":"https://github.com/mozilla/readability/pull/175","diff_url":"https://github.com/mozilla/readability/pull/175.diff","patch_url":"https://github.com/mozilla/readability/pull/175.patch","issue_url":"https://api.github.com/repos/mozilla/readability/issues/175","number":175,"state":"open","locked":false,"title":"Fixes #174 - Remove aggressive article title formatting rule.","user":{"login":"n1k0","id":41547,"avatar_url":"https://avatars.githubusercontent.com/u/41547?v=3","gravatar_id":"","url":"https://api.github.com/users/n1k0","html_url":"https://github.com/n1k0","followers_url":"https://api.github.com/users/n1k0/followers","following_url":"https://api.github.com/users/n1k0/following{/other_user}","gists_url":"https://api.github.com/users/n1k0/gists{/gist_id}","starred_url":"https://api.github.com/users/n1k0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/n1k0/subscriptions","organizations_url":"https://api.github.com/users/n1k0/orgs","repos_url":"https://api.github.com/users/n1k0/repos","events_url":"https://api.github.com/users/n1k0/events{/privacy}","received_events_url":"https://api.github.com/users/n1k0/received_events","type":"User","site_admin":false},"body":"Refs https://github.com/mozilla/readability/issues/174#issuecomment-94831420\r\n\r\nr=? @gijsk ","created_at":"2015-04-21T15:05:16Z","updated_at":"2015-04-22T15:35:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4dbf31ce7d16f139b370beaf517c412f218d96c0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/readability/pulls/175/commits","review_comments_url":"https://api.github.com/repos/mozilla/readability/pulls/175/comments","review_comment_url":"https://api.github.com/repos/mozilla/readability/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/readability/issues/175/comments","statuses_url":"https://api.github.com/repos/mozilla/readability/statuses/54cf0427e98aabec2fdf2642a81cf9cb074e7709","head":{"label":"mozilla:improve-title-extraction","ref":"improve-title-extraction","sha":"54cf0427e98aabec2fdf2642a81cf9cb074e7709","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":30231828,"name":"readability","full_name":"mozilla/readability","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/readability","description":"A standalone version of the readability lib","fork":false,"url":"https://api.github.com/repos/mozilla/readability","forks_url":"https://api.github.com/repos/mozilla/readability/forks","keys_url":"https://api.github.com/repos/mozilla/readability/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/readability/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/readability/teams","hooks_url":"https://api.github.com/repos/mozilla/readability/hooks","issue_events_url":"https://api.github.com/repos/mozilla/readability/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/readability/events","assignees_url":"https://api.github.com/repos/mozilla/readability/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/readability/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/readability/tags","blobs_url":"https://api.github.com/repos/mozilla/readability/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/readability/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/readability/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/readability/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/readability/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/readability/languages","stargazers_url":"https://api.github.com/repos/mozilla/readability/stargazers","contributors_url":"https://api.github.com/repos/mozilla/readability/contributors","subscribers_url":"https://api.github.com/repos/mozilla/readability/subscribers","subscription_url":"https://api.github.com/repos/mozilla/readability/subscription","commits_url":"https://api.github.com/repos/mozilla/readability/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/readability/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/readability/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/readability/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/readability/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/readability/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/readability/merges","archive_url":"https://api.github.com/repos/mozilla/readability/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/readability/downloads","issues_url":"https://api.github.com/repos/mozilla/readability/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/readability/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/readability/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/readability/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/readability/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/readability/releases{/id}","created_at":"2015-02-03T08:01:54Z","updated_at":"2015-04-22T12:57:41Z","pushed_at":"2015-04-22T15:18:59Z","git_url":"git://github.com/mozilla/readability.git","ssh_url":"git@github.com:mozilla/readability.git","clone_url":"https://github.com/mozilla/readability.git","svn_url":"https://github.com/mozilla/readability","homepage":null,"size":2311,"stargazers_count":61,"watchers_count":61,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":68,"forks":12,"open_issues":68,"watchers":61,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"647658a47bcd2d7b7bc480b080f0f67b5f2c46a6","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":30231828,"name":"readability","full_name":"mozilla/readability","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/readability","description":"A standalone version of the readability lib","fork":false,"url":"https://api.github.com/repos/mozilla/readability","forks_url":"https://api.github.com/repos/mozilla/readability/forks","keys_url":"https://api.github.com/repos/mozilla/readability/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/readability/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/readability/teams","hooks_url":"https://api.github.com/repos/mozilla/readability/hooks","issue_events_url":"https://api.github.com/repos/mozilla/readability/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/readability/events","assignees_url":"https://api.github.com/repos/mozilla/readability/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/readability/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/readability/tags","blobs_url":"https://api.github.com/repos/mozilla/readability/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/readability/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/readability/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/readability/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/readability/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/readability/languages","stargazers_url":"https://api.github.com/repos/mozilla/readability/stargazers","contributors_url":"https://api.github.com/repos/mozilla/readability/contributors","subscribers_url":"https://api.github.com/repos/mozilla/readability/subscribers","subscription_url":"https://api.github.com/repos/mozilla/readability/subscription","commits_url":"https://api.github.com/repos/mozilla/readability/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/readability/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/readability/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/readability/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/readability/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/readability/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/readability/merges","archive_url":"https://api.github.com/repos/mozilla/readability/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/readability/downloads","issues_url":"https://api.github.com/repos/mozilla/readability/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/readability/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/readability/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/readability/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/readability/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/readability/releases{/id}","created_at":"2015-02-03T08:01:54Z","updated_at":"2015-04-22T12:57:41Z","pushed_at":"2015-04-22T15:18:59Z","git_url":"git://github.com/mozilla/readability.git","ssh_url":"git@github.com:mozilla/readability.git","clone_url":"https://github.com/mozilla/readability.git","svn_url":"https://github.com/mozilla/readability","homepage":null,"size":2311,"stargazers_count":61,"watchers_count":61,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":68,"forks":12,"open_issues":68,"watchers":61,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/readability/pulls/175"},"html":{"href":"https://github.com/mozilla/readability/pull/175"},"issue":{"href":"https://api.github.com/repos/mozilla/readability/issues/175"},"comments":{"href":"https://api.github.com/repos/mozilla/readability/issues/175/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/readability/pulls/175/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/readability/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/readability/pulls/175/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/readability/statuses/54cf0427e98aabec2fdf2642a81cf9cb074e7709"}}}}