blank line after the last key?

Help
2005-07-01
2013-04-22
  • Wilson Chan

    Wilson Chan - 2005-07-01

    well, here is my ini:

    [sectionA]
    key1=value1
    key2=value2

    [sectionB]
    someKey=someValue

    then I set a non-exist key to sectionA:
    config.set("key3", "value3")

    becomes:

    [sectionA]
    key1=value1
    key2=value2
    key3=value3
    [sectionB]
    someKey=someValue

    where is my blank line?

     
    • Wilson Chan

      Wilson Chan - 2005-07-01

      sorry, it becomes:

      [sectionA]
      key1=value1
      key2=value2

      key3=value3
      [sectionB]
      someKey=someValue

      but still, it is not so satisfactory, I want it like this:

      [sectionA]
      key1=value1
      key2=value2
      key3=value3

      [sectionB]
      someKey=someValue

      could it be done through Nini?

       
    • Brent R. Matzelle

      No, not at this time.  The parser preserves empty lines so if you add a new key it will naturally add your new key after the last empty line. 

      I'll admit that it can look a little ugly.  I suppose that with a future version to beautify the code that I could append new keys before empty lines rather than after. 

       
    • Wilson Chan

      Wilson Chan - 2005-07-02

      I think that it is not difficult to implement:)

       
    • tuxvix

      tuxvix - 2006-06-21

      I would like to see that too =)

       
    • Jason G, Dove

      Jason G, Dove - 2006-09-01

      It takes an additional 3 lines of code to make Nini work the way described above.

      Granted, all whitespace is ignored (except for a single line after every section), but if you want the separation that badly, I think it would make more sense to just make another section.

       
    • Tim J

      Tim J - 2008-12-03

      I am using Nini.dll in an application and have the same request.  Has anyone ever implemented this?  I know it is just for beautification purposes, but still it is desirable.

      Thank you for any help or insight on what I can modify to accomplish this.

      Thank you.

       

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks