diff --git a/modules/doc/application/controllers/IcingawebController.php b/modules/doc/application/controllers/IcingawebController.php index 967a2b768..5740f50a9 100644 --- a/modules/doc/application/controllers/IcingawebController.php +++ b/modules/doc/application/controllers/IcingawebController.php @@ -13,7 +13,7 @@ class Doc_IcingawebController extends DocController */ public function tocAction() { - $this->renderToc(Icinga::app()->getApplicationDir('/../doc'), 'Icinga Web 2', 'doc/icingaweb/chapter'); + return $this->renderToc(Icinga::app()->getApplicationDir('/../doc'), 'Icinga Web 2', 'doc/icingaweb/chapter'); } /** @@ -30,7 +30,7 @@ class Doc_IcingawebController extends DocController 404 ); } - $this->renderChapter( + return $this->renderChapter( Icinga::app()->getApplicationDir('/../doc'), $chapterId, 'doc/icingaweb/toc', @@ -43,6 +43,6 @@ class Doc_IcingawebController extends DocController */ public function pdfAction() { - $this->renderPdf(Icinga::app()->getApplicationDir('/../doc'), 'Icinga Web 2', 'doc/icingaweb/chapter'); + return $this->renderPdf(Icinga::app()->getApplicationDir('/../doc'), 'Icinga Web 2', 'doc/icingaweb/chapter'); } } diff --git a/modules/doc/application/controllers/IndexController.php b/modules/doc/application/controllers/IndexController.php index c83cfabab..63b5e8cdf 100644 --- a/modules/doc/application/controllers/IndexController.php +++ b/modules/doc/application/controllers/IndexController.php @@ -6,5 +6,7 @@ use Icinga\Module\Doc\DocController; class Doc_IndexController extends DocController { - public function indexAction() {} + public function indexAction() + { + } } diff --git a/modules/doc/application/controllers/ModuleController.php b/modules/doc/application/controllers/ModuleController.php index 40913368c..1e9cf43b1 100644 --- a/modules/doc/application/controllers/ModuleController.php +++ b/modules/doc/application/controllers/ModuleController.php @@ -65,9 +65,10 @@ class Doc_ModuleController extends DocController { $moduleName = $this->getParam('moduleName'); $this->assertModuleEnabled($moduleName); + $this->view->moduleName = $moduleName; $moduleManager = Icinga::app()->getModuleManager(); try { - $this->renderToc( + return $this->renderToc( $moduleManager->getModuleDir($moduleName, '/doc'), $moduleName, 'doc/module/chapter', @@ -76,7 +77,6 @@ class Doc_ModuleController extends DocController } catch (DocException $e) { throw new Zend_Controller_Action_Exception($e->getMessage(), 404); } - $this->view->moduleName = $moduleName; } /** @@ -97,9 +97,10 @@ class Doc_ModuleController extends DocController 404 ); } + $this->view->moduleName = $moduleName; $moduleManager = Icinga::app()->getModuleManager(); try { - $this->renderChapter( + return $this->renderChapter( $moduleManager->getModuleDir($moduleName, '/doc'), $chapterId, $this->_helper->url->url(array('moduleName' => $moduleName), 'doc/module/toc'), @@ -109,7 +110,6 @@ class Doc_ModuleController extends DocController } catch (DocException $e) { throw new Zend_Controller_Action_Exception($e->getMessage(), 404); } - $this->view->moduleName = $moduleName; } /** @@ -122,7 +122,7 @@ class Doc_ModuleController extends DocController $moduleName = $this->getParam('moduleName'); $this->assertModuleEnabled($moduleName); $moduleManager = Icinga::app()->getModuleManager(); - $this->renderPdf( + return $this->renderPdf( $moduleManager->getModuleDir($moduleName, '/doc'), $moduleName, 'doc/module/chapter', diff --git a/modules/doc/library/Doc/DocController.php b/modules/doc/library/Doc/DocController.php index 42f8dce9b..bc782953f 100644 --- a/modules/doc/library/Doc/DocController.php +++ b/modules/doc/library/Doc/DocController.php @@ -28,7 +28,7 @@ class DocController extends ModuleActionController $urlParams ); $this->view->title = $chapterId; - $this->_helper->viewRenderer('chapter', null, true); + return $this->render('chapter', null, true); } /** @@ -46,7 +46,7 @@ class DocController extends ModuleActionController $name = ucfirst($name); $this->view->docName = $name; $this->view->title = sprintf($this->translate('%s Documentation'), $name); - $this->_helper->viewRenderer('toc', null, true); + return $this->render('toc', null, true); } /** @@ -70,7 +70,7 @@ class DocController extends ModuleActionController $urlParams ); $this->view->docName = $name; - $this->_helper->viewRenderer('pdf', null, true); $this->_request->setParam('format', 'pdf'); + return $this->render('pdf', null, true); } } diff --git a/modules/doc/library/Doc/SectionRenderer.php b/modules/doc/library/Doc/SectionRenderer.php index 12f0f2ac4..2fdaf8e90 100644 --- a/modules/doc/library/Doc/SectionRenderer.php +++ b/modules/doc/library/Doc/SectionRenderer.php @@ -181,6 +181,19 @@ class SectionRenderer extends Renderer return substr_replace($doc->saveXML($img), '', -2, 1); // Replace '/>' with '>' } + protected function blubb($match) + { + $doc = new DOMDocument(); + $doc->loadHTML($match[0]); + $xpath = new DOMXPath($doc); + $blockquote = $xpath->query('//blockquote[1]')->item(0); + /* @var $blockquote \DOMElement */ + if (strtolower(substr(trim($blockquote->nodeValue), 0, 5)) === 'note:') { + $blockquote->setAttribute('class', 'note'); + } + return $doc->saveXML($blockquote); + } + /** * Render the section * @@ -213,6 +226,11 @@ class SectionRenderer extends Renderer array($this, 'replaceImg'), $html ); + $html = preg_replace_callback( + '#
.+
#ms', + array($this, 'blubb'), + $html + ); $content[] = preg_replace_callback( '/[^>]*?\s+)?href="#(?P[^"]+)"/', array($callback, 'render'),