Get documentation module ready for release, first steps

This commit is contained in:
Thomas Gelf 2014-03-21 19:05:00 +00:00
parent b5b4d276d1
commit d326b3b683
5 changed files with 43 additions and 24 deletions

View File

@ -5,8 +5,27 @@
use Icinga\Module\Doc\Controller as DocController; use Icinga\Module\Doc\Controller as DocController;
use Icinga\Module\Doc\DocParser;
class Doc_IndexController extends DocController class Doc_IndexController extends DocController
{ {
protected $parser;
public function init()
{
$module = null;
$this->parser = new DocParser($module);
}
public function tocAction()
{
// Temporary workaround
list($html, $toc) = $this->parser->getDocumentation();
$this->view->toc = $toc;
}
/** /**
* Display the application's documentation * Display the application's documentation
*/ */

View File

@ -0,0 +1,14 @@
<div class="controls">
<h1>Module documentations</h1>
</div>
<div class="content" data-base-target="_next">
<?= $this->partial(
'layout/menu.phtml',
'default',
array(
'items' => $toc->getChildren(),
'sub' => false,
'url' => ''
)
) ?>
</div>

View File

@ -3,4 +3,4 @@
<?php foreach ($enabledModules as $module): ?> <?php foreach ($enabledModules as $module): ?>
<li><a href="<?= $this->href('doc/module/view', array('name' => $module)); ?>"><?= $module ?></a></li> <li><a href="<?= $this->href('doc/module/view', array('name' => $module)); ?>"><?= $module ?></a></li>
<?php endforeach ?> <?php endforeach ?>
</ul> </ul>

View File

@ -1,21 +1,7 @@
<?php if ($html === null): ?> <?php if ($html === null): ?>
<p>No documentation available.</p> <p>No documentation available.</p>
<?php else: ?> <?php else: ?>
<div class="row"> <div class="content">
<div class="col-sm-12 col-xs-12 col-md-2 col-lg-2"> <?= $html ?>
<?= $this->partial(
'layout/menu.phtml',
'default',
array(
'items' => $toc->getChildren(),
'sub' => false,
'url' => ''
)
);
?>
</div>
<div class="col-sm-12 col-xs-12 col-md-10 col-lg-10">
<?= $html ?>
</div>
</div> </div>
<?php endif ?> <?php endif ?>

View File

@ -4,15 +4,15 @@
namespace Icinga\Module\Doc; namespace Icinga\Module\Doc;
require_once 'vendor/Parsedown/Parsedown.php'; use RecursiveIteratorIterator;
use RecursiveDirectoryIterator;
use \RecursiveIteratorIterator; use Parsedown;
use \RecursiveDirectoryIterator;
use \Parsedown;
use Icinga\Application\Icinga; use Icinga\Application\Icinga;
use Icinga\Web\Menu; use Icinga\Web\Menu;
use Icinga\Web\Url; use Icinga\Web\Url;
require_once 'vendor/Parsedown/Parsedown.php';
/** /**
* Parser for documentation written in Markdown * Parser for documentation written in Markdown
*/ */
@ -119,7 +119,7 @@ class DocParser
'level' => $level, 'level' => $level,
'item' => $item 'item' => $item
)); ));
$line = '<span id="' . $id . '"></span>' . PHP_EOL . $line; $line = '<a name="' . $id . '"></a>' . PHP_EOL . $line;
} }
$cat[] = $line; $cat[] = $line;
} }