mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 14:26:54 +08:00
fixed several issues with apidoc generator
This commit is contained in:
@ -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
|
the fastest one when dealing with cache in a distributed applications (e.g. with several servers, load
|
||||||
balancers, etc.)
|
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).
|
(redis version 2.6.12 or higher is required).
|
||||||
|
|
||||||
* [[\yii\caching\WinCache]]: uses PHP [WinCache](http://iis.net/downloads/microsoft/wincache-extension)
|
* [[\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);
|
$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();
|
$context = new Context();
|
||||||
|
|
||||||
$cacheFile = $targetDir . '/cache/' . md5(serialize($files)) . '.tmp';
|
$cacheFile = $targetDir . '/cache/' . md5(serialize($files)) . '.tmp';
|
||||||
|
@ -21,7 +21,8 @@
|
|||||||
"require": {
|
"require": {
|
||||||
"yiisoft/yii2": "*",
|
"yiisoft/yii2": "*",
|
||||||
"yiisoft/yii2-bootstrap": "*",
|
"yiisoft/yii2-bootstrap": "*",
|
||||||
"phpdocumentor/reflection": ">=1.0.3"
|
"phpdocumentor/reflection": ">=1.0.3",
|
||||||
|
"nikic/php-parser": "0.9.*"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": { "yii\\apidoc\\": "" }
|
"psr-4": { "yii\\apidoc\\": "" }
|
||||||
|
@ -29,6 +29,48 @@ class ApiMarkdown extends GithubMarkdown
|
|||||||
|
|
||||||
protected $context;
|
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
|
* Renders a code block
|
||||||
*/
|
*/
|
||||||
|
@ -31,7 +31,7 @@ $this->beginPage();
|
|||||||
'options' => [
|
'options' => [
|
||||||
'class' => 'navbar-inverse navbar-fixed-top',
|
'class' => 'navbar-inverse navbar-fixed-top',
|
||||||
],
|
],
|
||||||
'padded' => false,
|
'renderInnerContainer' => false,
|
||||||
'view' => $this,
|
'view' => $this,
|
||||||
]);
|
]);
|
||||||
$extItems = [];
|
$extItems = [];
|
||||||
|
@ -57,7 +57,7 @@ class BaseMarkdown
|
|||||||
public static function process($markdown, $flavor = 'original')
|
public static function process($markdown, $flavor = 'original')
|
||||||
{
|
{
|
||||||
$parser = static::getParser($flavor);
|
$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')
|
public static function processParagraph($markdown, $flavor = 'original')
|
||||||
{
|
{
|
||||||
$parser = static::getParser($flavor);
|
$parser = static::getParser($flavor);
|
||||||
return $parser->parseParagraph($parser);
|
return $parser->parseParagraph($markdown);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user