I would like to write an extension similar to the fig-numbering, but for teaching exercises. I am writing a book and I would like to define an `.. exercise::` and a `.. solution:: ` (nested into it) directives.
At some point I would like to list all the exercices so I need an EnvironmentCollector that I setup in my application with `app.add_env_collector(ExercisesCollector)`.
In Sphinx, the fignum environment variable is (and this is very very ugly) defined globally in the BuildEnvironment class which should NOT be aware that a feature fig numbering exists somewhere.
Anyway. I am surprised that the EnvironmentCollector has no __init__ wheer I can say:
class ExercisesCollector(EnvironmentCollector):
def __init__(self, app: Sphinx, env: BuildEnvironment):
env.exercises = {}
What would be the proper way to do this in my extension?