slim 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +57 -30
- data/bin/{slim → slimrb} +0 -0
- data/lib/slim.rb +1 -0
- data/lib/slim/validator.rb +16 -0
- data/lib/slim/version.rb +1 -1
- metadata +6 -5
data/README.md
CHANGED
@@ -9,9 +9,9 @@ Slim is a fast, lightweight templating engine with support for __Rails 3__. It h
|
|
9
9
|
|
10
10
|
Slim's core syntax is guided by one thought: "What's the minimum required to make this work".
|
11
11
|
|
12
|
-
As more people have contributed to Slim, there have been ___optional___ syntax additions influenced from their use of [Haml](
|
12
|
+
As more people have contributed to Slim, there have been ___optional___ syntax additions influenced from their use of [Haml](https://github.com/nex3/haml) and [Jade](https://github.com/visionmedia/jade). The Slim team is open to these optional additions because we know beauty is in the eye of the beholder.
|
13
13
|
|
14
|
-
Slim uses [Temple](
|
14
|
+
Slim uses [Temple](https://github.com/judofyr/temple) for parsing/compilation and is also integrated into [Tilt](https://github.com/rtomayko/tilt), so it can be used together with [Sinatra](https://github.com/sinatra/sinatra) or plain [Rack](https://github.com/rack/rack).
|
15
15
|
|
16
16
|
## Why?
|
17
17
|
|
@@ -41,7 +41,11 @@ If you want to use the Slim template directly, you can use the Tilt interface:
|
|
41
41
|
|
42
42
|
## Syntax Highlighters
|
43
43
|
|
44
|
-
Syntax highlight support for __Vim__ (very beta) and __Emacs__ are included in the `extra` folder. There is also a [Textmate bundle](
|
44
|
+
Syntax highlight support for __Vim__ (very beta) and __Emacs__ are included in the `extra` folder. There is also a [Textmate bundle](https://github.com/fredwu/ruby-slim-textmate-bundle).
|
45
|
+
|
46
|
+
## Template Converters
|
47
|
+
|
48
|
+
For Haml, there is a [Haml2Slim converter](https://github.com/fredwu/haml2slim). Please check out the [issue tracker](https://github.com/stonean/slim/issues) to see the status of the varies converters.
|
45
49
|
|
46
50
|
## The syntax
|
47
51
|
|
@@ -262,35 +266,58 @@ Here's a quick example to demonstrate what a Slim template looks like:
|
|
262
266
|
|
263
267
|
<body><p></p></body>
|
264
268
|
|
269
|
+
### Validate Slim syntax
|
270
|
+
|
271
|
+
There are two helpers you could use to validate your Slim syntax:
|
272
|
+
|
273
|
+
Slim::Validator.valid?(source) # -> true or false
|
274
|
+
Slim::Validator.validate!(source) # -> true or exception
|
275
|
+
|
265
276
|
## Benchmarks
|
266
277
|
|
267
|
-
# OS X 10.6 + Ruby 1.9.2
|
268
|
-
|
269
|
-
|
270
|
-
erb
|
271
|
-
erubis
|
272
|
-
fast erubis
|
273
|
-
slim
|
274
|
-
haml
|
275
|
-
haml ugly
|
276
|
-
|
277
|
-
|
278
|
-
fast erubis
|
279
|
-
|
280
|
-
|
281
|
-
haml ugly
|
282
|
-
|
283
|
-
|
284
|
-
fast erubis
|
285
|
-
|
286
|
-
|
287
|
-
haml ugly
|
278
|
+
# OS X 10.6 + Ruby 1.9.2, 1000 iterations
|
279
|
+
|
280
|
+
user system total real
|
281
|
+
(1) erb 0.420000 0.000000 0.420000 ( 0.429334)
|
282
|
+
(1) erubis 0.350000 0.000000 0.350000 ( 0.356078)
|
283
|
+
(1) fast erubis 0.350000 0.000000 0.350000 ( 0.355976)
|
284
|
+
(1) slim 3.300000 0.010000 3.310000 ( 3.340637)
|
285
|
+
(1) haml 2.950000 0.000000 2.950000 ( 2.970671)
|
286
|
+
(1) haml ugly 2.840000 0.010000 2.850000 ( 2.856405)
|
287
|
+
(2) erb 0.150000 0.000000 0.150000 ( 0.151098)
|
288
|
+
(2) erubis 0.130000 0.000000 0.130000 ( 0.130713)
|
289
|
+
(2) fast erubis 0.100000 0.000000 0.100000 ( 0.112199)
|
290
|
+
(2) slim 0.030000 0.000000 0.030000 ( 0.027752)
|
291
|
+
(2) haml 0.320000 0.000000 0.320000 ( 0.332581)
|
292
|
+
(2) haml ugly 0.280000 0.000000 0.280000 ( 0.305250)
|
293
|
+
(3) erb 0.010000 0.000000 0.010000 ( 0.014402)
|
294
|
+
(3) erubis 0.010000 0.000000 0.010000 ( 0.015365)
|
295
|
+
(3) fast erubis 0.010000 0.000000 0.010000 ( 0.012789)
|
296
|
+
(3) slim 0.010000 0.000000 0.010000 ( 0.015583)
|
297
|
+
(3) haml 0.120000 0.000000 0.120000 ( 0.120017)
|
298
|
+
(3) haml ugly 0.100000 0.010000 0.110000 ( 0.117665)
|
299
|
+
|
300
|
+
1. Uncached benchmark. Template is parsed every time.
|
301
|
+
Activate this benchmark with slow=1.
|
302
|
+
|
303
|
+
2. Cached benchmark. Template is parsed before the benchmark.
|
304
|
+
The ruby code generated by the template engine might be evaluated every time.
|
305
|
+
This benchmark uses the standard API of the template engine.
|
306
|
+
|
307
|
+
3. Compiled benchmark. Template is parsed before the benchmark and
|
308
|
+
generated ruby code is compiled into a method.
|
309
|
+
This is the fastest evaluation strategy because it benchmarks
|
310
|
+
pure execution speed of the generated ruby code.
|
311
|
+
|
312
|
+
## License
|
313
|
+
|
314
|
+
This project is released under the MIT license.
|
288
315
|
|
289
316
|
## Authors
|
290
317
|
|
291
|
-
* [Andrew Stone](
|
292
|
-
* [Fred Wu](
|
293
|
-
* [Daniel Mendler](
|
318
|
+
* [Andrew Stone](https://github.com/stonean)
|
319
|
+
* [Fred Wu](https://github.com/fredwu)
|
320
|
+
* [Daniel Mendler](https://github.com/minad)
|
294
321
|
|
295
322
|
## Discuss
|
296
323
|
|
@@ -298,6 +325,6 @@ Here's a quick example to demonstrate what a Slim template looks like:
|
|
298
325
|
|
299
326
|
## Slim related projects
|
300
327
|
|
301
|
-
* [Textmate bundle](
|
302
|
-
* [Rails 3 Generators](
|
303
|
-
* [Slim for Clojure](
|
328
|
+
* [Textmate bundle](https://github.com/fredwu/ruby-slim-textmate-bundle)
|
329
|
+
* [Rails 3 Generators](https://github.com/leogalmeida/slim-rails)
|
330
|
+
* [Slim for Clojure](https://github.com/chaslemley/slim.clj)
|
data/bin/{slim → slimrb}
RENAMED
File without changes
|
data/lib/slim.rb
CHANGED
data/lib/slim/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 8
|
8
|
-
-
|
9
|
-
version: 0.8.
|
8
|
+
- 1
|
9
|
+
version: 0.8.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Andrew Stone
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-
|
19
|
+
date: 2010-12-17 00:00:00 +11:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -147,14 +147,14 @@ email:
|
|
147
147
|
- ifredwu@gmail.com
|
148
148
|
- mail@daniel-mendler.de
|
149
149
|
executables:
|
150
|
-
-
|
150
|
+
- slimrb
|
151
151
|
extensions: []
|
152
152
|
|
153
153
|
extra_rdoc_files:
|
154
154
|
- README.md
|
155
155
|
files:
|
156
156
|
- README.md
|
157
|
-
- bin/
|
157
|
+
- bin/slimrb
|
158
158
|
- lib/slim.rb
|
159
159
|
- lib/slim/command.rb
|
160
160
|
- lib/slim/compiler.rb
|
@@ -167,6 +167,7 @@ files:
|
|
167
167
|
- lib/slim/rails.rb
|
168
168
|
- lib/slim/sections.rb
|
169
169
|
- lib/slim/template.rb
|
170
|
+
- lib/slim/validator.rb
|
170
171
|
- lib/slim/version.rb
|
171
172
|
- lib/slim/wrapper.rb
|
172
173
|
has_rdoc: true
|