hamlit 1.5.1 → 1.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1c8ab979e9c67463e76b46cba08d35e24ead7a1f
4
- data.tar.gz: 4e162fbcb66071f515a64b97ac7d540fddd81042
3
+ metadata.gz: 79bcf89bde702278c1bdad3ee833aec2e94eb58a
4
+ data.tar.gz: d58885a682edc39e69a4027c4e0834f5d679a9e2
5
5
  SHA512:
6
- metadata.gz: 9cdf077dc864d24d4bf71b4f17d5830d15f9cc940468ea26dbb7ba87932a249cd0ea764b51614d76cbf21b1ee0f413f8e6f48e4facafbceac37b851e299480ab
7
- data.tar.gz: 0da6132ea58a728dd16ec662223328e46661844c3e02f61ff20608850902eb1af9bbce96bc86dad6fd7957628127aa6747843c10da67ecd2dfcfa2e99e935e50
6
+ metadata.gz: 44fd92f92e8752ed72e56e0d46a5eae2ee69aa12175476f7fa39c8423c86a730522a471b9d9664d2f2ec43cf59108951c284209cae49b24255a134ed9962d7ba
7
+ data.tar.gz: 6f20ddab502046ca46ab6fe61d8c04a8655f72ed917e1e51470ed2e26715491269100ba3c3125482a2215800ac919325e2c96c38cc50dba32e7d52e524c4a0f5
@@ -1,3 +1,7 @@
1
+ ## v1.5.2
2
+
3
+ - Disable html escaping in CSS and JavaScript filter
4
+
1
5
  ## v1.5.1
2
6
 
3
7
  - Remove outer whitespace in the block
@@ -12,7 +12,7 @@ module Hamlit
12
12
  private
13
13
 
14
14
  def compile_html(lines)
15
- ast = [:haml, :text, compile_lines(lines, indent_width: 2)]
15
+ ast = [:haml, :text, compile_lines(lines, indent_width: 2), false]
16
16
  ast = [:multi, [:static, "\n"], ast]
17
17
  ast = [:html, :tag, 'style', [:html, :attrs], ast]
18
18
  ast
@@ -12,7 +12,7 @@ module Hamlit
12
12
  private
13
13
 
14
14
  def compile_html(lines)
15
- ast = [:haml, :text, compile_lines(lines, indent_width: 2)]
15
+ ast = [:haml, :text, compile_lines(lines, indent_width: 2), false]
16
16
  ast = [:multi, [:static, "\n"], ast]
17
17
  ast = [:html, :tag, 'script', [:html, :attrs], ast]
18
18
  ast
@@ -1,3 +1,3 @@
1
1
  module Hamlit
2
- VERSION = "1.5.1"
2
+ VERSION = "1.5.2"
3
3
  end
@@ -37,5 +37,24 @@ describe Hamlit::Filters::Coffee do
37
37
  </script>
38
38
  HTML
39
39
  end
40
+
41
+ it 'renders coffeescript filter' do
42
+ assert_render(<<-'HAML', <<-HTML)
43
+ :coffee
44
+ foo = ->
45
+ alert("#{'<&>'}")
46
+ HAML
47
+ <script>
48
+ (function() {
49
+ var foo;
50
+
51
+ foo = function() {
52
+ return alert("<&>");
53
+ };
54
+
55
+ }).call(this);
56
+ </script>
57
+ HTML
58
+ end
40
59
  end
41
60
  end
@@ -19,12 +19,12 @@ describe Hamlit::Filters::Css do
19
19
  assert_render(<<-'HAML', <<-HTML)
20
20
  :css
21
21
  .foo {
22
- width: #{100 * 3}px;
22
+ content: "#{'<&>'}";
23
23
  }
24
24
  HAML
25
25
  <style>
26
26
  .foo {
27
- width: 300px;
27
+ content: "<&>";
28
28
  }
29
29
  </style>
30
30
  HTML
@@ -71,10 +71,10 @@ describe Hamlit::Filters::Javascript do
71
71
  it 'parses string interpolation' do
72
72
  assert_render(<<-'HAML', <<-HTML)
73
73
  :javascript
74
- var a = #{[1, 2]};
74
+ var a = "#{'<&>'}";
75
75
  HAML
76
76
  <script>
77
- var a = [1, 2];
77
+ var a = "<&>";
78
78
  </script>
79
79
  HTML
80
80
  end
@@ -18,5 +18,20 @@ describe Hamlit::Filters::Less do
18
18
  </style>
19
19
  HTML
20
20
  end
21
+
22
+ it 'parses string interpolation' do
23
+ assert_render(<<-'HAML', <<-HTML)
24
+ :less
25
+ .foo {
26
+ content: "#{'<&>'}";
27
+ }
28
+ HAML
29
+ <style>
30
+ .foo {
31
+ content: "<&>";
32
+ }
33
+ </style>
34
+ HTML
35
+ end
21
36
  end
22
37
  end
@@ -14,14 +14,16 @@ describe Hamlit::Filters::Markdown do
14
14
 
15
15
  it 'renders markdown filter with string interpolation' do
16
16
  assert_render(<<-'HAML', <<-HTML)
17
- - project = 'Hamlit'
17
+ - project = '<Hamlit>'
18
18
  :markdown
19
19
  # #{project}
20
+ #{'<&>'}
20
21
  Yet another haml implementation
21
22
  HAML
22
- <h1>Hamlit</h1>
23
+ <h1><Hamlit></h1>
23
24
 
24
- <p>Yet another haml implementation</p>
25
+ <p>&lt;&amp;&gt;
26
+ Yet another haml implementation</p>
25
27
  HTML
26
28
  end
27
29
  end
@@ -11,14 +11,14 @@ describe Hamlit::Filters::Ruby do
11
11
  end
12
12
 
13
13
  it 'renders ruby filter' do
14
- assert_render(<<-HAML, <<-HTML)
14
+ assert_render(<<-'HAML', <<-HTML)
15
15
  :ruby
16
16
  hash = {
17
- a: 3,
17
+ a: "#{'<&>'}",
18
18
  }
19
19
  = hash[:a]
20
20
  HAML
21
- 3
21
+ &lt;&amp;&gt;
22
22
  HTML
23
23
  end
24
24
  end
@@ -18,18 +18,14 @@ describe Hamlit::Filters::Sass do
18
18
 
19
19
  it 'renders sass filter with string interpolation' do
20
20
  assert_render(<<-'HAML', <<-HTML)
21
- - width = 1200
22
- - height = 800
23
21
  :sass
24
22
  .users_controller
25
23
  .show_action
26
- width: #{width}px
27
- height: #{height}px
24
+ content: "#{'<&>'}"
28
25
  HAML
29
26
  <style>
30
27
  .users_controller .show_action {
31
- width: 1200px;
32
- height: 800px; }
28
+ content: "<&>"; }
33
29
  </style>
34
30
  HTML
35
31
  end
@@ -17,5 +17,21 @@ describe Hamlit::Filters::Scss do
17
17
  </style>
18
18
  HTML
19
19
  end
20
+
21
+ it 'parses string interpolation' do
22
+ assert_render(<<-'HAML', <<-HTML)
23
+ :scss
24
+ .users_controller {
25
+ .show_action {
26
+ content: "#{'<&>'}";
27
+ }
28
+ }
29
+ HAML
30
+ <style>
31
+ .users_controller .show_action {
32
+ content: "<&>"; }
33
+ </style>
34
+ HTML
35
+ end
20
36
  end
21
37
  end
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: 1.5.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-04 00:00:00.000000000 Z
11
+ date: 2015-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: escape_utils