Skip to content
This repository has been archived by the owner on Dec 27, 2018. It is now read-only.

Commit

Permalink
Merge a871dbd into 15ccff1
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudLigny committed Nov 27, 2017
2 parents 15ccff1 + a871dbd commit 8b064d8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Page/VariableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function setVariable($name, $value)
}
}
} catch (\Exception $e) {
throw new \Exception(sprintf("Expected date string"));
throw new \Exception(sprintf('Expected date string'));
}
break;
case 'draft':
Expand Down
6 changes: 4 additions & 2 deletions src/Step/ConvertPages.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

use PHPoole\Collection\Page\Page;
use PHPoole\Converter\Converter;
use PHPoole\Exception\Exception;

/**
* Converts content of all pages.
Expand All @@ -33,6 +32,7 @@ public function internalProcess()
foreach ($this->phpoole->getPages() as $page) {
if (!$page->isVirtual()) {
$count++;

try {
$convertedPage = $this->convertPage($page, $this->phpoole->getConfig()->get('frontmatter.format'));
$message = $page->getName();
Expand All @@ -56,7 +56,7 @@ public function internalProcess()
}
if ($error > 0) {
$message = '[ERROR] '.$message;
call_user_func_array($this->phpoole->getMessageCb(), ['CONVERT', 'ERROR', $message, $count-$error, $max]);
call_user_func_array($this->phpoole->getMessageCb(), ['CONVERT', 'ERROR', $message, $count - $error, $max]);
}
}

Expand All @@ -77,13 +77,15 @@ public function convertPage(Page $page, $format = 'yaml')
$variables = Converter::convertFrontmatter($page->getFrontmatter(), $format);
} catch (\Exception $e) {
$message = sprintf("Unable to convert frontmatter of '%s': %s", $page->getId(), $e->getMessage());

throw new \Exception($message);
}
// set variables
try {
$page->setVariables($variables);
} catch (\Exception $e) {
$message = sprintf("Unable to set variable in '%s': %s", $page->getId(), $e->getMessage());

throw new \Exception($message);
}

Expand Down

0 comments on commit 8b064d8

Please sign in to comment.