-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a new type for the current document's environment state #13151
Create a new type for the current document's environment state #13151
Conversation
# Conflicts: # sphinx/directives/__init__.py # sphinx/domains/changeset.py # tests/test_environment/test_environment.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This kind of interface, while being transparent for the user, may be worth documenting for extension developers
The class wouldn't be exposed but we can expose each documented attribute.
# Conflicts: # sphinx/domains/c/__init__.py # sphinx/domains/changeset.py # sphinx/domains/cpp/__init__.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This interface looks cleaner and this would help us refactoring things more easily.
Feature or Bugfix
Purpose
As a step towards #13072, this PR introduces a new
CurrentDocument
type to store and manipulate state in the environment for the document currently being read. This is currently stored in atemp_data
dict.We also rename the attribute on
BuildEnvironment
tocurrent_document
fromtemp_data
, keeping the old name as an alias.At present, none of the old names or e.g. the mapping interface to
CurrentDocument
are deprecated, though I expect that in the future this would be done.For downstream extensions that make use of
env.temp_data['...']
, this should be a transparent refactor.xref:
app
,env
, and the domains #13072