www_app 1.1.0 → 1.2.0

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: fbfdf7458b157b502e9cf03a522b7d3d41883a6e
4
- data.tar.gz: dff3da5abcc509526f77e5b511306c5f113e4a9a
3
+ metadata.gz: 6deb97c603788b103774f666d964e7fdc72ce709
4
+ data.tar.gz: 2020b45f8daffc2db74fbc1706cc403d8c0292d7
5
5
  SHA512:
6
- metadata.gz: 938a2941e13c3912b4a9b6603d47fc77f0ac0e4b7c8813f66f27ad07392db2e00e66187e23bb6c02c6e9644ad4ec6ea244651b053800ec68e8ae520e7a18c4bf
7
- data.tar.gz: 1580b1995dca04033a640ceee1131b328d086b525e3bdd1f681f57d45b9e992c2be756a7b9a7de466b7b8a8681049b124229b76d5557d279b18fffaf52913145
6
+ metadata.gz: 1644de2510fdd6caaf1a883b905667c6ea229184d9e0bb2ee585041acafb53073a4ecb46bc7c81a25b7432f8ce89b1e4a5b5f7ec0156d925f366f597c35fb67a
7
+ data.tar.gz: 87aa38768884fd6181df7606c5490cdeaaba8310f0acb7002bbd7503e9cccd946ab2af7545efb4e92c6751e095598b62ba65c431edd5d454820f4bf71ddee91b
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
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
- (tag![:text] = results) if results.is_a?(::String) || results.is_a?(::Symbol)
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
- h[:text].to_mustache(:html) :
924
- Sanitize.html(h[:text].strip)
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.1.0
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: