• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythongamewindowsbathyscaphephpguic翻訳omegattwitterframeworktestbtronarduinovb.net計画中(planning stage)directxpreviewerゲームエンジンdom

generic text markup tools


Commit MetaInfo

修订版12787b7a4fbdeb056e8f815b1edc8bda2cee65ed (tree)
时间2014-02-06 19:55:41
作者hylom <hylom@hylo...>
Commiterhylom

Log Message

fix _expand_variable()

更改概述

差异

--- a/textparser.py
+++ b/textparser.py
@@ -266,15 +266,12 @@ class Parser(object):
266266 text = rex.sub(match_func, text)
267267
268268 # expand vars
269- rex = re.compile('\${?([A-Za-z0-9_]+)}?')
269+ rex = re.compile('(\${?[A-Za-z0-9_]+}?)')
270270 m = rex.search(text)
271271 if m:
272272 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))
278275 text = rex.sub(sub_func, text)
279276 return text
280277