hamlit 1.5.9 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/doc/README.md +15 -2
  4. data/doc/engine/indent.md +24 -0
  5. data/doc/engine/new_attribute.md +77 -0
  6. data/doc/engine/old_attributes.md +127 -0
  7. data/doc/engine/silent_script.md +97 -0
  8. data/doc/engine/tag.md +48 -0
  9. data/doc/engine/text.md +7 -1
  10. data/doc/faml/README.md +19 -0
  11. data/doc/faml/engine/indent.md +24 -0
  12. data/doc/faml/engine/old_attributes.md +108 -0
  13. data/doc/faml/engine/silent_script.md +97 -0
  14. data/doc/faml/engine/text.md +35 -0
  15. data/doc/faml/filters/coffee.md +125 -0
  16. data/doc/faml/filters/erb.md +24 -0
  17. data/doc/faml/filters/javascript.md +27 -0
  18. data/doc/faml/filters/less.md +57 -0
  19. data/doc/faml/filters/plain.md +25 -0
  20. data/doc/faml/filters/sass.md +62 -0
  21. data/doc/faml/filters/scss.md +68 -0
  22. data/doc/haml/README.md +15 -0
  23. data/doc/haml/engine/new_attribute.md +77 -0
  24. data/doc/haml/engine/old_attributes.md +142 -0
  25. data/doc/haml/engine/tag.md +48 -0
  26. data/doc/haml/engine/text.md +59 -0
  27. data/doc/haml/filters/erb.md +26 -0
  28. data/doc/haml/filters/javascript.md +76 -0
  29. data/doc/haml/filters/markdown.md +31 -0
  30. data/lib/hamlit/compilers/attributes.rb +1 -1
  31. data/lib/hamlit/compilers/new_attribute.rb +6 -6
  32. data/lib/hamlit/compilers/old_attribute.rb +2 -2
  33. data/lib/hamlit/compilers/text.rb +7 -10
  34. data/lib/hamlit/concerns/lexable.rb +32 -0
  35. data/lib/hamlit/parser.rb +9 -8
  36. data/lib/hamlit/parsers/attribute.rb +6 -3
  37. data/lib/hamlit/version.rb +1 -1
  38. data/spec/hamlit/engine/indent_spec.rb +1 -1
  39. data/spec/hamlit/engine/new_attribute_spec.rb +13 -2
  40. data/spec/hamlit/engine/old_attributes_spec.rb +5 -5
  41. data/spec/hamlit/engine/silent_script_spec.rb +4 -4
  42. data/spec/hamlit/engine/tag_spec.rb +23 -0
  43. data/spec/hamlit/engine/text_spec.rb +7 -3
  44. data/spec/spec_helper.rb +7 -231
  45. data/spec/spec_helper/document_generator.rb +93 -0
  46. data/spec/spec_helper/render_helper.rb +112 -0
  47. data/spec/spec_helper/test_case.rb +55 -0
  48. metadata +33 -3
  49. data/lib/hamlit/concerns/ripperable.rb +0 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 61d820a639e5851bb7168a6e43dda33233e2bfb5
4
- data.tar.gz: 8f1cfdf0a73b5bf00448d83f2618bb35bc085242
3
+ metadata.gz: 7a47c046855e5faac3109a4e63a42c5502b9acbd
4
+ data.tar.gz: 2ea9635b5945fd898e6f42f7f32646bc7e038a6b
5
5
  SHA512:
6
- metadata.gz: 1b2efdc446a07a9c0845b6077875df95b54695fd2e849ba6e2930a8c5cad06161687bd3eb34ebe001f4e7fb1e6180400ac09218b749eba1448d1f3e59d38a35d
7
- data.tar.gz: 2135080f8d2b8a0b3c40f1d0961b243e4bc50baec47966bf04a9e55f8fadbffef103a4b823df47919a492e0068425898493607b17e1c80c0877818f4c8855701
6
+ metadata.gz: abfde39c2619670875b887f41700a4b0f7335f9b724f12ede0fcbfe833acff62dd100781e1fb9be2b3023c2826cb67f7f053f0d261199548f7925e09f9252291
7
+ data.tar.gz: 4782d6de4f657b871ab423e6af14b4f8d2f72ab82a6b8e6c903dfeec5fa264b02f4499ac72eabd6c588f89d3c24f5b013f43302fc67c4881850e57aa048e3269
@@ -1,3 +1,8 @@
1
+ ## v1.6.0
2
+
3
+ - Fix line number of compiled code for new attributes
4
+ - Render HTML entities normally for plain text
5
+
1
6
  ## v1.5.9
2
7
 
3
8
  - Reject silent script after a tag
@@ -1,9 +1,22 @@
1
1
  # Hamlit incompatibilities
