hamlit 1.7.0 → 1.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ca12e0120f1176a67b7f89077b8f00b832cafe16
4
- data.tar.gz: fe98fcc635527e47b22441eadb3409bbd4c5864e
3
+ metadata.gz: 50ca5880135de7cd06fcf6780fc4dbaffbf6ea43
4
+ data.tar.gz: 804e0196607cf692780d87ed61f6895391584cc1
5
5
  SHA512:
6
- metadata.gz: f233e410357f3812775992bcfc6da6bfc27f6ed2b4153f60f050c34df4221084711da794ca22da329ae4665d43a2c9d1f700528038381bbd5ab56d9959b5658f
7
- data.tar.gz: 200d020c6ed62d628aeeb03634b71f842f9d5ff245a4a6205b820b5293124fd622a766e843371fd7755096c185d8962c226463ffa796525cc354405aa18684d0
6
+ metadata.gz: be851f631b5d947500998063fa534d791c551e0c4bf21a12ae844919ac0dc8124906d397a4f905d484c1149c305d18719e1c02fae88ed2633c277eda2d84bbef
7
+ data.tar.gz: 722440d70b6da6048b9231f1094b6cdce48a7b7da00193b43ba125d4435a621df2b27344d54a97ac02b07bc28721215cf3332a14548a1b7c683e23f0f04e1db2
@@ -1,3 +1,9 @@
1
+ ## v1.7.1
2
+
3
+ - Don't escape a block content of some helpers
4
+ - https://github.com/k0kubun/hamlit/issues/35
5
+ - Thanks to @felixbuenemann
6
+
1
7
  ## v1.7.0
2
8
 
3
9
  - Support Ruby 2.2.0 hash syntax
@@ -1,5 +1,10 @@
1
1
  # This is a module compatible with Haml::Helpers.
2
2
  # It is included by ActionView in initializer.
3
+ #
4
+ # NOTE: currently Hamlit::Helpers is enabled by default
5
+ # on only Rails environment.
6
+ # And currently this Hamlit::Helpers depends on
7
+ # ActionView internal implementation. (not desired)
3
8
  module Hamlit
4
9
  module Helpers
5
10
  extend self
@@ -32,19 +37,17 @@ module Hamlit
32
37
  def surround(front, back = front, &block)
33
38
  output = capture_haml(&block)
34
39
 
35
- "#{front}#{output.chomp}#{back}\n"
40
+ "#{escape_once(front)}#{output.chomp}#{escape_once(back)}\n".html_safe
36
41
  end
37
42
 
38
43
  def precede(str, &block)
39
- "#{str}#{capture_haml(&block).chomp}\n"
44
+ "#{escape_once(str)}#{capture_haml(&block).chomp}\n".html_safe
40
45
  end
41
46
 
42
47
  def succeed(str, &block)
43
- "#{capture_haml(&block).chomp}#{str}\n"
48
+ "#{capture_haml(&block).chomp}#{escape_once(str)}\n".html_safe
44
49
  end
45
50
 
46
- # NOTE: currently Hamlit::Helpers is enabled by default on only
47
- # Rails environment. Thus you can use capture.
48
51
  def capture_haml(*args, &block)
49
52
  capture(*args, &block)
50
53
  end
@@ -1,3 +1,3 @@
1
1
  module Hamlit
2
- VERSION = "1.7.0"
2
+ VERSION = "1.7.1"
3
3
  end
@@ -1,3 +1,6 @@
1
+ = surround '(', ')' do
2
+ %i foo
3
+
1
4
  %span Hamlit
2
5
 
3
6
  %table
@@ -1,10 +1,10 @@
1
1
  = raw find_and_preserve "Foo\n<pre>Bar\nBaz</pre>"
2
2
 
3
- = succeed '.' do
4
- succeed
3
+ = succeed '&' do
4
+ %i succeed
5
5
 
6
- = precede ',' do
7
- precede
6
+ = precede '&' do
7
+ %i precede
8
8
 
9
- = surround '[', ']' do
10
- surround
9
+ = surround '<', '>' do
10
+ %i surround
@@ -107,17 +107,17 @@ describe 'Hamlit rails integration', type: :request do
107
107
 
108
108
  it 'renders succeed' do
109
109
  get helpers_users_path
110
- expect(response.body).to include('succeed.')
110
+ expect(response.body).to include('<i>succeed</i>&amp;')
111
111
  end
112
112
 
113
113
  it 'renders precede' do
114
114
  get helpers_users_path
115
- expect(response.body).to include(',precede')
115
+ expect(response.body).to include('&amp;<i>precede</i>')
116
116
  end
117
117
 
118
118
  it 'renders surround' do
119
119
  get helpers_users_path
120
- expect(response.body).to include('[surround]')
120
+ expect(response.body).to include('&lt;<i>surround</i>&gt;')
121
121
  end
122
122
  end
123
123
  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.7.0
4
+ version: 1.7.1
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-07-09 00:00:00.000000000 Z
11
+ date: 2015-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: escape_utils
@@ -626,3 +626,4 @@ test_files:
626
626
  - spec/spec_helper/document_generator.rb
627
627
  - spec/spec_helper/render_helper.rb
628
628
  - spec/spec_helper/test_case.rb
629
+ has_rdoc: