without-rails 1.1.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c24173f96a4b0d9ecd4752ca9de7e00d069a9653
4
- data.tar.gz: cadc500c6ffb812a8e0f44eb1deb722f8f305bc4
3
+ metadata.gz: 548e210d7d606296b9208b792bae9ce3614c8b0b
4
+ data.tar.gz: 32c94376ce3ad66a491d0605f8c2fcafaa069b99
5
5
  SHA512:
6
- metadata.gz: a164f554188e59b5b7b3e42d9dd680dce597a3650a3c899d6f81c3cbae30300be683e5cb5d751b3a3fa384d816fa54bffddb2a6ada3ceccb015cbf9ed27a62e1
7
- data.tar.gz: ae1dc3437e149bb7f1129276e6d007bf4bdcd46854b80118b957f053fd15cbae248bad67a04d5584a9da748e91812c815b024fb8e585f864850373262b06a075
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
@@ -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.$compile ->
46
- div id: @
45
+ t = withOut ->
46
+ h1 'Hello, ', @, '!'
47
47
 
48
- $('#test').html t 'me'
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"
@@ -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.1.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 - CoffeScript template engine with lexical scoping
3
- //
4
-
5
- (function()
6
- {
7
- var
8
- nTags='a abbr acronym address applet article aside audio b bdo big blockquote body button \
9
- canvas caption center cite code colgroup command datalist dd del details dfn dir div dl dt \
10
- em embed fieldset figcaption figure font footer form frameset h1 h2 h3 h4 h5 h6 head header hgroup html \
11
- i iframe ins keygen kbd label legend li map mark menu meter nav noframes noscript object \
12
- ol optgroup option output p pre progress q rp rt ruby \
13
- s samp script section select small source span strike strong style sub summary sup \
14
- table tbody td textarea tfoot th thead time title tr tt u ul video wbr xmp'.split(' '),
15
- eTags='area base basefont br col frame hr img input link meta param'.split(' '),
16
- htmlEntities={'&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;'},
17
- slice=[].slice,
18
- scope={},
19
- names=0,
20
- html='',
21
- _this
22
-
23
- function h(s)
24
- {
25
- return String(s).replace(/[&<>"]/g, function(e){return htmlEntities[e]})
26
- }
27
-
28
- function children(a)
29
- {
30
- var i, e
31
- for(i=0; i<a.length; i++)
32
- {
33
- if(null==(e=a[i])) continue;
34
- if('function'==typeof e)
35
- e.call(_this)
36
- else
37
- html+=h(e)
38
- }
39
- }
40
-
41
- function print(a)
42
- {
43
- var i, e
44
- for(i=0; i<a.length; i++) if(null!=(e=a[i])) html+=h(e)
45
- }
46
-
47
- function raw(a)
48
- {
49
- var i, e
50
- for(i=0; i<a.length; i++) if(null!=(e=a[i])) html+=e
51
- }
52
-
53
- function makeTag(name, empty)
54
- {
55
- return function(){tag(arguments)}
56
- function attr(k, v)
57
- {
58
- if(null==v || false===v) return
59
- html+=' '+h(k)
60
- if(true!==v) html+='="'+h(v)+'"'
61
- }
62
- function nest(prefix, obj)
63
- {
64
- for(var k in obj)
65
- if('object'==typeof obj[k])
66
- nest(prefix+k+'-', obj[k])
67
- else
68
- attr(prefix+k, obj[k])
69
- }
70
- function tag(a)
71
- {
72
- html+='<'+name
73
- var at=a[0]
74
- if('object'==typeof at)
75
- {
76
- for(var k in at)
77
- if('data'==k && 'object'==typeof at[k])
78
- nest('data-', at[k])
79
- else
80
- attr(k, at[k])
81
- a=slice.call(a, 1)
82
- }
83
- html+='>'
84
- if(empty && a.length) throw new SyntaxError("<"+name+"> must have no content!")
85
- if(empty) return
86
- children(a)
87
- html+="</"+name+">"
88
- }
89
- }
90
-
91
- function makeComment()
92
- {
93
- var level=0;
94
- return function(){ comment.apply(this, arguments) }
95
- function comment()
96
- {
97
- html+= level++? '<comment level="'+level+'">' : "<!-- "
98
- children(arguments)
99
- html+= --level? '</comment>': ' -->'
100
- }
101
- }
102
-
103
- function coffeeScript()
104
- {
105
- if(1!=arguments.length ||'function'!=typeof arguments[0])
106
- throw new SyntaxError('Usage: coffeescript -> code')
107
- html+='<script><!--\n('+arguments[0].toString()+')()\n//-->\n</script>';
108
- }
109
-
110
- function adhocTag()
111
- {
112
- return function(name, empty){ return tag(name, empty) }
113
- function isEmpty(name)
114
- {
115
- for(var i in eTags) if(name==eTags[i]) return true
116
- }
117
- function tag(name, empty)
118
- {
119
- return makeTag(name, null==empty? isEmpty(String(name).toLowerCase()) : empty)
120
- }
121
- }
122
-
123
- function noTag(attrs)
124
- {
125
- children('object'==typeof attrs ? slice.call(arguments, 1) : arguments)
126
- }
127
-
128
- scope.print=scope.text=function(){print(arguments)}
129
- scope.raw=function(){raw(arguments)}
130
- scope.tag=adhocTag()
131
- scope.notag=function(){noTag.apply(this, arguments)}
132
- scope.comment=makeComment()
133
- scope.blackhole=function(){}
134
- scope.coffeescript=function(){ coffeeScript.apply(this, arguments) }
135
-
136
- for(var i in nTags) scope[nTags[i]]=makeTag(nTags[i])
137
- scope.$var=makeTag('var')
138
- for(var i in eTags) scope[eTags[i]]=makeTag(eTags[i], true)
139
-
140
- function makeVars()
141
- {
142
- var v=[];
143
- for(var tag in scope) v.push(tag+'=this.'+tag)
144
- return 'var '+v.join(',')
145
- }
146
-
147
- function renderable(fn, wrapper, n)
148
- {
149
- if('function'!=typeof fn)
150
- throw new TypeError("Call: withOut.compile(function)")
151
- var pending=true, minified
152
- wrapper.id=null
153
- return render
154
-
155
- function render()
156
- {
157
- if(pending) build()
158
- try
159
- {
160
- var that=_this, x=html
161
- _this=this
162
- html=''
163
- if(bp())
164
- debugger // Hit `Step Into` (F11) twice
165
- fn.apply(this, arguments)
166
- return html
167
- }
168
- finally
169
- {
170
- _this=that
171
- html=x
172
- }
173
- }
174
-
175
- function getName()
176
- {
177
- var name = wrapper.id
178
- if(null==name) name=''
179
- name=String(name).split(/\W+/).join('/').replace(/^\/+|\/+$/g, '')
180
- if(!name.length)name=++names
181
- wrapper.id=name
182
- if(n)
183
- name+='['+n+']'
184
- return name
185
- }
186
-
187
- function build()
188
- {
189
- var name
190
- fn=fn.toString()
191
- minified = !/[\r\n]/.test(fn)
192
- fn=makeVars()+'\nreturn '+fn
193
- if(!minified)
194
- fn+='\n//# sourceURL=eval://withOut/'+(name=getName())+'.wo'
195
- fn=(new Function(fn)).call(scope)
196
- if(!minified)
197
- {
198
- fn.displayName='<'+name+'>'
199
- wrapper.displayName='{{'+name+'}}'
200
- }
201
- }
202
-
203
- function bp()
204
- {
205
- if(minified || false===$compile.bp) return
206
- if($compile.bp) return true
207
- if(n && 'number'==typeof wrapper.bp)
208
- return n==wrapper.bp
209
- return wrapper.bp
210
- }
211
- }
212
-
213
- function compile(fn)
214
- {
215
- var withOut=renderable(fn, wrapper)
216
- return wrapper
217
-
218
- function wrapper(){return withOut.apply(this, arguments)}
219
- }
220
-
221
- function $compile(fn)
222
- {
223
- var withOut=renderable(fn, wrapper)
224
- return wrapper
225
-
226
- function wrapper(that){return withOut.apply(that, arguments)}
227
- }
228
-
229
- function flatten(array)
230
- {
231
- var v, r=[]
232
- for(var i in array)
233
- if('object'==typeof(v=array[i]))
234
- r.push.apply(r, flatten(v))
235
- else
236
- r.push(v)
237
- return r
238
- }
239
-
240
- function JSTs(path)
241
- {
242
- var bound, Ts=flatten(slice.call(arguments))
243
- wrapper.id=null
244
- return wrapper
245
-
246
- function wrapper(that){return JSTs.apply(that, arguments)}
247
-
248
- function JSTs()
249
- {
250
- var S=''
251
- if(!bound) fetchJSTs()
252
- for(var i in Ts) S+=Ts[i].apply(this, arguments)
253
- return S
254
- }
255
-
256
- function fetchJSTs()
257
- {
258
- var v, id=wrapper.id
259
- for(var i in Ts)
260
- {
261
- if('function'!=typeof(v=Ts[i]) &&
262
- 'function'!=typeof(v=JST[v]))
263
- throw new Error("JST['"+Ts[i]+"'] not found or incorrect!")
264
- Ts[i]=renderable(v, wrapper, Number(i)+1)
265
- }
266
- wrapper.id=id
267
- bound=true
268
- }
269
- }
270
-
271
- $compile.$compile = $compile
272
- $compile.compile = compile
273
- $compile.renderable = compile
274
- $compile.JSTs = JSTs
275
-
276
- if('undefined'!=typeof module && module.exports)
277
- module.exports=$compile
278
- else if('function'==typeof define && define.amd)
279
- define(function(){return $compile})
280
- else
281
- this.withOut=$compile
282
- })()
283
-
284
- //--[EOF]------------------------------------------------------------
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 = {'&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;'}
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
+ }();
@@ -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.1.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: 2014-10-16 00:00:00.000000000 Z
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.0.3
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