Doc: Number headings in toc

refs #8487
This commit is contained in:
Eric Lippmann 2016-01-05 16:10:01 +01:00
parent a63dd58b6a
commit 313a02d9f0
2 changed files with 19 additions and 5 deletions

View File

@ -16,6 +16,20 @@ use RecursiveIteratorIterator;
*/ */
class DocTocRenderer extends DocRenderer class DocTocRenderer extends DocRenderer
{ {
/**
* CSS class for the HTML list element
*
* @var string
*/
const CSS_CLASS = 'toc';
/**
* Tag for the HTML list element
*
* @var string
*/
const HTML_LIST_TAG = 'ol';
/** /**
* Content to render * Content to render
* *
@ -38,7 +52,7 @@ class DocTocRenderer extends DocRenderer
*/ */
public function beginIteration() public function beginIteration()
{ {
$this->content[] = '<nav role="navigation"><ul class="toc">'; $this->content[] = sprintf('<nav role="navigation"><%s class="%s">', static::HTML_LIST_TAG, static::CSS_CLASS);
} }
/** /**
@ -46,7 +60,7 @@ class DocTocRenderer extends DocRenderer
*/ */
public function endIteration() public function endIteration()
{ {
$this->content[] = '</ul></nav>'; $this->content[] = sprintf('</%s></nav>', static::HTML_LIST_TAG);
} }
/** /**
@ -54,7 +68,7 @@ class DocTocRenderer extends DocRenderer
*/ */
public function beginChildren() public function beginChildren()
{ {
$this->content[] = '<ul class="toc">'; $this->content[] = sprintf('<%s class="%s">', static::HTML_LIST_TAG, static::CSS_CLASS);
} }
/** /**
@ -62,7 +76,7 @@ class DocTocRenderer extends DocRenderer
*/ */
public function endChildren() public function endChildren()
{ {
$this->content[] = '</ul>'; $this->content[] = sprintf('</%s>', static::HTML_LIST_TAG);
} }
/** /**

View File

@ -81,7 +81,7 @@ pre > code {
color: inherit; color: inherit;
} }
ul.toc { .toc {
margin: 0; margin: 0;
padding: 0 0 0 1em; padding: 0 0 0 1em;
} }