mirror of
https://github.com/zensical/zensical.git
synced 2026-08-23 07:36:52 +00:00
fix: defaults for mike incorrectly set
Signed-off-by: squidfunk <martin.donath@squidfunk.com>
This commit is contained in:
Vendored
+17
@@ -171,6 +171,23 @@ class TestPluginShimming:
|
||||
config = self._parse_yaml(tmp_path, plugins={"glightbox": {}})
|
||||
assert GlightboxExtension.name in config["markdown_extensions"]
|
||||
|
||||
def test_mike_plugin_defaults_with_versioned_build(
|
||||
self, monkeypatch: pytest.MonkeyPatch, tmp_path: Path
|
||||
) -> None:
|
||||
monkeypatch.setenv("MIKE_DOCS_VERSION", "0.3")
|
||||
config = self._parse_yaml(
|
||||
tmp_path,
|
||||
site_url="https://example.com",
|
||||
plugins=["mike"],
|
||||
)
|
||||
assert config["site_url"] == "https://example.com/0.3"
|
||||
assert config["plugins"]["mike"]["config"] == {
|
||||
"alias_type": "symlink",
|
||||
"redirect_template": None,
|
||||
"deploy_prefix": "",
|
||||
"canonical_version": None,
|
||||
}
|
||||
|
||||
def test_glightbox_adds_extension_and_forwards_config(
|
||||
self, tmp_path: Path
|
||||
) -> None:
|
||||
|
||||
@@ -1286,17 +1286,11 @@ def _convert_plugins(value: Any, config: dict) -> dict:
|
||||
# building the site, while only allowing for our theme at the moment.
|
||||
version = os.environ.get("MIKE_DOCS_VERSION")
|
||||
if version and config.get("site_url"):
|
||||
mike = set_default(
|
||||
plugins,
|
||||
"mike",
|
||||
{
|
||||
"alias_type": "symlink",
|
||||
"redirect_template": None,
|
||||
"deploy_prefix": "",
|
||||
"canonical_version": None,
|
||||
},
|
||||
dict,
|
||||
)
|
||||
mike = set_default(plugins, "mike", {}, dict)
|
||||
set_default(mike, "alias_type", "symlink", str)
|
||||
set_default(mike, "redirect_template", None)
|
||||
set_default(mike, "deploy_prefix", "", str)
|
||||
set_default(mike, "canonical_version", None)
|
||||
|
||||
# Copied and adapted from mike's plugin implementation
|
||||
if mike["canonical_version"] is not None:
|
||||
|
||||
Reference in New Issue
Block a user