diff --git a/docs/guide/caching.md b/docs/guide/caching.md index 1e4119d..8e7fdea 100644 --- a/docs/guide/caching.md +++ b/docs/guide/caching.md @@ -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) diff --git a/extensions/apidoc/commands/RenderController.php b/extensions/apidoc/commands/RenderController.php index 02030fe..43b66e7 100644 --- a/extensions/apidoc/commands/RenderController.php +++ b/extensions/apidoc/commands/RenderController.php @@ -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'; diff --git a/extensions/apidoc/composer.json b/extensions/apidoc/composer.json index 36ef971..69f9c4b 100644 --- a/extensions/apidoc/composer.json +++ b/extensions/apidoc/composer.json @@ -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\\": "" } diff --git a/extensions/apidoc/helpers/ApiMarkdown.php b/extensions/apidoc/helpers/ApiMarkdown.php index 3bbe411..cad9df0 100644 --- a/extensions/apidoc/helpers/ApiMarkdown.php +++ b/extensions/apidoc/helpers/ApiMarkdown.php @@ -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) diff --git a/extensions/apidoc/templates/bootstrap/layouts/main.php b/extensions/apidoc/templates/bootstrap/layouts/main.php index 1e953a6..801ee65 100644 --- a/extensions/apidoc/templates/bootstrap/layouts/main.php +++ b/extensions/apidoc/templates/bootstrap/layouts/main.php @@ -31,7 +31,7 @@ $this->beginPage(); 'options' => [ 'class' => 'navbar-inverse navbar-fixed-top', ], - 'padded' => false, + 'renderInnerContainer' => false, 'view' => $this, ]); $extItems = []; diff --git a/framework/helpers/BaseMarkdown.php b/framework/helpers/BaseMarkdown.php index f0a5fcc..a22e45e 100644 --- a/framework/helpers/BaseMarkdown.php +++ b/framework/helpers/BaseMarkdown.php @@ -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); } /**