equal
deleted
inserted
replaced
130 def compiletemplate(tmpl, context): |
130 def compiletemplate(tmpl, context): |
131 parsed = [] |
131 parsed = [] |
132 pos, stop = 0, len(tmpl) |
132 pos, stop = 0, len(tmpl) |
133 p = parser.parser(elements) |
133 p = parser.parser(elements) |
134 while pos < stop: |
134 while pos < stop: |
135 n = tmpl.find('{', pos) |
135 n = tmpl.find('{', pos, stop) |
136 if n < 0: |
136 if n < 0: |
137 parsed.append(('string', tmpl[pos:])) |
137 parsed.append(('string', tmpl[pos:stop])) |
|
138 pos = stop |
138 break |
139 break |
139 bs = (n - pos) - len(tmpl[pos:n].rstrip('\\')) |
140 bs = (n - pos) - len(tmpl[pos:n].rstrip('\\')) |
140 if bs % 2 == 1: |
141 if bs % 2 == 1: |
141 # escaped (e.g. '\{', '\\\{', but not '\\{') |
142 # escaped (e.g. '\{', '\\\{', but not '\\{') |
142 parsed.append(('string', (tmpl[pos:n - 1] + "{"))) |
143 parsed.append(('string', (tmpl[pos:n - 1] + "{"))) |