QEDK / configparser-rs

A simple configuration parsing utility with no dependencies built on Rust.
https://crates.io/crates/configparser
Other
66 stars 21 forks source link

Preserve blank lines within multiline values #48

Closed charliermarsh closed 7 months ago

charliermarsh commented 7 months ago

Summary

Given an INI file like:

[externally-managed]
Error=To install Python packages system-wide, try brew install
 xyz, where xyz is the package you are trying to
 install.

 If you wish to install a non-brew-packaged Python package,
 create a virtual environment using python3 -m venv path/to/venv.
 Then use path/to/venv/bin/python and path/to/venv/bin/pip.

 If you wish to install a non-brew packaged Python application,
 it may be easiest to use pipx install xyz, which will manage a
 virtual environment for you. Make sure you have pipx installed.

Python's configparser preserves the empty lines within the multiline value, while the configparser crate drops them.

This PR adds support for preserving those blank lines based on following the Python configparser rules, so...

QEDK commented 7 months ago

Good catch btw @charliermarsh also love the great work with Ruff. 🖖

charliermarsh commented 7 months ago

Thanks so much @QEDK! Glad I could find a moment to contribute here.