Skip to content

Commit 427d553

Browse files
committed
Let plugins put strings into warnings
even though they should be 2-tuples. Fixes #3014
1 parent 0584e51 commit 427d553

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

mkdocs/config/config_options.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -996,11 +996,19 @@ def load_plugin(self, name: str, config) -> plugins.BasePlugin:
996996
if hasattr(plugin, 'on_startup') or hasattr(plugin, 'on_shutdown'):
997997
self.plugin_cache[name] = plugin
998998

999-
errors, warnings = plugin.load_config(
999+
errors, warns = plugin.load_config(
10001000
config, self._config.config_file_path if self._config else None
10011001
)
1002-
self.warnings.extend(f"Plugin '{name}' value: '{x}'. Warning: {y}" for x, y in warnings)
1003-
errors_message = '\n'.join(f"Plugin '{name}' value: '{x}'. Error: {y}" for x, y in errors)
1002+
for warning in warns:
1003+
if isinstance(warning, str):
1004+
self.warnings.append(f"Plugin '{name}'. Warning: {warning}")
1005+
else:
1006+
key, msg = warning
1007+
self.warnings.append(f"Plugin '{name}' value: '{key}'. Warning: {msg}")
1008+
1009+
errors_message = '\n'.join(
1010+
f"Plugin '{name}' value: '{key}'. Error: {msg}" for key, msg in errors
1011+
)
10041012
if errors_message:
10051013
raise ValidationError(errors_message)
10061014
return plugin

0 commit comments

Comments
 (0)