diff --git a/src/confdoc/parsers/toml_parser.py b/src/confdoc/parsers/toml_parser.py new file mode 100644 index 0000000..124096a --- /dev/null +++ b/src/confdoc/parsers/toml_parser.py @@ -0,0 +1,18 @@ +import tomlkit +from typing import Any, Dict + + +class TomlParser: + """Parser for TOML configuration files.""" + + def parse(self, content: str) -> Dict[str, Any]: + """Parse TOML content into a dictionary.""" + return tomlkit.parse(content) + + def dump(self, data: Dict[str, Any]) -> str: + """Dump dictionary to TOML string.""" + return tomlkit.dumps(data) + + def get_format(self) -> str: + """Return the format name.""" + return "toml"