Discover

Extends \phpDocumentor\Plugin\Scrybe\Converter\RestructuredText\Visitors\Creator

A specialized RestructuredText Parser/Visitor to aid in the discovery phase.

This class collects all headings and their titles and populates the TableOfContents collection.

package

Default

Methods

Adds a TableOfContents File object to the last heading that was discovered.

addFileToLastHeading(\phpDocumentor\Plugin\Scrybe\Converter\Metadata\TableOfContents\File $file) 

This may be used by roles or directives to insert an include file into the TableOfContents and thus all its headings.

This method is explicitly bound to File objects and not other BaseEntry descendents because inline elements such as headings should also modify the internal pointers for this visitor.

Arguments

Returns the RestructuredText Document to retrieve the specialized cross-document collections.

getDocument() : \phpDocumentor\Plugin\Scrybe\Converter\RestructuredText\Document
inherited

Returns the filename for this visitor.

getFilename() : string
inherited

Response

string

Returns the filename for this visitor without an extension.

getFilenameWithoutExtension() : string
inherited

Response

string

Returns the table of contents.

getTableOfContents() 
inherited

return TableOfContents $toc

visit

visit(\ezcDocumentRstDocumentNode $ast) 

Arguments

$ast

\ezcDocumentRstDocumentNode

Visitor for the section heading used to populate the TableOfContents.

visitSection(\DOMNode $root, \ezcDocumentRstNode $node) : void

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

see \phpDocumentor\Plugin\Scrybe\Converter\RestructuredText\Visitors\getDocument()

for the document containing the TableOfContents.

\phpDocumentor\Plugin\Scrybe\Converter\Metadata\TableOfContents

for the Table of Contents class.

Arguments

$root

\DOMNode

$node

\ezcDocumentRstNode

Properties

This array is meant as a cache of the last entry per depth.

entry_pointers : array<mixed,\phpDocumentor\Plugin\Scrybe\Converter\Metadata\TableOfContents\Heading>

To build a hierarchy from a non-recursive method, such as visitSection(), you need a way to reference the last Entry per depth.

By keeping track of these pointers you know onto which parent you will need to add a node by checking which of higher depth was parsed last.

Important: because it is possible that levels are 'skipped' we will need to unset all 'deeper' depths when setting a new one. Otherwise we might inadvertently add an entry to the wrong tree.

var

Type(s)

array<mixed,\phpDocumentor\Plugin\Scrybe\Converter\Metadata\TableOfContents\Heading>

This is a pointer to the last discovered heading.

last_heading : \phpDocumentor\Plugin\Scrybe\Converter\Metadata\TableOfContents\Heading

Directives and roles may 'include' Files as children of the currently parsed heading. Elements as the toctree directive or a plain include are examples of such.

var

Type(s)

\phpDocumentor\Plugin\Scrybe\Converter\Metadata\TableOfContents\Heading

rst

rst : \phpDocumentor\Plugin\Scrybe\Converter\RestructuredText\Document
inherited