Changeset - 952a83c9e478
[Not reviewed]
default
0 1 0
Mads Kiilerich - 8 years ago 2017-09-14 02:08:06
mads@kiilerich.com
ini: be less strict about amount of whitespace around '=' in templates

Allow any amount of space/tab around '=' ... but no other whitespace on the
left hand side.
1 file changed with 3 insertions and 2 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/inifile.py
Show inline comments
 
@@ -61,7 +61,8 @@ def expand(template, desc, selected_mako
 
    [first-section]
 
    <BLANKLINE>
 
    variable=VALUE
 
    variable2  =    value after tab
 
    #variable2 = value after tab
 
    variable2 = VAL2
 
    ## This section had some whitespace and stuff
 
    <BLANKLINE>
 
    <BLANKLINE>
 
@@ -117,7 +118,7 @@ def expand(template, desc, selected_mako
 
                    if '$' not in value:
 
                        line = '#%s = %s\n%s' % (key, value, line)
 
                return line.rstrip()
 
            lines = re.sub(r'^([^#\n].*) = ?(.*)', process_line, lines, flags=re.MULTILINE)
 
            lines = re.sub(r'^([^#\n\s]*)[ \t]*=[ \t]*(.*)$', process_line, lines, flags=re.MULTILINE)
 
        return sectionname + '\n' + lines
 
    ini_lines = re.sub(r'^(\[.*\])\n((?:(?:[^[\n].*)?\n)*)', process_section, ini_lines, flags=re.MULTILINE)
 

	
0 comments (0 inline, 0 general)