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