Handling RakuDoc v2 block scope concept.
RakuDoc v2 introduces the concept of a block scope. The choice of terminology is to avoid some of the complexities of Raku's 'lexical scope'.
Basically a block scope is started by a =begin BLOCKNAME and ended by a =end BLOCKNAME.
Within a block scope, several directives may affect other RakuDoc features within the same block, such as =config and =alias.
Once the block has ended, the effect of such directives end.
The ScopedData class was written to track and handle this sort of behaviour.
Typically only one ScopedData object is instantiated.
The following pieces of information are tracked:
Provides information about all block scopes. A ScopeData object has an attribute debug. If set to True then diagnostic is called by start-scope and end-scope.
Starts a new scope. When a scope is started, all the previous information is copied.
This information can be changed within the scope.
If verbatim is set, then all strings will be rendered without removing spaces or new lines.
Changes to items tracked by the object are forgotten.
Add key/value pair to the existing scope's config
Get the current scope's config
Add key/value pair to the existing scope's aliases
Get the current scope's aliases
Return the last starter block
Return the most recent title
Change the title for the current block
Change the state of the verbatim flag to True
Which block set the verbatim flag
Increment the item numeration at the required level, returns the result. See Numeration module for more detail
Reset the item numeration altogether
Increment the defn numeration, only one level
Reset the defn numeration