protected function visitSection(\DOMNode $root, \ezcDocumentRstNode $node)
    {
        if ($node instanceof ezcDocumentRstSectionNode || $node instanceof ezcDocumentRstDocumentNode) {
            if ($node->depth === 1) {
                $toc = $this->getTableOfContents();
                $file = $toc[$this->getFilenameWithoutExtension()];
                $file->setName($this->nodeToString($node->title));
            } else {
                // find nearest parent pointer depth-wise
                $parent_depth = $node->depth - 1;
                while (!isset($this->entry_pointers[$parent_depth]) && $parent_depth > 0) {
                    --$parent_depth;
                }

                $parent = $this->entry_pointers[$parent_depth];
                $heading = new TableOfContents\Heading($parent);
                $heading->setName($this->nodeToString($node->title));
                $heading->setSlug($node->reference);
                $parent->addChild($heading);

                // set as last indexed heading
                $this->last_heading = $heading;

                // add as new entry pointer
                array_splice($this->entry_pointers, $parent_depth + 1, count($this->entry_pointers), [$heading]);
            }
        }

        parent::visitSection($root, $node);
    }
protected function visitSection(\DOMNode $root, \ezcDocumentRstNode $node)
    {
        if ($node instanceof ezcDocumentRstSectionNode || $node instanceof ezcDocumentRstDocumentNode) {
            if ($node->depth === 1) {
                $toc = $this->getTableOfContents();
                $file = $toc[$this->getFilenameWithoutExtension()];
                $file->setName($this->nodeToString($node->title));
            } else {
                // find nearest parent pointer depth-wise
                $parent_depth = $node->depth - 1;
                while (!isset($this->entry_pointers[$parent_depth]) && $parent_depth > 0) {
                    --$parent_depth;
                }

                $parent = $this->entry_pointers[$parent_depth];
                $heading = new TableOfContents\Heading($parent);
                $heading->setName($this->nodeToString($node->title));
                $heading->setSlug($node->reference);
                $parent->addChild($heading);

                // set as last indexed heading
                $this->last_heading = $heading;

                // add as new entry pointer
                array_splice($this->entry_pointers, $parent_depth + 1, count($this->entry_pointers), [$heading]);
            }
        }

        parent::visitSection($root, $node);
    }
protected function visitSection ( \ DOMNode $ root , \ ezcDocumentRstNode $ node ) { if ( $ node instanceof ezcDocumentRstSectionNode || $ node instanceof ezcDocumentRstDocumentNode ) { if ( $ node -> depth === 1 ) { $ toc = $ this -> getTableOfContents ( ) ; $ file = $ toc [ $ this -> getFilenameWithoutExtension ( ) ] ; $ file -> setName ( $ this -> nodeToString ( $ node -> title ) ) ; } else { // find nearest parent pointer depth-wise $ parent_depth = $ node -> depth - 1 ; while ( ! isset ( $ this -> entry_pointers [ $ parent_depth ] ) && $ parent_depth > 0 ) { -- $ parent_depth ; } $ parent = $ this -> entry_pointers [ $ parent_depth ] ; $ heading = new TableOfContents \ Heading ( $ parent ) ; $ heading -> setName ( $ this -> nodeToString ( $ node -> title ) ) ; $ heading -> setSlug ( $ node -> reference ) ; $ parent -> addChild ( $ heading ) ; // set as last indexed heading $ this -> last_heading = $ heading ; // add as new entry pointer array_splice ( $ this -> entry_pointers , $ parent_depth + 1 , count ( $ this -> entry_pointers ) , [ $ heading ] ) ; } } parent :: visitSection ( $ root , $ node ) ; }
Visitor for the section heading used to populate the TableOfContents.

This method interprets the heading and its containing text and adds new entries to the TableOfContents object
in the RestructuredText document.

@see getDocument() for the document containing the TableOfContents.
@see phpDocumentor\Plugin\Scrybe\Converter\Metadata\TableOfContents for the Table of Contents class.
Visitor for the section heading used to populate the TableOfContents .