Commit c9c7db9a by Carsten Brandt

fixed several issues with apidoc generator

parent 9190e0f4
......@@ -61,7 +61,7 @@ is a summary of the available cache components:
the fastest one when dealing with cache in a distributed applications (e.g. with several servers, load
balancers, etc.)
* [[\yii\caching\RedisCache]]: implements a cache component based on [Redis](http://redis.io/) key-value store
* [[\yii\redis\Cache]]: implements a cache component based on [Redis](http://redis.io/) key-value store
(redis version 2.6.12 or higher is required).
* [[\yii\caching\WinCache]]: uses PHP [WinCache](http://iis.net/downloads/microsoft/wincache-extension)
......
......@@ -65,6 +65,11 @@ class RenderController extends Controller
$this->stdout('done.' . PHP_EOL, Console::FG_GREEN);
if (empty($files)) {
$this->stderr('Error: No php files found to process.' . PHP_EOL);
return 1;
}
$context = new Context();
$cacheFile = $targetDir . '/cache/' . md5(serialize($files)) . '.tmp';
......
......@@ -21,7 +21,8 @@
"require": {
"yiisoft/yii2": "*",
"yiisoft/yii2-bootstrap": "*",
"phpdocumentor/reflection": ">=1.0.3"
"phpdocumentor/reflection": ">=1.0.3",
"nikic/php-parser": "0.9.*"
},
"autoload": {
"psr-4": { "yii\\apidoc\\": "" }
......
......@@ -30,6 +30,48 @@ class ApiMarkdown extends GithubMarkdown
protected $context;
/**
* @inheritDoc
*/
protected function identifyLine($lines, $current)
{
if (strncmp($lines[$current], '~~~', 3) === 0) {
return 'fencedCode';
}
return parent::identifyLine($lines, $current);
}
/**
* Consume lines for a fenced code block
*/
protected function consumeFencedCode($lines, $current)
{
// consume until ```
$block = [
'type' => 'code',
'content' => [],
];
$line = rtrim($lines[$current]);
if (strncmp($lines[$current], '~~~', 3) === 0) {
$fence = '~~~';
$language = 'php';
} else {
$fence = substr($line, 0, $pos = strrpos($line, '`') + 1);
$language = substr($line, $pos);
}
if (!empty($language)) {
$block['language'] = $language;
}
for($i = $current + 1, $count = count($lines); $i < $count; $i++) {
if (rtrim($line = $lines[$i]) !== $fence) {
$block['content'][] = $line;
} else {
break;
}
}
return [$block, $i];
}
/**
* Renders a code block
*/
protected function renderCode($block)
......
......@@ -31,7 +31,7 @@ $this->beginPage();
'options' => [
'class' => 'navbar-inverse navbar-fixed-top',
],
'padded' => false,
'renderInnerContainer' => false,
'view' => $this,
]);
$extItems = [];
......
......@@ -57,7 +57,7 @@ class BaseMarkdown
public static function process($markdown, $flavor = 'original')
{
$parser = static::getParser($flavor);
return $parser->parse($parser);
return $parser->parse($markdown);
}
/**
......@@ -73,7 +73,7 @@ class BaseMarkdown
public static function processParagraph($markdown, $flavor = 'original')
{
$parser = static::getParser($flavor);
return $parser->parseParagraph($parser);
return $parser->parseParagraph($markdown);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment