cfgparser.3 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # INI with as many tricky parts as possible
  2. # Most of them could not be used before 3.2
  3. # This will be parsed with the following options
  4. # delimiters = {'='}
  5. # comment_prefixes = {'#'}
  6. # allow_no_value = True
  7. [DEFAULT]
  8. go = %(interpolate)s
  9. [strange]
  10. values = that are indented # and end with hash comments
  11. other = that do continue
  12. in # and still have
  13. other # comments mixed
  14. lines # with the values
  15. [corruption]
  16. value = that is
  17. actually still here
  18. and holds all these weird newlines
  19. # but not for the lines that are comments
  20. nor the indentation
  21. another value = # empty string
  22. yet another # None!
  23. [yeah, sections can be indented as well]
  24. and that does not mean = anything
  25. are they subsections = False
  26. if you want subsections = use XML
  27. lets use some Unicode = 片仮名
  28. [another one!]
  29. even if values are indented like this = seriously
  30. yes, this still applies to = section "another one!"
  31. this too = are there people with configurations broken as this?
  32. beware, this is going to be a continuation
  33. of the value for
  34. key "this too"
  35. even if it has a = character
  36. this is still the continuation
  37. your editor probably highlights it wrong
  38. but that's life
  39. # let's set this value so there is no error
  40. # when getting all items for this section:
  41. interpolate = anything will do
  42. [no values here]
  43. # but there's this `go` in DEFAULT
  44. [tricky interpolation]
  45. interpolate = do this
  46. lets = %(go)s
  47. [more interpolation]
  48. interpolate = go shopping
  49. lets = %(go)s