mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-15 01:24:29 +02:00
update multi-line value behavior
This commit is contained in:
@ -1,7 +1,10 @@
|
|||||||
"""jc - JSON Convert INI with duplicate key file parser
|
"""jc - JSON Convert INI with duplicate key file parser
|
||||||
|
|
||||||
Parses standard INI files and preserves duplicate values. All values are
|
Parses standard INI files and preserves duplicate values. All values are
|
||||||
contained in lists/arrays. Multi-line values are not supported.
|
contained in lists/arrays.
|
||||||
|
|
||||||
|
If multi-line values are used, each line will be a separate item in the
|
||||||
|
value list. Blank lines in multi-line values are not supported.
|
||||||
|
|
||||||
- Delimiter can be `=` or `:`. Missing values are supported.
|
- Delimiter can be `=` or `:`. Missing values are supported.
|
||||||
- Comment prefix can be `#` or `;`. Comments must be on their own line.
|
- Comment prefix can be `#` or `;`. Comments must be on their own line.
|
||||||
@ -184,9 +187,6 @@ def parse(data, raw=False, quiet=False):
|
|||||||
|
|
||||||
if jc.utils.has_data(data):
|
if jc.utils.has_data(data):
|
||||||
|
|
||||||
# clean the data by removing blank lines and stripping leading whitespace
|
|
||||||
data = '\n'.join([x.lstrip() for x in data.splitlines() if x])
|
|
||||||
|
|
||||||
ini_parser = configparser.ConfigParser(
|
ini_parser = configparser.ConfigParser(
|
||||||
dict_type = MultiDict,
|
dict_type = MultiDict,
|
||||||
allow_no_value=True,
|
allow_no_value=True,
|
||||||
|
Reference in New Issue
Block a user