refactor: Deprecate BaseCollector and BaseRenderer #413
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Commit message:
The BaseCollector and BaseRenderer are merged into
the BaseHandler (as mixins for now).
Developers are still able to create collectors
and renderers using these deprecated base classes,
and pass instances of them when creating their handler.
All the methods of the deprecated bases can now
be defined on the BaseHandler subclass itself.
Handlers can then be instantiated by passing
the handler's name, the theme and the optional
custom templates folder name/path.
Reasoning: often times, the renderer and the collector
need to communicate or share data. For example,
the Crystal renderer uses the collector to lookup names
when creating cross-references. The Python handlers
are able to filter members when collecting/returning data,
and need the same members list when rendering,
to order the elements based on that list.
This change is the first of two, where the second change
will deprecate the use of
selection
andrendering
keysin the YAML options or MkDocs configuration, in favor of
a single
options
key that both the collection and renderingprocess will share.
This change was mentioned in #364.
An example of what this implies for existing handlers: mkdocstrings/python#10
Of course, nothing prevents developers from continuing to split their handler logic in multiple parts/classes/modules: