mirror of
https://github.com/zensical/zensical.git
synced 2026-05-06 02:50:34 +00:00
feature: update configuration parser to TOML v1.1.0
Signed-off-by: squidfunk <martin.donath@squidfunk.com>
This commit is contained in:
@@ -26,6 +26,7 @@ from __future__ import annotations
|
||||
import hashlib
|
||||
import importlib
|
||||
import os
|
||||
from tomli import load as toml_load
|
||||
import pickle
|
||||
from importlib.util import find_spec
|
||||
from pathlib import Path
|
||||
@@ -42,11 +43,6 @@ from zensical.compat.autorefs import get_autorefs_extension
|
||||
from zensical.compat.mkdocstrings import get_mkdocstrings_extension
|
||||
from zensical.extensions.emoji import to_svg, twemoji
|
||||
|
||||
try:
|
||||
import tomllib
|
||||
except ModuleNotFoundError:
|
||||
import tomli as tomllib # type: ignore[no-redef]
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Iterator
|
||||
|
||||
@@ -92,7 +88,7 @@ def parse_zensical_config(path: str) -> dict:
|
||||
"""Parse zensical.toml configuration file."""
|
||||
global _CONFIG # noqa: PLW0603
|
||||
with open(path, "rb") as f:
|
||||
config = tomllib.load(f)
|
||||
config = toml_load(f)
|
||||
if "project" in config:
|
||||
config = config["project"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user