mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2025-01-19 01:14:06 +01:00
Fixed info plugin terminating on subsequent reload when serving
This commit is contained in:
parent
99eed0e810
commit
ad6c47ddb6
@ -57,19 +57,18 @@ class InfoPlugin(BasePlugin[InfoPluginConfig]):
|
|||||||
|
|
||||||
# Determine whether we're serving
|
# Determine whether we're serving
|
||||||
def on_startup(self, *, command, dirty):
|
def on_startup(self, *, command, dirty):
|
||||||
|
self.is_serve = (command == "serve")
|
||||||
|
|
||||||
|
# Initialize plugin (run earliest)
|
||||||
|
@event_priority(100)
|
||||||
|
def on_config(self, config):
|
||||||
if not self.config.enabled:
|
if not self.config.enabled:
|
||||||
return
|
return
|
||||||
|
|
||||||
# By default, the plugin is disabled when the documentation is served,
|
# By default, the plugin is disabled when the documentation is served,
|
||||||
# but not when it is built. This should nicely align with the expected
|
# but not when it is built. This should nicely align with the expected
|
||||||
# user experience when creating reproductions.
|
# user experience when creating reproductions.
|
||||||
if not self.config.enabled_on_serve:
|
if not self.config.enabled_on_serve and self.is_serve:
|
||||||
self.config.enabled = command != "serve"
|
|
||||||
|
|
||||||
# Initialize plugin (run earliest)
|
|
||||||
@event_priority(100)
|
|
||||||
def on_config(self, config):
|
|
||||||
if not self.config.enabled:
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# Resolve latest version
|
# Resolve latest version
|
||||||
|
@ -57,19 +57,18 @@ class InfoPlugin(BasePlugin[InfoPluginConfig]):
|
|||||||
|
|
||||||
# Determine whether we're serving
|
# Determine whether we're serving
|
||||||
def on_startup(self, *, command, dirty):
|
def on_startup(self, *, command, dirty):
|
||||||
|
self.is_serve = (command == "serve")
|
||||||
|
|
||||||
|
# Initialize plugin (run earliest)
|
||||||
|
@event_priority(100)
|
||||||
|
def on_config(self, config):
|
||||||
if not self.config.enabled:
|
if not self.config.enabled:
|
||||||
return
|
return
|
||||||
|
|
||||||
# By default, the plugin is disabled when the documentation is served,
|
# By default, the plugin is disabled when the documentation is served,
|
||||||
# but not when it is built. This should nicely align with the expected
|
# but not when it is built. This should nicely align with the expected
|
||||||
# user experience when creating reproductions.
|
# user experience when creating reproductions.
|
||||||
if not self.config.enabled_on_serve:
|
if not self.config.enabled_on_serve and self.is_serve:
|
||||||
self.config.enabled = command != "serve"
|
|
||||||
|
|
||||||
# Initialize plugin (run earliest)
|
|
||||||
@event_priority(100)
|
|
||||||
def on_config(self, config):
|
|
||||||
if not self.config.enabled:
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# Resolve latest version
|
# Resolve latest version
|
||||||
|
Loading…
x
Reference in New Issue
Block a user