[GitHubGistBridge] Fix broken bridge

`defaultLinkTo` makes anchors point to the correct path which broke
parsing because it expected href to start with `#gistcomment`.

This commit changes the implementation to make `defaultLinkTo` point
to the correct page (using `getURI` instead of `self::URI`) and search
with `*=` instead of `^=`.
This commit is contained in:
logmanoriginal 2018-11-03 11:52:31 +01:00
parent 2ac2f3dc66
commit 2e6cbd1ce7

View file

@ -54,7 +54,7 @@ class GitHubGistBridge extends BridgeAbstract {
DEFAULT_SPAN_TEXT)
or returnServerError('Could not request ' . $this->getURI());
$html = defaultLinkTo($html, static::URI);
$html = defaultLinkTo($html, $this->getURI());
$fileinfo = $html->find('[class="file-info"]', 0)
or returnServerError('Could not find file info!');
@ -69,7 +69,7 @@ class GitHubGistBridge extends BridgeAbstract {
foreach($comments as $comment) {
$uri = $comment->find('a[href^=#gistcomment]', 0)
$uri = $comment->find('a[href*=#gistcomment]', 0)
or returnServerError('Could not find comment anchor!');
$title = $comment->find('div[class="unminimized-comment"] h3[class="timeline-comment-header-text"]', 0)
@ -86,7 +86,7 @@ class GitHubGistBridge extends BridgeAbstract {
$item = array();
$item['uri'] = $this->getURI() . $uri->href;
$item['uri'] = $uri->href;
$item['title'] = str_replace('commented', 'commented on', $title->plaintext);
$item['timestamp'] = strtotime($datetime->datetime);
$item['author'] = '<a href="' . $author->href . '">' . $author->plaintext . '</a>';