doc: Don't use $this->_helper->viewRenderer
This somehow breaks our postDispatch logic. But $this->render does not.
This commit is contained in:
parent
f470e66884
commit
a7b16bc4a2
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,5 +6,7 @@ use Icinga\Module\Doc\DocController;
|
|||
|
||||
class Doc_IndexController extends DocController
|
||||
{
|
||||
public function indexAction() {}
|
||||
public function indexAction()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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(
|
||||
'#<blockquote>.+</blockquote>#ms',
|
||||
array($this, 'blubb'),
|
||||
$html
|
||||
);
|
||||
$content[] = preg_replace_callback(
|
||||
'/<a\s+(?P<attribs>[^>]*?\s+)?href="#(?P<fragment>[^"]+)"/',
|
||||
array($callback, 'render'),
|
||||
|
|
Loading…
Reference in New Issue