Hi, The EnvironmentCollector is a collection of event handlers for environment object. It should not have a status locally. The environment object is given from outside when event emitted. So you don't need to give arguments to EnvironmentCollector.
Thanks, Takeshi KOMIYA 2019年8月2日(金) 17:20 Yves Chevallier <[email protected]>: > > 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? > > -- > You received this message because you are subscribed to the Google Groups > "sphinx-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sphinx-users/0dbd4dde-9f0a-4747-ae0d-85145b4dde61%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "sphinx-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/CAFmkQANQKqpGrhLBy7jOFTsAqtwYdX5D9TbbQ%2BmHU_PFKKkXhA%40mail.gmail.com.
