Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve support for "subsections" #2

Open
tbeu opened this issue Nov 15, 2016 · 3 comments
Open

Improve support for "subsections" #2

tbeu opened this issue Nov 15, 2016 · 3 comments

Comments

@tbeu
Copy link
Contributor

tbeu commented Nov 15, 2016

If an INI file contains a "subsection", then in the INI_CALLBACK handler the section name is kind of unexpected. For example in the simple example

[section]
[[subsection]]
key = value

it is [subsection, thus it seems minIni looks for the first right bracket.

@tbeu tbeu changed the title Improve support for subsections Improve support for "subsections" Nov 15, 2016
@tbeu
Copy link
Contributor Author

tbeu commented Nov 15, 2016

A further enhancement would be if the INI_CALLBACK handler is first called with section set to section and key set to NULL, and in the subsequent call with section set to subsection and key set to key. This way the application would actually be notified about the section hierarchy.

@compuphase
Copy link
Owner

If you need subsections, consider this syntax:

[section]
key=abc
[section:subsection]
key=def

Etcetera. This convention can be used with the ini_putX() functions too.

@tbeu
Copy link
Contributor Author

tbeu commented Mar 7, 2017

The [[subsection]] syntax is used by Py Config which I have no chance to influence.

The simplest idea ist to check for the last closing bracket instead of the first one. What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants