81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
# File 'lib/cmds/util.rb', line 81
def self.replace_shortcuts template
template
.gsub(
/(?<=\A|\=|[[:space:]])\%s(?=\Z|[[:space:]])/,
'<%= arg %>'
)
.gsub(
/(?<=\A|[[:space:]])(\%+)\%s(?=\Z|[[:space:]])/,
'\1s'
)
.gsub(
/(?<=\A|\=|[[:space:]])\%\{([a-zA-Z_]+\??)\}(?=\Z|[[:space:]])/,
'<%= \1 %>'
)
.gsub(
/(?<=\A|[[:space:]])(\%+)\%\{([a-zA-Z_]+\??)\}(?=\Z|[[:space:]])/,
'\1{\2}\3'
)
.gsub(
/(?<=\A|\=|[[:space:]])\%\<([a-zA-Z_]+\??)\>s(?=\Z|[[:space:]])/,
'<%= \1 %>'
)
.gsub(
/(?<=\A|[[:space:]])(\%+)\%\<([a-zA-Z_]+\??)\>s(?=\Z|[[:space:]])/,
'\1<\2>s'
)
end
|