without-rails 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +17 -17
- data/Gemfile +4 -4
- data/LICENSE.txt +22 -22
- data/README.md +5 -5
- data/Rakefile +1 -1
- data/lib/without/rails.rb +8 -8
- data/lib/without/rails/version.rb +5 -5
- data/vendor/assets/javascripts/without.js +356 -284
- data/without-rails.gemspec +23 -23
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 548e210d7d606296b9208b792bae9ce3614c8b0b
|
4
|
+
data.tar.gz: 32c94376ce3ad66a491d0605f8c2fcafaa069b99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 828a49e20c7afc8d4e53860b68254a3f456f2f79bd49daa81274bdfaa51ab55f44fa97f4a049608e61adab15b36fec8348becdd869d95b3d7c2fa8a5ac6dd532
|
7
|
+
data.tar.gz: 14ce67f2979e5c55dd2596defd1f72333e79edc9501b64b4a1e389b06b92ea5037bb2013a20c6251f5a9577a9baa303dabae18e1fd96ac25c15873b2eb1b96f0
|
data/.gitignore
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
.bundle
|
4
|
-
.config
|
5
|
-
.yardoc
|
6
|
-
Gemfile.lock
|
7
|
-
InstalledFiles
|
8
|
-
_yardoc
|
9
|
-
coverage
|
10
|
-
doc/
|
11
|
-
lib/bundler/man
|
12
|
-
pkg
|
13
|
-
rdoc
|
14
|
-
spec/reports
|
15
|
-
test/tmp
|
16
|
-
test/version_tmp
|
17
|
-
tmp
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in without-rails.gemspec
|
4
|
-
gemspec
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in without-rails.gemspec
|
4
|
+
gemspec
|
data/LICENSE.txt
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
Copyright (c) 2014 Stas Ukolov
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1
|
+
Copyright (c) 2014 Stas Ukolov
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
without-rails wraps [withOut](https://github.com/ukoloff/without)
|
6
6
|
template engine for simple use with rails asset pipeline.
|
7
|
-
The gem includes the development (non-minified) source
|
7
|
+
The gem includes the development (non-minified) source
|
8
8
|
for ease of exploration.
|
9
9
|
The asset pipeline will minify in production.
|
10
10
|
|
@@ -24,7 +24,7 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
## Usage
|
26
26
|
|
27
|
-
Add the following directive to your Javascript manifest file
|
27
|
+
Add the following directive to your Javascript manifest file
|
28
28
|
(application.js):
|
29
29
|
|
30
30
|
|
@@ -42,9 +42,9 @@ or to some .coffee file:
|
|
42
42
|
Later, inside any .coffee you can:
|
43
43
|
|
44
44
|
```coffee
|
45
|
-
t = withOut
|
46
|
-
|
45
|
+
t = withOut ->
|
46
|
+
h1 'Hello, ', @, '!'
|
47
47
|
|
48
|
-
$('#test').html t '
|
48
|
+
$('#test').html t 'world' # <h1>Hello, world!</h1>
|
49
49
|
|
50
50
|
```
|
data/Rakefile
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
1
|
+
require "bundler/gem_tasks"
|
data/lib/without/rails.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require "without/rails/version"
|
2
|
-
|
3
|
-
module Without
|
4
|
-
module Rails
|
5
|
-
class Engine < ::Rails::Engine
|
6
|
-
end
|
7
|
-
end
|
8
|
-
end
|
1
|
+
require "without/rails/version"
|
2
|
+
|
3
|
+
module Without
|
4
|
+
module Rails
|
5
|
+
class Engine < ::Rails::Engine
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
module Without
|
2
|
-
module Rails
|
3
|
-
VERSION = "1.
|
4
|
-
end
|
5
|
-
end
|
1
|
+
module Without
|
2
|
+
module Rails
|
3
|
+
VERSION = "1.2.0"
|
4
|
+
end
|
5
|
+
end
|
@@ -1,284 +1,356 @@
|
|
1
|
-
//
|
2
|
-
// without.js
|
3
|
-
//
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
i
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
function
|
54
|
-
{
|
55
|
-
return
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
}
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
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
|
-
|
114
|
-
|
115
|
-
|
116
|
-
}
|
117
|
-
|
118
|
-
{
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
function
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
1
|
+
//
|
2
|
+
// without.js v1.2.0: Yet another CoffeScript template (without `with`, coffescript and templates)
|
3
|
+
// https://github.com/ukoloff/without
|
4
|
+
//
|
5
|
+
!function(){
|
6
|
+
function adhocTag()
|
7
|
+
{
|
8
|
+
return function(name, empty) { return tag(name, empty) }
|
9
|
+
function isEmpty(name)
|
10
|
+
{
|
11
|
+
for(var i = eTags.length - 1; i >= 0; i--)
|
12
|
+
if(name == eTags[i])
|
13
|
+
return true
|
14
|
+
}
|
15
|
+
function tag(name, empty)
|
16
|
+
{
|
17
|
+
if(null==empty)
|
18
|
+
empty = isEmpty(String(name).toLowerCase())
|
19
|
+
return makeTag(name, empty)
|
20
|
+
}
|
21
|
+
}
|
22
|
+
function children(a)
|
23
|
+
{
|
24
|
+
var e, len = a.length
|
25
|
+
for(var i = 0; i < len; i++)
|
26
|
+
{
|
27
|
+
if(null == (e = a[i])) continue;
|
28
|
+
if('function' == typeof e)
|
29
|
+
e.call(_this)
|
30
|
+
else
|
31
|
+
html += h(e)
|
32
|
+
}
|
33
|
+
}
|
34
|
+
function coffeeScript(a)
|
35
|
+
{
|
36
|
+
if(1 != a.length || 'function' != typeof a[0])
|
37
|
+
throw SyntaxError('Usage: coffeescript -> code')
|
38
|
+
html += '<script><!--\n(' + a[0].toString() + ')()\n//-->\n</script>';
|
39
|
+
}
|
40
|
+
function makeComment()
|
41
|
+
{
|
42
|
+
var level = 0
|
43
|
+
return function() { comment(arguments) }
|
44
|
+
function comment(a)
|
45
|
+
{
|
46
|
+
html += level++ ? '<comment level="' + level + '">' : "<!-- "
|
47
|
+
children(a)
|
48
|
+
html += --level ? '</comment>' : ' -->'
|
49
|
+
}
|
50
|
+
}
|
51
|
+
function compile()
|
52
|
+
{
|
53
|
+
return function withOut(fn)
|
54
|
+
{
|
55
|
+
return compile(fn)
|
56
|
+
}
|
57
|
+
function compile(fn)
|
58
|
+
{
|
59
|
+
var withOut = renderable(fn, template)
|
60
|
+
return template
|
61
|
+
function template() { return withOut.apply(this, arguments) }
|
62
|
+
}
|
63
|
+
}
|
64
|
+
if('undefined' != typeof module && module.exports)
|
65
|
+
module.exports = withOut
|
66
|
+
else if('function' == typeof define && define.amd)
|
67
|
+
define(function() { return withOut })
|
68
|
+
else
|
69
|
+
this.withOut = withOut
|
70
|
+
withOut.$compile = withOut
|
71
|
+
withOut.compile =
|
72
|
+
withOut.renderable = compile()
|
73
|
+
withOut.JSTs = JSTs
|
74
|
+
function flatten(array)
|
75
|
+
{
|
76
|
+
var v, r = []
|
77
|
+
for(var i in array)
|
78
|
+
if('object' == typeof(v = array[i]))
|
79
|
+
r.push.apply(r, flatten(v))
|
80
|
+
else
|
81
|
+
r.push(v)
|
82
|
+
return r
|
83
|
+
}
|
84
|
+
var htmlEntities = {'&': '&', '<': '<', '>': '>', '"': '"'}
|
85
|
+
function h(s)
|
86
|
+
{
|
87
|
+
return String(s).replace(/[&<>"]/g, function(e) { return htmlEntities[e] })
|
88
|
+
}
|
89
|
+
function JSTs()
|
90
|
+
{
|
91
|
+
return JST$(arguments)
|
92
|
+
}
|
93
|
+
function JST$(a)
|
94
|
+
{
|
95
|
+
var Ts = flatten(slice.call(a))
|
96
|
+
template.id = null
|
97
|
+
return template
|
98
|
+
function template(that) { return JSTs.apply(that, arguments) }
|
99
|
+
function JSTs()
|
100
|
+
{
|
101
|
+
var S = ''
|
102
|
+
fetchJSTs()
|
103
|
+
for(var i = 0, len = Ts.length; i < len; i++)
|
104
|
+
S += Ts[i].apply(this, arguments)
|
105
|
+
return S
|
106
|
+
}
|
107
|
+
function fetchJSTs()
|
108
|
+
{
|
109
|
+
var v, id = template.id
|
110
|
+
for(var i = Ts.length - 1; i >= 0; i--)
|
111
|
+
{
|
112
|
+
if('function' != typeof(v = Ts[i]) &&
|
113
|
+
'function' != typeof(v = JST[v]))
|
114
|
+
throw Error("JST['" + Ts[i] + "'] not found or incorrect!")
|
115
|
+
Ts[i] = renderable(v, template, i + 1)
|
116
|
+
}
|
117
|
+
template.id = id
|
118
|
+
fetchJSTs = function() {}
|
119
|
+
}
|
120
|
+
}
|
121
|
+
function filterLocals(locals)
|
122
|
+
{
|
123
|
+
if('function' == typeof locals)
|
124
|
+
locals = locals()
|
125
|
+
if('object' != typeof locals)
|
126
|
+
return
|
127
|
+
var res
|
128
|
+
for(var k in locals)
|
129
|
+
{
|
130
|
+
if(!/^[$\w]+$/.test(k))
|
131
|
+
throw SyntaxError("Invalid identifier: " + k)
|
132
|
+
if(!res)
|
133
|
+
res = {}
|
134
|
+
var v = locals[k]
|
135
|
+
res[k] = 'string'==typeof v && /^<(\/?)>$/.test(v) ?
|
136
|
+
makeTag(k, !!RegExp.$1)
|
137
|
+
:
|
138
|
+
v
|
139
|
+
}
|
140
|
+
return res
|
141
|
+
}
|
142
|
+
function withOut(fn)
|
143
|
+
{
|
144
|
+
return $compile(fn)
|
145
|
+
}
|
146
|
+
function $compile(fn)
|
147
|
+
{
|
148
|
+
var withOut = renderable(fn, template)
|
149
|
+
return template
|
150
|
+
function template(that) { return withOut.apply(that, arguments) }
|
151
|
+
}
|
152
|
+
function makeTag(name, empty)
|
153
|
+
{
|
154
|
+
return function() { tag(arguments) }
|
155
|
+
function attr(k, v)
|
156
|
+
{
|
157
|
+
if(null == v || false === v) return
|
158
|
+
html += ' ' + h(k)
|
159
|
+
if(true !== v)
|
160
|
+
html += '="' + h(v) + '"'
|
161
|
+
}
|
162
|
+
function nest(prefix, obj)
|
163
|
+
{
|
164
|
+
for(var k in obj)
|
165
|
+
if('object' == typeof obj[k])
|
166
|
+
nest(prefix + k + '-', obj[k])
|
167
|
+
else
|
168
|
+
attr(prefix + k, obj[k])
|
169
|
+
}
|
170
|
+
function tag(a)
|
171
|
+
{
|
172
|
+
html += '<' + name
|
173
|
+
var at = a[0]
|
174
|
+
if('object' == typeof at)
|
175
|
+
{
|
176
|
+
for(var k in at)
|
177
|
+
if('data' == k && 'object' == typeof at[k])
|
178
|
+
nest('data-', at[k])
|
179
|
+
else
|
180
|
+
attr(k, at[k])
|
181
|
+
a = shift(a)
|
182
|
+
}
|
183
|
+
html += '>'
|
184
|
+
if(empty && a.length)
|
185
|
+
throw SyntaxError("<" + name + "> must have no content!")
|
186
|
+
if(empty)
|
187
|
+
return
|
188
|
+
children(a)
|
189
|
+
html += "</" + name + ">"
|
190
|
+
}
|
191
|
+
}
|
192
|
+
function merge()
|
193
|
+
{
|
194
|
+
var res, dup, len = arguments.length
|
195
|
+
for(var i = 0; i < len; i++)
|
196
|
+
{
|
197
|
+
var rec = arguments[i]
|
198
|
+
if('object' != typeof rec)
|
199
|
+
continue
|
200
|
+
if(!res)
|
201
|
+
{
|
202
|
+
res = rec
|
203
|
+
continue;
|
204
|
+
}
|
205
|
+
if(!dup)
|
206
|
+
{
|
207
|
+
dup = {}
|
208
|
+
for(var k in res)
|
209
|
+
dup[k] = res[k]
|
210
|
+
res = dup
|
211
|
+
dup = 1
|
212
|
+
}
|
213
|
+
for(var k in rec)
|
214
|
+
res[k] = rec[k]
|
215
|
+
}
|
216
|
+
return res
|
217
|
+
}
|
218
|
+
function noTag(a)
|
219
|
+
{
|
220
|
+
children('object' == typeof a[0] ? shift(a) : a)
|
221
|
+
}
|
222
|
+
function print(a)
|
223
|
+
{
|
224
|
+
var e, len = a.length
|
225
|
+
for(var i = 0; i < len; i++)
|
226
|
+
if(null != (e = a[i]))
|
227
|
+
html += h(e)
|
228
|
+
}
|
229
|
+
function raw(a)
|
230
|
+
{
|
231
|
+
var e, len = a.length
|
232
|
+
for(var i = 0; i < len; i++)
|
233
|
+
if(null != (e = a[i]))
|
234
|
+
html += e
|
235
|
+
}
|
236
|
+
var
|
237
|
+
names = 0,
|
238
|
+
html,
|
239
|
+
_this
|
240
|
+
function renderable(fn, template, n)
|
241
|
+
{
|
242
|
+
if('function' != typeof fn)
|
243
|
+
throw TypeError("Call: withOut(function)")
|
244
|
+
var minified
|
245
|
+
template.id = null
|
246
|
+
return render
|
247
|
+
function render()
|
248
|
+
{
|
249
|
+
build()
|
250
|
+
try
|
251
|
+
{
|
252
|
+
var that = _this, x = html
|
253
|
+
_this = this
|
254
|
+
html = ''
|
255
|
+
if(bp())
|
256
|
+
debugger // Hit `Step Into` (F11) twice
|
257
|
+
fn.apply(this, arguments)
|
258
|
+
return html
|
259
|
+
}
|
260
|
+
finally
|
261
|
+
{
|
262
|
+
_this = that
|
263
|
+
html = x
|
264
|
+
}
|
265
|
+
}
|
266
|
+
function getName()
|
267
|
+
{
|
268
|
+
var name = template.id
|
269
|
+
if(null == name)
|
270
|
+
name = ''
|
271
|
+
name = String(name).split(/\W+/).join('/').replace(/^\/+|\/+$/g, '')
|
272
|
+
if(!name.length)
|
273
|
+
name = ++names
|
274
|
+
template.id = name
|
275
|
+
if(n)
|
276
|
+
name += '[' + n + ']'
|
277
|
+
return name
|
278
|
+
}
|
279
|
+
function build()
|
280
|
+
{
|
281
|
+
var name, code = fn.toString()
|
282
|
+
minified = !/[\r\n]/.test(code)
|
283
|
+
makeScope()
|
284
|
+
var myScope = merge(scope, filterLocals(withOut.$), filterLocals(template.$))
|
285
|
+
code = makeVars(myScope) + '\nreturn ' + code
|
286
|
+
if(!minified)
|
287
|
+
code += '\n//# sourceURL=eval://withOut/' + (name = getName()) + '.wo'
|
288
|
+
fn = (new Function(code)).call(myScope)
|
289
|
+
build = function() {}
|
290
|
+
if(minified)
|
291
|
+
return
|
292
|
+
fn.displayName = '<' + name + '>'
|
293
|
+
template.displayName = '{{' + name + '}}'
|
294
|
+
}
|
295
|
+
function bp()
|
296
|
+
{
|
297
|
+
if(minified || false === withOut.bp)
|
298
|
+
return
|
299
|
+
if(withOut.bp)
|
300
|
+
return true
|
301
|
+
if(n && 'number' == typeof template.bp)
|
302
|
+
return n == template.bp
|
303
|
+
return template.bp
|
304
|
+
}
|
305
|
+
}
|
306
|
+
var scope
|
307
|
+
function makeScope()
|
308
|
+
{
|
309
|
+
makeScope = function() {}
|
310
|
+
scope = {
|
311
|
+
print: text,
|
312
|
+
text: text,
|
313
|
+
raw: function() { raw(arguments) },
|
314
|
+
notag: function() { noTag(arguments) },
|
315
|
+
coffeescript: function() { coffeeScript(arguments) },
|
316
|
+
blackhole: function() {},
|
317
|
+
comment: makeComment(),
|
318
|
+
tag: adhocTag(),
|
319
|
+
$var: makeTag('var')
|
320
|
+
}
|
321
|
+
for(var i = nTags.length - 1; i >= 0; i--)
|
322
|
+
scope[nTags[i]] = makeTag(nTags[i])
|
323
|
+
for(var i = eTags.length - 1; i >= 0; i--)
|
324
|
+
scope[eTags[i]] = makeTag(eTags[i], true)
|
325
|
+
}
|
326
|
+
var slice = [].slice
|
327
|
+
function shift(a)
|
328
|
+
{
|
329
|
+
return slice.call(a, 1)
|
330
|
+
}
|
331
|
+
function split(s)
|
332
|
+
{
|
333
|
+
return s.split(' ')
|
334
|
+
}
|
335
|
+
var nTags = split('a abbr acronym address applet article aside audio ' +
|
336
|
+
'b bdo big blockquote body button canvas caption center cite code colgroup command ' +
|
337
|
+
'datalist dd del details dfn dir div dl dt em embed ' +
|
338
|
+
'fieldset figcaption figure font footer form frameset ' +
|
339
|
+
'h1 h2 h3 h4 h5 h6 head header hgroup html i iframe ins keygen kbd ' +
|
340
|
+
'label legend li map mark menu meter nav noframes noscript ' +
|
341
|
+
'object ol optgroup option output p pre progress q rp rt ruby ' +
|
342
|
+
's samp script section select small source span strike strong style sub summary sup ' +
|
343
|
+
'table tbody td textarea tfoot th thead time title tr tt u ul video wbr xmp')
|
344
|
+
var eTags = split('area base basefont br col frame hr img input link meta param')
|
345
|
+
function text()
|
346
|
+
{
|
347
|
+
print(arguments)
|
348
|
+
}
|
349
|
+
function makeVars(scope)
|
350
|
+
{
|
351
|
+
var v = []
|
352
|
+
for(var tag in scope)
|
353
|
+
v.push(tag + '=this.' + tag)
|
354
|
+
return 'var ' + v.join(',')
|
355
|
+
}
|
356
|
+
}();
|
data/without-rails.gemspec
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'without/rails/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "without-rails"
|
8
|
-
spec.version = Without::Rails::VERSION
|
9
|
-
spec.authors = ["Stas Ukolov"]
|
10
|
-
spec.email = ["ukoloff@gmail.com"]
|
11
|
-
spec.description = "Use withOut with Rails"
|
12
|
-
spec.summary = "This gem provides withOut template engine for Rails application"
|
13
|
-
spec.homepage = "https://github.com/ukoloff/without-rails"
|
14
|
-
spec.license = "MIT"
|
15
|
-
|
16
|
-
spec.files = `git ls-files`.split($/)
|
17
|
-
spec.require_paths = ["lib"]
|
18
|
-
|
19
|
-
spec.add_dependency "railties"
|
20
|
-
|
21
|
-
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
-
spec.add_development_dependency "rake"
|
23
|
-
end
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'without/rails/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "without-rails"
|
8
|
+
spec.version = Without::Rails::VERSION
|
9
|
+
spec.authors = ["Stas Ukolov"]
|
10
|
+
spec.email = ["ukoloff@gmail.com"]
|
11
|
+
spec.description = "Use withOut with Rails"
|
12
|
+
spec.summary = "This gem provides withOut template engine for Rails application"
|
13
|
+
spec.homepage = "https://github.com/ukoloff/without-rails"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.require_paths = ["lib"]
|
18
|
+
|
19
|
+
spec.add_dependency "railties"
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
end
|
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: without-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stas Ukolov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-12-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.3'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: Use withOut with Rails
|
@@ -59,7 +59,7 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
-
- .gitignore
|
62
|
+
- ".gitignore"
|
63
63
|
- Gemfile
|
64
64
|
- LICENSE.txt
|
65
65
|
- README.md
|
@@ -78,17 +78,17 @@ require_paths:
|
|
78
78
|
- lib
|
79
79
|
required_ruby_version: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- -
|
81
|
+
- - ">="
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0'
|
84
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
|
-
- -
|
86
|
+
- - ">="
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0'
|
89
89
|
requirements: []
|
90
90
|
rubyforge_project:
|
91
|
-
rubygems_version: 2.
|
91
|
+
rubygems_version: 2.6.7
|
92
92
|
signing_key:
|
93
93
|
specification_version: 4
|
94
94
|
summary: This gem provides withOut template engine for Rails application
|