hamlit 2.0.1 → 2.0.2
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 +4 -4
- data/.travis.yml +13 -2
- data/CHANGELOG.md +276 -136
- data/README.md +8 -8
- data/benchmark/dynamic_boolean_attribute.haml +4 -0
- data/benchmark/{string_interpolation.haml → etc/string_interpolation.haml} +0 -0
- data/bin/bench +1 -1
- data/lib/hamlit/{hash_parser.rb → attribute_parser.rb} +1 -1
- data/lib/hamlit/cli.rb +6 -2
- data/lib/hamlit/compiler/attribute_compiler.rb +2 -2
- data/lib/hamlit/compiler/tag_compiler.rb +1 -1
- data/lib/hamlit/version.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 658acdc2d3ba2e0c67b1b51e181b27fc9b3ede4f
|
4
|
+
data.tar.gz: 05cd64cef646b2af0252dff93f68594816385e62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92ed91af56b3e423dd3cd317826872dff66987ee46351cb769196d730943ee19d93a15e2e9c07999bb9fdff7aaf5e071732c11aafafaf54d0cb40e5804d2bffa
|
7
|
+
data.tar.gz: 2ad62fc2df52f1d42c459136e295d25e3f74718232d5369c972024fa40655f7537b3d8d41cc562145ad1db28d682a247b19c96e7cc53cf1b1dfa9e25b40fc285
|
data/.travis.yml
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
language: ruby
|
2
|
+
sudo: false
|
3
|
+
cache: bundler
|
2
4
|
branches:
|
3
5
|
only:
|
4
6
|
- master
|
@@ -12,19 +14,28 @@ matrix:
|
|
12
14
|
env: TASK=test
|
13
15
|
- rvm: 2.2
|
14
16
|
env: TASK=test
|
17
|
+
- rvm: 2.2
|
18
|
+
env: TASK=bench TEMPLATE=benchmark/dynamic_boolean_attribute.haml
|
15
19
|
- rvm: 2.2
|
16
20
|
env: TASK=bench TEMPLATE=benchmark/boolean_attribute.haml,benchmark/class_attribute.haml,benchmark/id_attribute.haml,benchmark/data_attribute.haml,benchmark/common_attribute.haml
|
17
21
|
- rvm: 2.2
|
18
22
|
env: TASK=bench TEMPLATE=benchmark/dynamic_attributes/boolean_attribute.haml,benchmark/dynamic_attributes/class_attribute.haml,benchmark/dynamic_attributes/id_attribute.haml,benchmark/dynamic_attributes/data_attribute.haml,benchmark/dynamic_attributes/common_attribute.haml
|
23
|
+
- rvm: 2.2
|
24
|
+
env: TASK=bench SLIM_BENCH=1
|
19
25
|
- rvm: 2.2
|
20
26
|
env: TASK=bench TEMPLATE=benchmark/etc/attribute_builder.haml
|
21
27
|
- rvm: 2.2
|
22
|
-
env: TASK=bench
|
28
|
+
env: TASK=bench TEMPLATE=benchmark/etc/static_analyzer.haml
|
29
|
+
- rvm: 2.2
|
30
|
+
env: TASK=bench TEMPLATE=benchmark/etc/string_interpolation.haml
|
23
31
|
- rvm: 2.2
|
24
32
|
env: TASK=bench TEMPLATE=test/haml/templates/standard.haml COMPILE=1
|
25
33
|
allow_failures:
|
34
|
+
- env: TASK=bench TEMPLATE=benchmark/dynamic_boolean_attribute.haml
|
26
35
|
- env: TASK=bench TEMPLATE=benchmark/boolean_attribute.haml,benchmark/class_attribute.haml,benchmark/id_attribute.haml,benchmark/data_attribute.haml,benchmark/common_attribute.haml
|
27
36
|
- env: TASK=bench TEMPLATE=benchmark/dynamic_attributes/boolean_attribute.haml,benchmark/dynamic_attributes/class_attribute.haml,benchmark/dynamic_attributes/id_attribute.haml,benchmark/dynamic_attributes/data_attribute.haml,benchmark/dynamic_attributes/common_attribute.haml
|
28
|
-
- env: TASK=bench TEMPLATE=benchmark/etc/attribute_builder.haml
|
29
37
|
- env: TASK=bench SLIM_BENCH=1
|
38
|
+
- env: TASK=bench TEMPLATE=benchmark/etc/attribute_builder.haml
|
39
|
+
- env: TASK=bench TEMPLATE=benchmark/etc/static_analyzer.haml
|
40
|
+
- env: TASK=bench TEMPLATE=benchmark/etc/string_interpolation.haml
|
30
41
|
- env: TASK=bench TEMPLATE=test/haml/templates/standard.haml COMPILE=1
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,29 @@
|
|
1
|
-
|
1
|
+
# Change Log
|
2
2
|
|
3
|
+
All notable changes to this project will be documented in this file. This
|
4
|
+
project adheres to [Semantic Versioning](http://semver.org/). This change log is based upon
|
5
|
+
[keep-a-changelog](https://github.com/olivierlacan/keep-a-changelog).
|
6
|
+
|
7
|
+
## [HEAD]
|
8
|
+
- No changes
|
9
|
+
|
10
|
+
## [2.0.2] - 2015-12-12
|
11
|
+
|
12
|
+
### Fixed
|
13
|
+
- Fix a crash in compiling with CLI
|
14
|
+
[#46](https://github.com/k0kubun/hamlit/pull/46). *Thanks to @walf443*
|
15
|
+
- Use default engine options properly in CLI commands
|
16
|
+
|
17
|
+
## [2.0.1] - 2015-11-30
|
18
|
+
|
19
|
+
### Fixed
|
20
|
+
- Fix build failure of native extension
|
21
|
+
|
22
|
+
## [2.0.0] - 2015-11-30 [YANKED]
|
23
|
+
### Added
|
24
|
+
- Support object reference
|
25
|
+
|
26
|
+
### Changed
|
3
27
|
- Full scratch of internal implementation
|
4
28
|
- Rendering is strongly optimized
|
5
29
|
- Static analyzer is introduced
|
@@ -7,322 +31,438 @@
|
|
7
31
|
- Optimized compilation for 5 types of attributes
|
8
32
|
- Compilation became faster too
|
9
33
|
- Many rendering incompatibilities are resolved
|
10
|
-
|
11
|
-
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
34
|
+
- [**breaking**] Replaced parser with original Haml's one
|
35
|
+
- Incompatible parsing error will never happen, but we can no longer parse
|
36
|
+
attributes with Ripper
|
37
|
+
- [**breaking**] Unified behavior for both static and dynamic attributes, see
|
38
|
+
[5 types of attributes](REFERENCE.md#5-types-of-attributes)
|
39
|
+
- Though inconsistent behavior is removed, we can no longer rely on
|
40
|
+
completely-Haml-compatible behavior of static attributes and pass haml-spec
|
41
|
+
- [**breaking**] Added :escape\_attrs option
|
42
|
+
- You should specify HTML-escaping availability for script and attrs
|
43
|
+
separately.
|
44
|
+
|
45
|
+
## [1.7.2] - 2015-07-22
|
46
|
+
|
47
|
+
### Fixed
|
21
48
|
- Bugfix about parsing a content of tag
|
22
49
|
- This was introduced in v1.6.6.
|
23
50
|
|
24
|
-
##
|
51
|
+
## [1.7.1] - 2015-07-21
|
25
52
|
|
53
|
+
### Fixed
|
26
54
|
- Don't escape a block content of some helpers
|
27
|
-
|
28
|
-
- Thanks to @felixbuenemann
|
55
|
+
[#35](https://github.com/k0kubun/hamlit/issues/35). *Thanks to @felixbuenemann*
|
29
56
|
|
30
|
-
##
|
57
|
+
## [1.7.0] - 2015-07-09
|
31
58
|
|
59
|
+
### Added
|
32
60
|
- Support Ruby 2.2.0 hash syntax
|
33
61
|
- like `{ "hyphened-key": "value" }`
|
34
62
|
|
35
|
-
##
|
63
|
+
## [1.6.7] - 2015-06-27
|
36
64
|
|
65
|
+
### Fixed
|
37
66
|
- Remove unused variables and avoid shadowing
|
38
67
|
- To suppress warnings in application using `rspec --warnings`
|
39
68
|
|
40
|
-
##
|
69
|
+
## [1.6.6] - 2015-06-24
|
41
70
|
|
71
|
+
### Added
|
42
72
|
- Allow hyphenated HTML-style attributes
|
43
|
-
|
44
|
-
- Thanks to @babelfish
|
73
|
+
[pull #29](https://github.com/k0kubun/hamlit/pull/29). *thanks to @babelfish*
|
45
74
|
|
46
|
-
##
|
75
|
+
## [1.6.5] - 2015-06-13
|
47
76
|
|
77
|
+
### Fixed
|
48
78
|
- Don't duplicate element class and attribute class
|
49
79
|
- Raise an error for an empty tag name
|
50
80
|
|
51
|
-
##
|
81
|
+
## [1.6.4] - 2015-06-13
|
52
82
|
|
83
|
+
### Changed
|
53
84
|
- Show human-friendly error messages
|
85
|
+
|
86
|
+
### Fixed
|
54
87
|
- Fix line number of runtime syntax error
|
55
|
-
- Increase the number of checked cases for illegal nesting
|
56
|
-
|
88
|
+
- Increase the number of checked cases for illegal nesting.
|
89
|
+
*Thanks to @eagletmt*
|
57
90
|
|
58
|
-
##
|
91
|
+
## [1.6.3] - 2015-06-13
|
59
92
|
|
93
|
+
### Fixed
|
60
94
|
- Fix ! and & parsing inside a tag
|
61
|
-
|
62
|
-
|
95
|
+
[#27](https://github.com/k0kubun/hamlit/issues/27#issuecomment-111593458).
|
96
|
+
*Thanks to @leesmith*
|
63
97
|
|
64
|
-
##
|
98
|
+
## [1.6.2] - 2015-06-11
|
65
99
|
|
100
|
+
### Fixed
|
66
101
|
- Reject a content for self-closing tags
|
67
102
|
- Reject nesing within self-closing tags
|
68
103
|
|
69
|
-
##
|
104
|
+
## [1.6.1] - 2015-06-11
|
70
105
|
|
106
|
+
### Fixed
|
71
107
|
- Parse N-space indentation
|
72
|
-
|
73
|
-
- Thanks to @eagletmt
|
108
|
+
[#26](https://github.com/k0kubun/hamlit/issues/26). *Thanks to @eagletmt*
|
74
109
|
|
75
|
-
##
|
110
|
+
## [1.6.0] - 2015-06-11
|
76
111
|
|
112
|
+
### Fixed
|
77
113
|
- Fix line number of compiled code for new attributes
|
78
|
-
- Render HTML entities normally for plain text
|
79
|
-
|
80
|
-
- Thanks to @jeffblake
|
114
|
+
- Render HTML entities normally for plain text
|
115
|
+
[#27](https://github.com/k0kubun/hamlit/issues/27). *Thanks to @jeffblake*
|
81
116
|
|
82
|
-
##
|
117
|
+
## [1.5.9] - 2015-06-08
|
83
118
|
|
119
|
+
### Fixed
|
84
120
|
- Reject silent script after a tag
|
85
121
|
|
86
|
-
##
|
122
|
+
## [1.5.8] - 2015-06-08
|
87
123
|
|
124
|
+
### Fixed
|
88
125
|
- Fix parsing inline script for != and &=
|
89
126
|
|
90
|
-
##
|
127
|
+
## [1.5.7] - 2015-06-08
|
91
128
|
|
129
|
+
### Fixed
|
92
130
|
- Fix the behavior for multi-line script
|
93
131
|
|
94
|
-
##
|
132
|
+
## [1.5.6] - 2015-06-07
|
95
133
|
|
134
|
+
### Added
|
96
135
|
- Raise error for unbalanced brackets
|
136
|
+
|
137
|
+
### Changed
|
97
138
|
- Don't render newline after block script
|
98
139
|
|
99
|
-
##
|
140
|
+
## [1.5.5] - 2015-06-07
|
100
141
|
|
142
|
+
### Added
|
101
143
|
- Support &, &== operator
|
144
|
+
|
145
|
+
### Changed
|
102
146
|
- Depend on v0.7.6 of temple for refactoring
|
147
|
+
|
148
|
+
### Fixed
|
103
149
|
- Fix a trivial diff of rendering multiline operator
|
104
150
|
|
105
|
-
##
|
151
|
+
## [1.5.4] - 2015-06-07
|
106
152
|
|
153
|
+
### Changed
|
107
154
|
- Recursively remove whitespace inside a tag
|
155
|
+
|
156
|
+
### Fixed
|
108
157
|
- Fix ! operator immediately before whitespace
|
109
158
|
|
110
|
-
##
|
159
|
+
## [1.5.3] - 2015-06-06
|
111
160
|
|
161
|
+
### Added
|
112
162
|
- Support !, !=, !==, &= and ~ as inline operators
|
113
163
|
|
114
|
-
##
|
164
|
+
## [1.5.2] - 2015-06-06
|
115
165
|
|
166
|
+
### Changed
|
116
167
|
- Disable html escaping in CSS and JavaScript filter
|
117
168
|
|
118
|
-
##
|
169
|
+
## [1.5.1] - 2015-06-05
|
119
170
|
|
171
|
+
### Changed
|
120
172
|
- Remove outer whitespace in the block
|
121
173
|
|
122
|
-
##
|
174
|
+
## [1.5.0] - 2015-06-03
|
123
175
|
|
176
|
+
### Changed
|
124
177
|
- Remake implementation of outer whitespace removal
|
125
178
|
|
126
|
-
##
|
179
|
+
## [1.4.7] - 2015-06-03
|
127
180
|
|
181
|
+
### Changed
|
128
182
|
- Sort static old attributes by name
|
183
|
+
|
184
|
+
### Fixed
|
129
185
|
- Bugfix for old array attributes with class element
|
130
186
|
|
131
|
-
##
|
187
|
+
## [1.4.6] - 2015-06-03
|
132
188
|
|
189
|
+
### Added
|
133
190
|
- Support `!==`, `==` operator
|
191
|
+
|
192
|
+
### Fixed
|
134
193
|
- Avoid regarding spaced block as multiline
|
135
194
|
|
136
|
-
##
|
195
|
+
## [1.4.5] - 2015-06-02
|
137
196
|
|
197
|
+
### Fixed
|
138
198
|
- Support Ruby 2.0 and 2.1 for v1.4.4
|
139
199
|
|
140
|
-
##
|
200
|
+
## [1.4.4] - 2015-06-02 [YANKED]
|
141
201
|
|
202
|
+
### Fixed
|
142
203
|
- Fix old attribute parser to be more flexible
|
143
204
|
- Accept multiple hashes as old attributes
|
144
205
|
- Accept old attributes with hash and literal
|
145
206
|
|
146
|
-
##
|
207
|
+
## [1.4.3] - 2015-06-02
|
147
208
|
|
209
|
+
### Changed
|
148
210
|
- Allow `when` to have multiple candidates
|
149
211
|
- Allow `rescue` to specify an error variable
|
150
212
|
|
151
|
-
##
|
213
|
+
## [1.4.2] - 2015-05-31
|
152
214
|
|
215
|
+
### Added
|
153
216
|
- Support `!` operator
|
154
217
|
- It disables html escaping for interpolated text
|
155
218
|
|
156
|
-
##
|
219
|
+
## [1.4.1] - 2015-05-31
|
157
220
|
|
221
|
+
### Fixed
|
158
222
|
- Fix code mistake in 1.4.0
|
159
223
|
|
160
|
-
##
|
224
|
+
## [1.4.0] - 2015-05-31 [YANKED]
|
161
225
|
|
226
|
+
### Added
|
162
227
|
- Escape interpolated string in plain text
|
163
228
|
|
164
|
-
##
|
229
|
+
## [1.3.2] - 2015-05-30
|
165
230
|
|
166
231
|
- Render `begin`, `rescue` and `ensure`
|
167
232
|
|
168
|
-
##
|
233
|
+
## [1.3.1] - 2015-05-30
|
169
234
|
|
235
|
+
### Fixed
|
170
236
|
- Bugfix about a backslash-only comment
|
171
237
|
- Don't strip a plain text
|
172
238
|
|
173
|
-
##
|
239
|
+
## [1.3.0] - 2015-05-16
|
174
240
|
|
241
|
+
### Added
|
175
242
|
- Resurrect escape\_html option
|
243
|
+
[#25](https://github.com/k0kubun/hamlit/issues/25).
|
244
|
+
*Thanks to @resistorsoftware*
|
176
245
|
- Still enabled by default
|
177
246
|
- This has been dropped since v0.6.0
|
178
|
-
- https://github.com/k0kubun/hamlit/issues/25
|
179
|
-
- Thanks to @resistorsoftware
|
180
247
|
|
181
|
-
##
|
248
|
+
## [1.2.1] - 2015-05-15
|
182
249
|
|
250
|
+
### Fixed
|
183
251
|
- Fix the list of boolean attributes
|
184
|
-
|
185
|
-
- Thanks to @jeffblake
|
252
|
+
[#24](https://github.com/k0kubun/hamlit/issues/24). *Thanks to @jeffblake*
|
186
253
|
|
187
|
-
##
|
254
|
+
## [1.2.0] - 2015-05-06
|
188
255
|
|
256
|
+
Added
|
189
257
|
- Support `succeed`, `precede` and `surround`
|
190
|
-
|
191
|
-
- Thanks to @sneakernets
|
258
|
+
[#22](https://github.com/k0kubun/hamlit/issues/22). *Thanks to @sneakernets*
|
192
259
|
|
193
|
-
##
|
260
|
+
## [1.1.1] - 2015-05-06
|
194
261
|
|
262
|
+
### Fixed
|
195
263
|
- Bugfix of rendering array attributes
|
196
264
|
|
197
|
-
##
|
265
|
+
## [1.1.0] - 2015-05-06
|
198
266
|
|
267
|
+
### Fixed
|
199
268
|
- Join id and class attributes
|
200
|
-
|
201
|
-
|
269
|
+
[#23](https://github.com/k0kubun/hamlit/issues/23).
|
270
|
+
*Thanks to @felixbuenemann*
|
202
271
|
|
203
|
-
##
|
272
|
+
## [1.0.0] - 2015-04-12
|
204
273
|
|
274
|
+
### Added
|
205
275
|
- Use escape\_utils gem for faster escape\_html
|
206
276
|
|
207
|
-
##
|
277
|
+
## [0.6.2] - 2015-04-12
|
208
278
|
|
279
|
+
### Fixed
|
209
280
|
- Don't render falsy attributes
|
210
|
-
|
211
|
-
- Thanks to @eagletmt
|
281
|
+
[#2](https://github.com/k0kubun/hamlit/issues/2). *Thanks to @eagletmt*
|
212
282
|
|
213
|
-
##
|
283
|
+
## [0.6.1] - 2015-04-12
|
214
284
|
|
285
|
+
### Fixed
|
215
286
|
- Bugfix of line numbers for better error backtrace
|
216
|
-
|
287
|
+
[pull #19](https://github.com/k0kubun/hamlit/pull/19)
|
217
288
|
|
218
|
-
##
|
289
|
+
## [0.6.0] - 2015-04-12
|
219
290
|
|
291
|
+
### Added
|
220
292
|
- Automatically escape html in all situations
|
221
|
-
|
293
|
+
[pull #18](https://github.com/k0kubun/hamlit/pull/18)
|
222
294
|
|
223
|
-
##
|
295
|
+
## [0.5.3] - 2015-04-12
|
224
296
|
|
297
|
+
### Fixed
|
225
298
|
- Bugfix for syntax error in data attribute hash
|
226
|
-
|
227
|
-
- Thanks to @eagletmt
|
299
|
+
[#17](https://github.com/k0kubun/hamlit/issues/17). *Thanks to @eagletmt*
|
228
300
|
|
229
|
-
##
|
301
|
+
## [0.5.2] - 2015-04-12
|
230
302
|
|
303
|
+
### Fixed
|
231
304
|
- Bugfix for silent script without block
|
232
|
-
|
233
|
-
- Thanks to @eagletmt
|
305
|
+
[#16](https://github.com/k0kubun/hamlit/issues/16). *Thanks to @eagletmt*
|
234
306
|
|
235
|
-
##
|
307
|
+
## [0.5.1] - 2015-04-12
|
236
308
|
|
309
|
+
### Fixed
|
237
310
|
- Bugfix about duplicated id and class
|
238
|
-
|
239
|
-
- Thanks to @os0x
|
311
|
+
[#4](https://github.com/k0kubun/hamlit/issues/4). *Thanks to @os0x*
|
240
312
|
|
241
|
-
##
|
313
|
+
## [0.5.0] - 2015-04-12
|
242
314
|
|
315
|
+
### Fixed
|
243
316
|
- Escape special characters in attribute values
|
244
|
-
|
245
|
-
|
317
|
+
[#10](https://github.com/k0kubun/hamlit/issues/10). *Thanks to @mono0x,
|
318
|
+
@eagletmt*
|
246
319
|
|
247
|
-
##
|
320
|
+
## [0.4.3] - 2015-04-12
|
248
321
|
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
- Accept comment-only script
|
253
|
-
|
254
|
-
- Thanks to @jeffblake
|
322
|
+
### Fixed
|
323
|
+
- Allow empty else statement [#14](https://github.com/k0kubun/hamlit/issues/14).
|
324
|
+
*Thanks to @jeffblake*
|
325
|
+
- Accept comment-only script [#13](https://github.com/k0kubun/hamlit/issues/13).
|
326
|
+
*Thanks to @jeffblake*
|
255
327
|
|
256
|
-
##
|
328
|
+
## [0.4.2] - 2015-04-05
|
257
329
|
|
330
|
+
### Fixed
|
258
331
|
- Bugfix about parsing nested attributes
|
259
|
-
|
260
|
-
|
332
|
+
[#12](https://github.com/k0kubun/hamlit/issues/12). *Thanks to @creasty*
|
333
|
+
|
334
|
+
## [0.4.1] - 2015-04-05
|
261
335
|
|
262
|
-
|
336
|
+
### Removed
|
337
|
+
- Automatic escape html is sintara, consult `README.md`.
|
263
338
|
|
339
|
+
### Fixed
|
264
340
|
- Escape haml operators by backslash
|
265
|
-
|
266
|
-
- Thanks to @mono0x
|
341
|
+
[#11](https://github.com/k0kubun/hamlit/issues/11). *Thanks to @mono0x*
|
267
342
|
|
268
|
-
##
|
343
|
+
## [0.4.0] - 2015-04-05 [YANKED]
|
269
344
|
|
345
|
+
### Added
|
270
346
|
- Automatically escape html in sinatra
|
271
|
-
- This behavior is not compatible with Haml.
|
272
|
-
- Removed from next version.
|
273
347
|
|
274
|
-
##
|
348
|
+
## [0.3.4] - 2015-04-02
|
275
349
|
|
276
|
-
|
277
|
-
|
278
|
-
|
350
|
+
### Fixed
|
351
|
+
- Allow tab indentation [#9](https://github.com/k0kubun/hamlit/issues/9).
|
352
|
+
*Thanks to @tdtds*
|
279
353
|
|
280
|
-
##
|
354
|
+
## [0.3.3] - 2015-04-01
|
281
355
|
|
282
|
-
|
283
|
-
|
284
|
-
|
356
|
+
### Fixed
|
357
|
+
- Accept multi byte parsing [#8](https://github.com/k0kubun/hamlit/issues/8).
|
358
|
+
*Thanks to @machu*
|
285
359
|
|
286
|
-
##
|
360
|
+
## [0.3.2] - 2015-03-31
|
287
361
|
|
288
|
-
|
289
|
-
|
290
|
-
|
362
|
+
### Fixed
|
363
|
+
- Bugfix for compiling old attributes [#7](https://github.com/k0kubun/hamlit/issues/7).
|
364
|
+
*Thanks to @creasty*
|
291
365
|
|
292
|
-
##
|
366
|
+
## [0.3.1] - 2015-03-31
|
293
367
|
|
294
|
-
|
295
|
-
|
296
|
-
|
368
|
+
### Fixed
|
369
|
+
- Hyphenate data attributes [#5](https://github.com/k0kubun/hamlit/issues/5).
|
370
|
+
*Thanks to @os0x*
|
297
371
|
|
298
|
-
##
|
372
|
+
## [0.3.0] - 2015-03-31
|
299
373
|
|
374
|
+
### Added
|
300
375
|
- Specify a version in dependency of temple
|
301
376
|
|
302
|
-
##
|
377
|
+
## [0.2.0] - 2015-03-30
|
303
378
|
|
304
|
-
|
305
|
-
|
306
|
-
|
379
|
+
### Added
|
380
|
+
- Allow comments in script [#3](https://github.com/k0kubun/hamlit/issues/3).
|
381
|
+
*Thanks to @eagletmt*
|
307
382
|
|
308
|
-
##
|
383
|
+
## [0.1.3] - 2015-03-30
|
309
384
|
|
310
|
-
|
311
|
-
|
312
|
-
|
385
|
+
### Fixed
|
386
|
+
- Bugfix for [#1](https://github.com/k0kubun/hamlit/issues/1) attribute nesting
|
387
|
+
on runtime. *Thanks to @eagletmt*
|
313
388
|
|
314
|
-
##
|
389
|
+
## [0.1.2] - 2015-03-30
|
315
390
|
|
391
|
+
### Fixed
|
316
392
|
- Ignore false or nil values in attributes
|
317
|
-
- Partial fix for https://github.com/k0kubun/hamlit/issues/2
|
318
|
-
|
393
|
+
- Partial fix for [#2](https://github.com/k0kubun/hamlit/issues/2).
|
394
|
+
*Thanks to @eagletmt*
|
319
395
|
|
320
|
-
##
|
396
|
+
## [0.1.1] - 2015-03-30
|
321
397
|
|
398
|
+
### Removed
|
322
399
|
- Drop obsolete `--ugly` option for CLI
|
323
|
-
- Currently pretty mode is not implemented
|
400
|
+
- Currently pretty mode is not implemented #2
|
324
401
|
|
325
|
-
##
|
402
|
+
## [0.1.0] - 2015-03-30
|
326
403
|
|
327
404
|
- Initial release
|
328
|
-
- Passing haml-spec with ugly mode
|
405
|
+
- Passing haml-spec with ugly mode
|
406
|
+
|
407
|
+
[0.1.0]: https://github.com/k0kubun/hamlit/compare/9cf8216...v0.1.0
|
408
|
+
[0.1.1]: https://github.com/k0kubun/hamlit/compare/v0.1.0...v0.1.1
|
409
|
+
[0.1.2]: https://github.com/k0kubun/hamlit/compare/v0.1.1...v0.1.2
|
410
|
+
[0.1.3]: https://github.com/k0kubun/hamlit/compare/v0.1.2...v0.1.3
|
411
|
+
[0.2.0]: https://github.com/k0kubun/hamlit/compare/v0.1.3...v0.2.0
|
412
|
+
[0.3.0]: https://github.com/k0kubun/hamlit/compare/v0.2.0...v0.3.0
|
413
|
+
[0.3.1]: https://github.com/k0kubun/hamlit/compare/v0.3.0...v0.3.1
|
414
|
+
[0.3.2]: https://github.com/k0kubun/hamlit/compare/v0.3.1...v0.3.2
|
415
|
+
[0.3.3]: https://github.com/k0kubun/hamlit/compare/v0.3.2...v0.3.3
|
416
|
+
[0.3.4]: https://github.com/k0kubun/hamlit/compare/v0.3.3...v0.3.4
|
417
|
+
[0.4.0]: https://github.com/k0kubun/hamlit/compare/v0.3.4...v0.4.0
|
418
|
+
[0.4.1]: https://github.com/k0kubun/hamlit/compare/v0.4.0...v0.4.1
|
419
|
+
[0.4.2]: https://github.com/k0kubun/hamlit/compare/v0.4.1...v0.4.2
|
420
|
+
[0.4.3]: https://github.com/k0kubun/hamlit/compare/v0.4.2...v0.4.3
|
421
|
+
[0.5.0]: https://github.com/k0kubun/hamlit/compare/v0.4.3...v0.5.0
|
422
|
+
[0.5.1]: https://github.com/k0kubun/hamlit/compare/v0.5.0...v0.5.1
|
423
|
+
[0.5.2]: https://github.com/k0kubun/hamlit/compare/v0.5.1...v0.5.2
|
424
|
+
[0.5.3]: https://github.com/k0kubun/hamlit/compare/v0.5.2...v0.5.3
|
425
|
+
[0.6.0]: https://github.com/k0kubun/hamlit/compare/v0.5.3...v0.6.0
|
426
|
+
[0.6.1]: https://github.com/k0kubun/hamlit/compare/v0.6.0...v0.6.1
|
427
|
+
[0.6.2]: https://github.com/k0kubun/hamlit/compare/v0.6.1...v0.6.2
|
428
|
+
[1.0.0]: https://github.com/k0kubun/hamlit/compare/v0.6.2...v1.0.0
|
429
|
+
[1.1.0]: https://github.com/k0kubun/hamlit/compare/v1.0.0...v1.1.0
|
430
|
+
[1.1.1]: https://github.com/k0kubun/hamlit/compare/v1.1.0...v1.1.1
|
431
|
+
[1.2.0]: https://github.com/k0kubun/hamlit/compare/v1.1.1...v1.2.0
|
432
|
+
[1.2.1]: https://github.com/k0kubun/hamlit/compare/v1.2.0...v1.2.1
|
433
|
+
[1.3.0]: https://github.com/k0kubun/hamlit/compare/v1.2.1...v1.3.0
|
434
|
+
[1.3.1]: https://github.com/k0kubun/hamlit/compare/v1.3.0...v1.3.1
|
435
|
+
[1.3.2]: https://github.com/k0kubun/hamlit/compare/v1.3.1...v1.3.2
|
436
|
+
[1.4.0]: https://github.com/k0kubun/hamlit/compare/v1.3.2...v1.4.0
|
437
|
+
[1.4.1]: https://github.com/k0kubun/hamlit/compare/v1.4.0...v1.4.1
|
438
|
+
[1.4.2]: https://github.com/k0kubun/hamlit/compare/v1.4.1...v1.4.2
|
439
|
+
[1.4.3]: https://github.com/k0kubun/hamlit/compare/v1.4.2...v1.4.3
|
440
|
+
[1.4.4]: https://github.com/k0kubun/hamlit/compare/v1.4.3...v1.4.4
|
441
|
+
[1.4.5]: https://github.com/k0kubun/hamlit/compare/v1.4.4...v1.4.5
|
442
|
+
[1.4.6]: https://github.com/k0kubun/hamlit/compare/v1.4.5...v1.4.6
|
443
|
+
[1.4.7]: https://github.com/k0kubun/hamlit/compare/v1.4.6...v1.4.7
|
444
|
+
[1.5.0]: https://github.com/k0kubun/hamlit/compare/v1.4.7...v1.5.0
|
445
|
+
[1.5.1]: https://github.com/k0kubun/hamlit/compare/v1.5.0...v1.5.1
|
446
|
+
[1.5.2]: https://github.com/k0kubun/hamlit/compare/v1.5.1...v1.5.2
|
447
|
+
[1.5.3]: https://github.com/k0kubun/hamlit/compare/v1.5.2...v1.5.3
|
448
|
+
[1.5.4]: https://github.com/k0kubun/hamlit/compare/v1.5.3...v1.5.4
|
449
|
+
[1.5.5]: https://github.com/k0kubun/hamlit/compare/v1.5.4...v1.5.5
|
450
|
+
[1.5.6]: https://github.com/k0kubun/hamlit/compare/v1.5.5...v1.5.6
|
451
|
+
[1.5.7]: https://github.com/k0kubun/hamlit/compare/v1.5.6...v1.5.7
|
452
|
+
[1.5.8]: https://github.com/k0kubun/hamlit/compare/v1.5.7...v1.5.8
|
453
|
+
[1.5.9]: https://github.com/k0kubun/hamlit/compare/v1.5.8...v1.5.9
|
454
|
+
[1.6.0]: https://github.com/k0kubun/hamlit/compare/v1.5.9...v1.6.0
|
455
|
+
[1.6.1]: https://github.com/k0kubun/hamlit/compare/v1.6.0...v1.6.1
|
456
|
+
[1.6.2]: https://github.com/k0kubun/hamlit/compare/v1.6.1...v1.6.2
|
457
|
+
[1.6.3]: https://github.com/k0kubun/hamlit/compare/v1.6.2...v1.6.3
|
458
|
+
[1.6.4]: https://github.com/k0kubun/hamlit/compare/v1.6.3...v1.6.4
|
459
|
+
[1.6.5]: https://github.com/k0kubun/hamlit/compare/v1.6.4...v1.6.5
|
460
|
+
[1.6.6]: https://github.com/k0kubun/hamlit/compare/v1.6.5...v1.6.6
|
461
|
+
[1.6.7]: https://github.com/k0kubun/hamlit/compare/v1.6.6...v1.6.7
|
462
|
+
[1.7.0]: https://github.com/k0kubun/hamlit/compare/v1.6.7...v1.7.0
|
463
|
+
[1.7.1]: https://github.com/k0kubun/hamlit/compare/v1.7.0...v1.7.1
|
464
|
+
[1.7.2]: https://github.com/k0kubun/hamlit/compare/v1.7.1...v1.7.2
|
465
|
+
[2.0.0]: https://github.com/k0kubun/hamlit/compare/v1.7.2...v2.0.0
|
466
|
+
[2.0.1]: https://github.com/k0kubun/hamlit/compare/v2.0.0...v2.0.1
|
467
|
+
[2.0.2]: https://github.com/k0kubun/hamlit/compare/v2.0.1...v2.0.2
|
468
|
+
[HEAD]: https://github.com/k0kubun/hamlit/compare/v2.0.1...HEAD
|
data/README.md
CHANGED
@@ -10,17 +10,17 @@ Hamlit is a high performance [Haml](https://github.com/haml/haml) implementation
|
|
10
10
|
### What is Hamlit?
|
11
11
|
Hamlit is another implementation of [Haml](https://github.com/haml/haml).
|
12
12
|
With some [limitations](REFERENCE.md#limitations) by design for performance,
|
13
|
-
Hamlit is **
|
14
|
-
which is an HTML-escaped version of [slim-template/slim's one](https://github.com/slim-template/slim/blob/v3.0.6/benchmarks/run-benchmarks.rb) for fairness.
|
13
|
+
Hamlit is **8.54x times faster** than original haml gem in [this benchmark](benchmark/slim/run-benchmarks.rb),
|
14
|
+
which is an HTML-escaped version of [slim-template/slim's one](https://github.com/slim-template/slim/blob/v3.0.6/benchmarks/run-benchmarks.rb) for fairness. ([Result on Travis](https://travis-ci.org/k0kubun/hamlit/jobs/93928561))
|
15
15
|
|
16
|
-

|
17
17
|
|
18
18
|
```
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
hamlit v2.0.1: 122622.3 i/s
|
20
|
+
faml v0.7.0: 94239.1 i/s - 1.30x slower
|
21
|
+
slim v3.0.6: 89143.0 i/s - 1.38x slower
|
22
|
+
erubis v2.7.0: 65047.8 i/s - 1.89x slower
|
23
|
+
haml v5.0.0.beta.2: 14363.6 i/s - 8.54x slower
|
24
24
|
```
|
25
25
|
|
26
26
|
### Why is Hamlit faster?
|
File without changes
|
data/bin/bench
CHANGED
@@ -15,7 +15,7 @@ class Bench < Thor
|
|
15
15
|
option :compile, type: :boolean, aliases: ['-c']
|
16
16
|
option :show_code, type: :boolean, aliases: ['-s']
|
17
17
|
def bench(*files)
|
18
|
-
files.each { |file| render(file)
|
18
|
+
files.each { |file| render(file) }
|
19
19
|
files.each { |file| compile(file) if options[:compile] }
|
20
20
|
files.each { |file| code(file) if options[:show_code] }
|
21
21
|
end
|
data/lib/hamlit/cli.rb
CHANGED
@@ -50,12 +50,16 @@ module Hamlit
|
|
50
50
|
|
51
51
|
def generate_ast(file)
|
52
52
|
template = File.read(file)
|
53
|
-
Hamlit::Parser.new(
|
53
|
+
Hamlit::Parser.new(engine_options).call(template)
|
54
54
|
end
|
55
55
|
|
56
56
|
def generate_temple(file)
|
57
57
|
ast = generate_ast(file)
|
58
|
-
Hamlit::Compiler.new.call(ast)
|
58
|
+
Hamlit::Compiler.new(engine_options).call(ast)
|
59
|
+
end
|
60
|
+
|
61
|
+
def engine_options
|
62
|
+
Hamlit::Engine.options
|
59
63
|
end
|
60
64
|
|
61
65
|
# Flexible default_task, compatible with haml's CLI
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'hamlit/attribute_builder'
|
2
|
-
require 'hamlit/
|
2
|
+
require 'hamlit/attribute_parser'
|
3
3
|
require 'hamlit/ruby_expression'
|
4
4
|
require 'hamlit/static_analyzer'
|
5
5
|
require 'hamlit/string_interpolation'
|
@@ -18,7 +18,7 @@ module Hamlit
|
|
18
18
|
hashes = []
|
19
19
|
return runtime_compile(node) if node.value[:object_ref] != :nil
|
20
20
|
node.value[:attributes_hashes].each do |attribute_str|
|
21
|
-
hash =
|
21
|
+
hash = AttributeParser.parse(attribute_str)
|
22
22
|
return runtime_compile(node) unless hash
|
23
23
|
hashes << hash
|
24
24
|
end
|
data/lib/hamlit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hamlit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi Kokubun
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11
|
11
|
+
date: 2015-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: escape_utils
|
@@ -289,10 +289,12 @@ files:
|
|
289
289
|
- benchmark/dynamic_attributes/common_attribute.haml
|
290
290
|
- benchmark/dynamic_attributes/data_attribute.haml
|
291
291
|
- benchmark/dynamic_attributes/id_attribute.haml
|
292
|
+
- benchmark/dynamic_boolean_attribute.haml
|
292
293
|
- benchmark/etc/attribute_builder.haml
|
293
294
|
- benchmark/etc/real_sample.haml
|
294
295
|
- benchmark/etc/real_sample.rb
|
295
296
|
- benchmark/etc/static_analyzer.haml
|
297
|
+
- benchmark/etc/string_interpolation.haml
|
296
298
|
- benchmark/etc/tags.haml
|
297
299
|
- benchmark/ext/build_data.rb
|
298
300
|
- benchmark/ext/build_id.rb
|
@@ -305,7 +307,6 @@ files:
|
|
305
307
|
- benchmark/slim/view.erb
|
306
308
|
- benchmark/slim/view.haml
|
307
309
|
- benchmark/slim/view.slim
|
308
|
-
- benchmark/string_interpolation.haml
|
309
310
|
- benchmark/utils/benchmark_ips_extension.rb
|
310
311
|
- bin/bench
|
311
312
|
- bin/clone
|
@@ -341,6 +342,7 @@ files:
|
|
341
342
|
- hamlit.gemspec
|
342
343
|
- lib/hamlit.rb
|
343
344
|
- lib/hamlit/attribute_builder.rb
|
345
|
+
- lib/hamlit/attribute_parser.rb
|
344
346
|
- lib/hamlit/cli.rb
|
345
347
|
- lib/hamlit/compiler.rb
|
346
348
|
- lib/hamlit/compiler/attribute_compiler.rb
|
@@ -369,7 +371,6 @@ files:
|
|
369
371
|
- lib/hamlit/filters/scss.rb
|
370
372
|
- lib/hamlit/filters/text_base.rb
|
371
373
|
- lib/hamlit/filters/tilt_base.rb
|
372
|
-
- lib/hamlit/hash_parser.rb
|
373
374
|
- lib/hamlit/html.rb
|
374
375
|
- lib/hamlit/identity.rb
|
375
376
|
- lib/hamlit/object_ref.rb
|
@@ -418,3 +419,4 @@ signing_key:
|
|
418
419
|
specification_version: 4
|
419
420
|
summary: High Performance Haml Implementation
|
420
421
|
test_files: []
|
422
|
+
has_rdoc:
|