2012-11-21 40 views
0

我想創建這樣集錦上一個新片段:逃生斜線上的Aptana的Ruby代碼片段

snippet "dump em arquivo" do |s| 
    s.trigger = "debug" 
    s.scope = 'source.php' 
    s.expansion = "//debug 
file_put_contents('${2:/var/d_tmp/debug.log}', print_r(${1}, true) . \"\\n\", ${3:LOCK_EX});" 
end 

...但在變量${2:/var/d_tmp/debug.log}/ (slash)作品作爲一個選項列表,backslashing它DOEN」噸工作或者(${2:\/var\/d_tmp\/debug.log})。

所以,我怎樣才能逃避斜線,使片斷實際工作,outputing整個字符串。 所需的輸出應該是這樣的:

//debug 
file_put_contents('/var/d_tmp/debug.log', print_r(, true) . "\n", LOCK_EX); 

回答

0

通過another question找到答案。

如示例app accelerator wiki轉義與two backslashes完成。

snippet "dump em arquivo" do |s| 
    s.trigger = "debug" 
    s.scope = 'source.php' 
    s.expansion = "//debug 
file_put_contents('${2:\\/var\\/d_tmp\\/debug.log}', print_r(${1}, true) . \"\\n\", ${3:LOCK_EX});" 
end