www_app 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/www_app.rb +17 -4
- data/specs/server-side/0060-string.rb +22 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6deb97c603788b103774f666d964e7fdc72ce709
|
4
|
+
data.tar.gz: 2020b45f8daffc2db74fbc1706cc403d8c0292d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1644de2510fdd6caaf1a883b905667c6ea229184d9e0bb2ee585041acafb53073a4ecb46bc7c81a25b7432f8ce89b1e4a5b5f7ec0156d925f366f597c35fb67a
|
7
|
+
data.tar.gz: 87aa38768884fd6181df7606c5490cdeaaba8310f0acb7002bbd7503e9cccd946ab2af7545efb4e92c6751e095598b62ba65c431edd5d454820f4bf71ddee91b
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.2.0
|
data/lib/www_app.rb
CHANGED
@@ -709,7 +709,10 @@ class WWW_App < BasicObject
|
|
709
709
|
if tag?(:form)
|
710
710
|
input(:hidden, :auth_token, :auth_token.to_mustache(:html))
|
711
711
|
end
|
712
|
-
|
712
|
+
|
713
|
+
if (results.is_a?(::Hash) && results[:type] == :string) || results.is_a?(::String) || results.is_a?(::Symbol)
|
714
|
+
tag![:text] = results
|
715
|
+
end
|
713
716
|
}
|
714
717
|
end
|
715
718
|
|
@@ -919,9 +922,19 @@ class WWW_App < BasicObject
|
|
919
922
|
return unless h[:render?]
|
920
923
|
|
921
924
|
if html.empty? && h[:text]
|
922
|
-
html = h[:text].is_a?(::Symbol)
|
923
|
-
|
924
|
-
|
925
|
+
html = if h[:text].is_a?(::Symbol)
|
926
|
+
h[:text].to_mustache(:html)
|
927
|
+
else
|
928
|
+
if h[:text].is_a?(::Hash)
|
929
|
+
if h[:text][:escape] == false
|
930
|
+
h[:text][:value]
|
931
|
+
else
|
932
|
+
Sanitize.html(h[:text][:value].strip)
|
933
|
+
end
|
934
|
+
else
|
935
|
+
Sanitize.html(h[:text].strip)
|
936
|
+
end
|
937
|
+
end
|
925
938
|
end # === if html.empty?
|
926
939
|
|
927
940
|
(html = nil) if html.empty?
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
describe "string content" do
|
3
|
+
|
4
|
+
it "prints a string if value is a hash: {:type=>:string, ...}" do
|
5
|
+
target :body, %^<p>string</p>^
|
6
|
+
actual do
|
7
|
+
p {
|
8
|
+
{:type=>:string, :escape=>true, :value=>"string"}
|
9
|
+
}
|
10
|
+
end
|
11
|
+
end # === it prints a string if value is a hash: {:type=>:string, ...}
|
12
|
+
|
13
|
+
it "does not escape string if: {:type=>:string, :escape=>false...}" do
|
14
|
+
target :body, %^<p>string & string</p>^
|
15
|
+
actual do
|
16
|
+
p {
|
17
|
+
{:type=>:string, :escape=>false, :value=>"string & string"}
|
18
|
+
}
|
19
|
+
end
|
20
|
+
end # === it prints a string if value is a hash: {:type=>:string, ...}
|
21
|
+
|
22
|
+
end # === describe "string content"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: www_app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- da99
|
@@ -243,6 +243,7 @@ files:
|
|
243
243
|
- specs/server-side/0040-css.rb
|
244
244
|
- specs/server-side/0041-font_family.rb
|
245
245
|
- specs/server-side/0050-on.rb
|
246
|
+
- specs/server-side/0060-string.rb
|
246
247
|
- www_app.gemspec
|
247
248
|
homepage: https://github.com/da99/www_app
|
248
249
|
licenses:
|