Class yii\apidoc\helpers\IndexFileAnalyzer
| Inheritance | yii\apidoc\helpers\IndexFileAnalyzer » cebe\markdown\Markdown |
|---|---|
| Source Code | https://github.com/yiisoft/yii2-apidoc/blob/master/helpers/IndexFileAnalyzer.php |
IndexFileAnalyzer analyzes index file with TOC. Typically README.md.
Public Properties
| Property | Type | Description | Defined By |
|---|---|---|---|
| $introduction | yii\apidoc\helpers\IndexFileAnalyzer | ||
| $title | yii\apidoc\helpers\IndexFileAnalyzer |
Public Methods
| Method | Description | Defined By |
|---|---|---|
| analyze() | Parses text and returns list of chapters got from it | yii\apidoc\helpers\IndexFileAnalyzer |
Protected Methods
| Method | Description | Defined By |
|---|---|---|
| renderHeadline() | yii\apidoc\helpers\IndexFileAnalyzer | |
| renderList() | yii\apidoc\helpers\IndexFileAnalyzer | |
| renderParagraph() | yii\apidoc\helpers\IndexFileAnalyzer |
Property Details
Method Details
Parses text and returns list of chapters got from it
| public array analyze ( $text ) | ||
| $text | string | |
public function analyze($text)
{
$this->parse($text);
return $this->_chapters;
}
| protected void renderHeadline ( $block ) | ||
| $block | ||
protected function renderHeadline($block)
{
if ($this->_chapter === 0) {
$this->title = $this->renderAbsy($block['content']);
$this->introduction = '';
$this->_chapter++;
} else {
$this->_chapter++;
$this->_chapters[$this->_chapter] = [
'headline' => $this->renderAbsy($block['content']),
'content' => [],
];
}
return parent::renderHeadline($block);
}
| protected void renderList ( $block ) | ||
| $block | ||
protected function renderList($block)
{
if ($this->_chapter > 0) {
foreach ($block['items'] as $item => $absyElements) {
foreach($absyElements as $element) {
if ($element[0] === 'link') {
$this->_chapters[$this->_chapter]['content'][] = [
'headline' => $this->renderAbsy($element['text']),
'file' => $element['url'],
];
}
}
}
}
return parent::renderList($block);
}
| protected void renderParagraph ( $block ) | ||
| $block | ||
protected function renderParagraph($block)
{
if ($this->_chapter < 1) {
$this->introduction .= $this->renderAbsy($block['content']);
}
return parent::renderParagraph($block);
}