2
-
3
2
  This is a document generated from RSpec test cases.
4
3
  Showing incompatibilities against [Haml](https://github.com/haml/haml) and [Faml](https://github.com/eagletmt/faml).
5
4
 
6
5
  ## engine
7
-
6
+ - [engine/indent\_spec.rb](engine/indent.md)
7
+ - [engine/new\_attribute\_spec.rb](engine/new_attribute.md)
8
8
  - [engine/old\_attributes\_spec.rb](engine/old_attributes.md)
9
+ - [engine/silent\_script\_spec.rb](engine/silent_script.md)
10
+ - [engine/tag\_spec.rb](engine/tag.md)
9
11
  - [engine/text\_spec.rb](engine/text.md)
12
+
13
+
14
+ ## filters
15
+ - [filters/coffee\_spec.rb](filters/coffee.md)
16
+ - [filters/erb\_spec.rb](filters/erb.md)
17
+ - [filters/javascript\_spec.rb](filters/javascript.md)
18
+ - [filters/less\_spec.rb](filters/less.md)
19
+ - [filters/markdown\_spec.rb](filters/markdown.md)
20
+ - [filters/plain\_spec.rb](filters/plain.md)
21
+ - [filters/sass\_spec.rb](filters/sass.md)
22
+ - [filters/scss\_spec.rb](filters/scss.md)
@@ -0,0 +1,24 @@
1
+ # [indent\_spec.rb:3](/spec/hamlit/engine/indent_spec.rb#L3)
2
+ ## Input
3
+ ```haml
4
+ %p
5
+ %a
6
+
7
+ ```
8
+
9
+ ## Output
10
+ ### Haml, Hamlit
11
+ ```html
12
+ <p>
13
+ <a></a>
14
+ </p>
15
+
16
+ ```
17
+
18
+ ### Faml
19
+ ```html
20
+ <p></p>
21
+ %a
22
+
23
+ ```
24
+
@@ -0,0 +1,77 @@
1
+ # [new\_attribute\_spec.rb:19](/spec/hamlit/engine/new_attribute_spec.rb#L19)
2
+ ## Input
3
+ ```haml
4
+ %span(a=__LINE__
5
+ b=__LINE__)
6
+ = __LINE__
7
+
8
+ ```
9
+
10
+ ## Output
11
+ ### Haml
12
+ ```html
13
+ <span a='1' b='1'></span>
14
+ 3
15
+
16
+ ```
17
+
18
+ ### Faml, Hamlit
19
+ ```html
20
+ <span a='1' b='2'></span>
21
+ 3
22
+
23
+ ```
24
+
25
+
26
+ # [new\_attribute\_spec.rb:31](/spec/hamlit/engine/new_attribute_spec.rb#L31)
27
+ ## Input
28
+ ```haml
29
+ %a(title="'")
30
+ %a(title = "'\"")
31
+ %a(href='/search?foo=bar&hoge=<fuga>')
32
+
33
+ ```
34
+
35
+ ## Output
36
+ ### Haml
37
+ ```html
38
+ <a title="'"></a>
39
+ <a title='&#x0027;"'></a>
40
+ <a href='/search?foo=bar&amp;hoge=&lt;fuga&gt;'></a>
41
+
42
+ ```
43
+
44
+ ### Faml, Hamlit
45
+ ```html
46
+ <a title='&#39;'></a>
47
+ <a title='&#39;&quot;'></a>
48
+ <a href='/search?foo=bar&amp;hoge=&lt;fuga&gt;'></a>
49
+
50
+ ```
51
+
52
+
53
+ # [new\_attribute\_spec.rb:43](/spec/hamlit/engine/new_attribute_spec.rb#L43)
54
+ ## Input
55
+ ```haml
56
+ - title = "'\""
57
+ - href = '/search?foo=bar&hoge=<fuga>'
58
+ %a(title=title)
59
+ %a(href=href)
60
+
61
+ ```
62
+
63
+ ## Output
64
+ ### Haml
65
+ ```html
66
+ <a title='&#x0027;"'></a>
67
+ <a href='/search?foo=bar&amp;hoge=&lt;fuga&gt;'></a>
68
+
69
+ ```
70
+
71
+ ### Faml, Hamlit
72
+ ```html
73
+ <a title='&#39;&quot;'></a>
74
+ <a href='/search?foo=bar&amp;hoge=&lt;fuga&gt;'></a>
75
+
76
+ ```
77
+
@@ -26,6 +26,33 @@ Faml::Compiler::UnparsableRubyCode: Unparsable Ruby code is given to attributes:
26
26
  ```
27
27
 
28
28
 
29
+ # [old\_attributes\_spec.rb:124](/spec/hamlit/engine/old_attributes_spec.rb#L124)
30
+ ## Input
31
+ ```haml
32
+ .foo{ class: ['bar'] }
33
+ .foo{ class: ['bar', nil] }
34
+ .foo{ class: ['bar', 'baz'] }
35
+
36
+ ```
37
+
38
+ ## Output
39
+ ### Haml, Hamlit
40
+ ```html
41
+ <div class='bar foo'></div>
42
+ <div class='bar foo'></div>
43
+ <div class='bar baz foo'></div>
44
+
45
+ ```
46
+
47
+ ### Faml
48
+ ```html
49
+ <div class='bar foo'></div>
50
+ <div class=' bar foo'></div>
51
+ <div class='bar baz foo'></div>
52
+
53
+ ```
54
+
55
+
29
56
  # [old\_attributes\_spec.rb:201](/spec/hamlit/engine/old_attributes_spec.rb#L201)
30
57
  ## Input
31
58
  ```haml
@@ -66,3 +93,103 @@ Faml::Compiler::UnparsableRubyCode: Unparsable Ruby code is given to attributes:
66
93
 
67
94
  ```
68
95
 
96
+
97
+ # [old\_attributes\_spec.rb:226](/spec/hamlit/engine/old_attributes_spec.rb#L226)
98
+ ## Input
99
+ ```haml
100
+ %a{title: "'"}
101
+ %a{title: "'\""}
102
+ %a{href: '/search?foo=bar&hoge=<fuga>'}
103
+
104
+ ```
105
+
106
+ ## Output
107
+ ### Haml
108
+ ```html
109
+ <a title="'"></a>
110
+ <a title='&#x0027;"'></a>
111
+ <a href='/search?foo=bar&amp;hoge=&lt;fuga&gt;'></a>
112
+
113
+ ```
114
+
115
+ ### Faml, Hamlit
116
+ ```html
117
+ <a title='&#39;'></a>
118
+ <a title='&#39;&quot;'></a>
119
+ <a href='/search?foo=bar&amp;hoge=&lt;fuga&gt;'></a>
120
+
121
+ ```
122
+
123
+
124
+ # [old\_attributes\_spec.rb:238](/spec/hamlit/engine/old_attributes_spec.rb#L238)
125
+ ## Input
126
+ ```haml
127
+ - title = "'\""
128
+ - href = '/search?foo=bar&hoge=<fuga>'
129
+ %a{title: title}
130
+ %a{href: href}
131
+
132
+ ```
133
+
134
+ ## Output
135
+ ### Haml
136
+ ```html
137
+ <a title='&#x0027;"'></a>
138
+ <a href='/search?foo=bar&amp;hoge=&lt;fuga&gt;'></a>
139
+
140
+ ```
141
+
142
+ ### Faml, Hamlit
143
+ ```html
144
+ <a title='&#39;&quot;'></a>
145
+ <a href='/search?foo=bar&amp;hoge=&lt;fuga&gt;'></a>
146
+
147
+ ```
148
+
149
+
150
+ # [old\_attributes\_spec.rb:250](/spec/hamlit/engine/old_attributes_spec.rb#L250)
151
+ ## Input
152
+ ```haml
153
+ - title = { title: "'\"" }
154
+ - href = { href: '/search?foo=bar&hoge=<fuga>' }
155
+ %a{ title }
156
+ %a{ href }
157
+
158
+ ```
159
+
160
+ ## Output
161
+ ### Haml
162
+ ```html
163
+ <a title='&#x0027;"'></a>
164
+ <a href='/search?foo=bar&amp;hoge=&lt;fuga&gt;'></a>
165
+
166
+ ```
167
+
168
+ ### Faml, Hamlit
169
+ ```html
170
+ <a title='&#39;&quot;'></a>
171
+ <a href='/search?foo=bar&amp;hoge=&lt;fuga&gt;'></a>
172
+
173
+ ```
174
+
175
+
176
+ # [old\_attributes\_spec.rb:273](/spec/hamlit/engine/old_attributes_spec.rb#L273)
177
+ ## Input
178
+ ```haml
179
+ %span{ data: { disable: true } } bar
180
+
181
+ ```
182
+
183
+ ## Output
184
+ ### Haml, Hamlit
185
+ ```html
186
+ <span data-disable>bar</span>
187
+
188
+ ```
189
+
190
+ ### Faml
191
+ ```html
192
+ <span data-disable='true'>bar</span>
193
+
194
+ ```
195
+
@@ -0,0 +1,97 @@
1
+ # [silent\_script\_spec.rb:79](/spec/hamlit/engine/silent_script_spec.rb#L79)
2
+ ## Input
3
+ ```haml
4
+ %span
5
+ - if false
6
+ - elsif false
7
+
8
+ ```
9
+
10
+ ## Output
11
+ ### Haml, Hamlit
12
+ ```html
13
+ <span>
14
+ </span>
15
+
16
+ ```
17
+
18
+ ### Faml
19
+ ```html
20
+ SyntaxError: (eval):4: syntax error, unexpected end-of-input, expecting keyword_end
21
+ ; _buf << ("</span>\n".freeze); _buf = _buf.join
22
+ ^
23
+ ```
24
+
25
+
26
+ # [silent\_script\_spec.rb:90](/spec/hamlit/engine/silent_script_spec.rb#L90)
27
+ ## Input
28
+ ```haml
29
+ %span
30
+ - if false
31
+ ng
32
+ - else
33
+
34
+ ```
35
+
36
+ ## Output
37
+ ### Haml, Hamlit
38
+ ```html
39
+ <span>
40
+ </span>
41
+
42
+ ```
43
+
44
+ ### Faml
45
+ ```html
46
+ SyntaxError: (eval):5: syntax error, unexpected end-of-input, expecting keyword_end
47
+ ; _buf << ("</span>\n".freeze); _buf = _buf.join
48
+ ^
49
+ ```
50
+
51
+
52
+ # [silent\_script\_spec.rb:102](/spec/hamlit/engine/silent_script_spec.rb#L102)
53
+ ## Input
54
+ ```haml
55
+ %span
56
+ - case
57
+ - when false
58
+
59
+ ```
60
+
61
+ ## Output
62
+ ### Haml, Hamlit
63
+ ```html
64
+ <span>
65
+ </span>
66
+
67
+ ```
68
+
69
+ ### Faml
70
+ ```html
71
+ SyntaxError: (eval):4: syntax error, unexpected end-of-input, expecting keyword_end
72
+ ; _buf << ("</span>\n".freeze); _buf = _buf.join
73
+ ^
74
+ ```
75
+
76
+
77
+ # [silent\_script\_spec.rb:190](/spec/hamlit/engine/silent_script_spec.rb#L190)
78
+ ## Input
79
+ ```haml
80
+ - foo = [',
81
+ ']
82
+ = foo
83
+ ```
84
+
85
+ ## Output
86
+ ### Haml, Hamlit
87
+ ```html
88
+ [&quot;, &quot;]
89
+
90
+ ```
91
+
92
+ ### Faml
93
+ ```html
94
+ [&quot;,\n &quot;]
95
+
96
+ ```
97
+
@@ -0,0 +1,48 @@
1
+ # [tag\_spec.rb:271](/spec/hamlit/engine/tag_spec.rb#L271)
2
+ ## Input
3
+ ```haml
4
+ %div<
5
+ #{'hello'}
6
+ world
7
+
8
+ ```
9
+
10
+ ## Output
11
+ ### Haml
12
+ ```html
13
+ <div>helloworld</div>
14
+
15
+ ```
16
+
17
+ ### Faml, Hamlit
18
+ ```html
19
+ <div>hello
20
+ world</div>
21
+
22
+ ```
23
+
24
+
25
+ # [tag\_spec.rb:282](/spec/hamlit/engine/tag_spec.rb#L282)
26
+ ## Input
27
+ ```haml
28
+ .bar<
29
+ - 1.times do
30
+ = '1'
31
+ = '2'
32
+
33
+ ```
34
+
35
+ ## Output
36
+ ### Haml
37
+ ```html
38
+ <div class='bar'>12</div>
39
+
40
+ ```
41
+
42
+ ### Faml, Hamlit
43
+ ```html
44
+ <div class='bar'>1
45
+ 2</div>
46
+
47
+ ```
48
+
@@ -3,8 +3,10 @@
3
3
  ```haml
4
4
  .
5
5
  .*
6
+ ..
6
7
  #
7
8
  #+
9
+ ##
8
10
 
9
11
  ```
10
12
 
@@ -19,7 +21,9 @@ Haml::SyntaxError: Illegal element: classes and ids must have values.
19
21
  <div></div>
20
22
  <div>*</div>
21
23
  <div></div>
24
+ <div></div>
22
25
  <div>+</div>
26
+ <div></div>
23
27
 
24
28
  ```
25
29
 
@@ -27,13 +31,15 @@ Haml::SyntaxError: Illegal element: classes and ids must have values.
27
31
  ```html
28
32
  .
29
33
  .*
34
+ ..
30
35
  #
31
36
  #+
37
+ ##
32
38
 
33
39
  ```
34
40
 
35
41
 
36
- # [text\_spec.rb:99](/spec/hamlit/engine/text_spec.rb#L99)
42
+ # [text\_spec.rb:118](/spec/hamlit/engine/text_spec.rb#L118)
37
43
  ## Input
38
44
  ```haml
39
45
  &nbsp;