Alexander Klimov 9af89e6ccf doc module: style h[1-6], table and code
Headers have different sizes
Tables have borders
Table headers are left-aligned
Codes are displayed inline (except inside pre) and have scrollbars if necessary

refs #6484
fixes #6632
2014-07-23 11:28:45 +02:00

41 lines
1.3 KiB
PHTML

<?php
$urlHelper = $this->getHelper('Url');
$view = $this;
?>
<div class="chapter">
<?= preg_replace_callback(
'/<a\s+(?P<attribs>[^>]*?\s+)?href="#(?P<fragment>[^"]+)"/im',
function($match) use ($toc, $moduleName, $urlHelper, $view) {
if (($node = $toc->findNodeBy(function ($node) use ($match) {
$section = $node->getValue();
if (($section->id === null && $section->chapterName === $match['fragment'])
|| $section->id === $match['fragment']
) {
return true;
}
return false;
}))) {
$section = $node->getValue();
$path = $urlHelper->url(
array('moduleName' => $moduleName, 'chapterName' => $section->chapterName),
'doc/module/chapter',
false,
false
);
$url = $view->url($path);
if ($section->id) {
$url->setAnchor($section->id);
}
return sprintf(
'<a %s%shref="%s"',
strlen($match['attribs']) ? trim($match['attribs']) . ' ' : '',
$section->nofollow ? 'rel="nofollow" ' : '',
$url->getAbsoluteUrl()
);
}
return $match[0];
},
$chapterHtml
); ?>
</div>