Skip to content

Commit

Permalink
fix example doc generation (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
dwsupplee authored and jdpedrie committed Jun 2, 2016
1 parent ffd7cc3 commit 036cd8b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions scripts/DocGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,17 +194,20 @@ private function buildExamples($examples)
$exampleParts = explode('```', $examples);

foreach ($exampleParts as $example) {
$example = trim($example);
$caption = '';

if (strlen($example) === 0) {
continue;
}

// strip the syntax highlighting, it won't be used in the doc site
$example = ltrim($example, 'php');
$example = trim($example);
$lines = explode(PHP_EOL, $example);

// strip the syntax highlighting, it won't be used in the doc site
if (substr($lines[0], 0, 3) === 'php') {
unset($lines[0]);
}

foreach ($lines as $key => $line) {
if (substr($line, 0, 2) === '//') {
$caption .= $this->markdown->parse(substr($line, 3));
Expand Down

0 comments on commit 036cd8b

Please sign in to comment.