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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50ca5880135de7cd06fcf6780fc4dbaffbf6ea43
|
4
|
+
data.tar.gz: 804e0196607cf692780d87ed61f6895391584cc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be851f631b5d947500998063fa534d791c551e0c4bf21a12ae844919ac0dc8124906d397a4f905d484c1149c305d18719e1c02fae88ed2633c277eda2d84bbef
|
7
|
+
data.tar.gz: 722440d70b6da6048b9231f1094b6cdce48a7b7da00193b43ba125d4435a621df2b27344d54a97ac02b07bc28721215cf3332a14548a1b7c683e23f0f04e1db2
|
data/CHANGELOG.md
CHANGED
data/lib/hamlit/helpers.rb
CHANGED
@@ -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
|
data/lib/hamlit/version.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
= raw find_and_preserve "Foo\n<pre>Bar\nBaz</pre>"
|
2
2
|
|
3
|
-
= succeed '
|
4
|
-
succeed
|
3
|
+
= succeed '&' do
|
4
|
+
%i succeed
|
5
5
|
|
6
|
-
= precede '
|
7
|
-
precede
|
6
|
+
= precede '&' do
|
7
|
+
%i precede
|
8
8
|
|
9
|
-
= surround '
|
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>&')
|
111
111
|
end
|
112
112
|
|
113
113
|
it 'renders precede' do
|
114
114
|
get helpers_users_path
|
115
|
-
expect(response.body).to include('
|
115
|
+
expect(response.body).to include('&<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('
|
120
|
+
expect(response.body).to include('<<i>surround</i>>')
|
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.
|
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-
|
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:
|