hamlit 1.1.1 → 1.2.0

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: e9ce534073d7cc2af36877f5d26bb82cf1b40b0f
4
- data.tar.gz: ecbdaf0584cb9ad467f8b2a04fc4fafced55f4be
3
+ metadata.gz: cdb6bb5d76732c00209e63f4e24e651ce7f3d615
4
+ data.tar.gz: c4e4eacaa487b2629a80416f9b79d213309a3ec7
5
5
  SHA512:
6
- metadata.gz: 639dbaf1d5d58e62a6d655bd20255b49fa79449f68075a56d316eb231cb26353186ff9a9095411ad9beb7b914b3fc6ce4091103dc02004e76c759009b496ee93
7
- data.tar.gz: 4ab3cb79b4419e6b48a3008222a910234c89e8a0d60e68f2c97269cd3d6b2da2f8d5d83a100f8d8ecee945529d0e1494f6f66f6e2b75df90570f3ae6f3d27c4f
6
+ metadata.gz: 3b93143bdc0a7eda79e9f1d3ae2d86406b410c813e4c42e841b116a2d9e785492592726e375dd01a0afb8ac7481bbdf13c8c6bf0d8871ad34a93b38112bab861
7
+ data.tar.gz: 56ac9ee8f5822e8976f5f163f2467a929fd54ca0788a39193b7ede3fc44ceb527e07a7cf0396fcc74d345eb8d2319c11fb637eeb2e28c7a5fa1128faf995bd5a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## v1.2.0
2
+
3
+ - Support `succeed`, `precede` and `surround`
4
+ - https://github.com/k0kubun/hamlit/issues/22
5
+ - Thanks to @sneakernets
6
+
1
7
  ## v1.1.1
2
8
 
3
9
  - Bugfix of rendering array attributes
@@ -29,6 +29,20 @@ module Hamlit
29
29
  s
30
30
  end
31
31
 
32
+ def surround(front, back = front, &block)
33
+ output = capture_haml(&block)
34
+
35
+ "#{front}#{output.chomp}#{back}\n"
36
+ end
37
+
38
+ def precede(str, &block)
39
+ "#{str}#{capture_haml(&block).chomp}\n"
40
+ end
41
+
42
+ def succeed(str, &block)
43
+ "#{capture_haml(&block).chomp}#{str}\n"
44
+ end
45
+
32
46
  # NOTE: currently Hamlit::Helpers is enabled by default on only
33
47
  # Rails environment. Thus you can use capture.
34
48
  def capture_haml(*args, &block)
@@ -1,3 +1,3 @@
1
1
  module Hamlit
2
- VERSION = "1.1.1"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -1 +1,10 @@
1
1
  = raw find_and_preserve "Foo\n<pre>Bar\nBaz</pre>"
2
+
3
+ = succeed '.' do
4
+ succeed
5
+
6
+ = precede ',' do
7
+ precede
8
+
9
+ = surround '[', ']' do
10
+ surround
@@ -92,5 +92,20 @@ describe 'Hamlit rails integration', type: :request do
92
92
  </div>
93
93
  HTML
94
94
  end
95
+
96
+ it 'renders succeed' do
97
+ get helpers_users_path
98
+ expect(response.body).to include('succeed.')
99
+ end
100
+
101
+ it 'renders precede' do
102
+ get helpers_users_path
103
+ expect(response.body).to include(',precede')
104
+ end
105
+
106
+ it 'renders surround' do
107
+ get helpers_users_path
108
+ expect(response.body).to include('[surround]')
109
+ end
95
110
  end
96
111
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hamlit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun