Skip to content

Commit

Permalink
Fixing bug with nested code samples.
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Lewis <jason.lewis1991@gmail.com>
  • Loading branch information
jasonlewis committed Nov 24, 2012
1 parent 04ca9dd commit eace570
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions classes/providers/github.php
Expand Up @@ -60,7 +60,7 @@ public function articles()
{
$name = str_replace(ARTICLE_EXTENSION, null, $value->name);

if (in_array($name, (array) Config::get('twocents::twocents.ignored_articles')))
if ($this->isIgnored($name))
{
continue;
}
Expand Down Expand Up @@ -89,9 +89,15 @@ public function articles()
// Spin through each of the assets and add them to their respective articles.
foreach ($this->fetch() as $item)
{
$article = trim(str_replace(array($item->name, 'articles'), null, $item->path), '/');
if (is_object($item))
{
$article = trim(str_replace(array($item->name, 'articles'), null, $item->path), '/');

$articles[$article]->registerAsset($item->name, base64_decode($item->content));
if (isset($articles[$article]))
{
$articles[$article]->registerAsset($item->name, base64_decode($item->content));
}
}
}

// Spin through each article and find the author for the article. We'll also assign the body of the article
Expand Down Expand Up @@ -140,7 +146,10 @@ public function article($article)
// Spin through the assets we need to fetch and add them to the article.
foreach ($this->fetch() as $asset)
{
$article->registerAsset($asset->name, base64_decode($asset->content));
if (is_object($asset))
{
$article->registerAsset($asset->name, base64_decode($asset->content));
}
}

$article->body(base64_decode($article->raw->content))
Expand Down

0 comments on commit eace570

Please sign in to comment.