generic text markup tools
Revisão | 12787b7a4fbdeb056e8f815b1edc8bda2cee65ed (tree) |
---|---|
Hora | 2014-02-06 19:55:41 |
Autor | hylom <hylom@hylo...> |
Commiter | hylom |
fix _expand_variable()
@@ -266,15 +266,12 @@ class Parser(object): | ||
266 | 266 | text = rex.sub(match_func, text) |
267 | 267 | |
268 | 268 | # expand vars |
269 | - rex = re.compile('\${?([A-Za-z0-9_]+)}?') | |
269 | + rex = re.compile('(\${?[A-Za-z0-9_]+}?)') | |
270 | 270 | m = rex.search(text) |
271 | 271 | if m: |
272 | 272 | def sub_func(x): |
273 | - val = self.store.load(x.group(1)) | |
274 | - if val != None: | |
275 | - return val | |
276 | - else: | |
277 | - return "$" + x.group(1) | |
273 | + key = re.sub(u"[${}]", "", x.group(1)) | |
274 | + return self.store.load(key, x.group(1)) | |
278 | 275 | text = rex.sub(sub_func, text) |
279 | 276 | return text |
280 | 277 |