www_app 2.1.3 → 2.3.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 +4 -4
- data/VERSION +1 -1
- data/lib/www_app/HTML.rb +6 -1
- data/lib/www_app/TO.rb +4 -1
- data/specs/server-side/0021-form.rb +15 -0
- data/specs/server-side/0021-title.rb +9 -0
- data/specs/server-side/0040-css.rb +19 -6
- data/specs/server-side/0070-heading_tags.rb +26 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ba6234504f5f7340da85bfe01588b2ab29d0454
|
4
|
+
data.tar.gz: a3aa5263e6e9f66957d1b3592af6bb5488f72297
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6989163602f3504521c582dd448cdf1c9f83c166ce1dc714c3540116bc2e746167a90ea5dde63ad26d54bc0cefd111bf0354406dc616e72b4259cf809a6a4db8
|
7
|
+
data.tar.gz: d8e942a86c8c0575f4636f34225600a20a4adad332db21d1ad584806da199b9b68fede2abe830fb2c70308242722b39219645dff1c9534497d264724c99558bf
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.3.0
|
data/lib/www_app/HTML.rb
CHANGED
@@ -9,6 +9,8 @@ class WWW_App
|
|
9
9
|
title
|
10
10
|
body div span
|
11
11
|
|
12
|
+
h1 h2 h3 h4 h5 h6
|
13
|
+
|
12
14
|
img
|
13
15
|
b em i strong u a
|
14
16
|
abbr blockquote cite
|
@@ -19,6 +21,8 @@ class WWW_App
|
|
19
21
|
|
20
22
|
link
|
21
23
|
|
24
|
+
label
|
25
|
+
|
22
26
|
script
|
23
27
|
].map(&:to_sym)
|
24
28
|
|
@@ -28,6 +32,7 @@ class WWW_App
|
|
28
32
|
:form => [:action, :method, :accept_charset],
|
29
33
|
:input => [:type, :name, :value],
|
30
34
|
:style => [:type],
|
35
|
+
:label => [:for],
|
31
36
|
:script => [:type, :src, :language],
|
32
37
|
:link => [:rel, :type, :sizes, :href, :title],
|
33
38
|
:meta => [:name, :http_equiv, :property, :content, :charset],
|
@@ -90,7 +95,7 @@ class WWW_App
|
|
90
95
|
def title str = :none
|
91
96
|
fail ":title not allowed here" if parent
|
92
97
|
if !block_given? && str != :none
|
93
|
-
create { text str }
|
98
|
+
create(:title) { text str }
|
94
99
|
else
|
95
100
|
create :title do
|
96
101
|
yield
|
data/lib/www_app/TO.rb
CHANGED
@@ -355,6 +355,9 @@ class WWW_App
|
|
355
355
|
when tag_name == :style && attr == :type
|
356
356
|
'text/css'
|
357
357
|
|
358
|
+
when tag_name == :label && attr == :for && val.is_a?(::Symbol)
|
359
|
+
Clean.html(val.to_s)
|
360
|
+
|
358
361
|
when ::WWW_App::HTML::TAGS_TO_ATTRIBUTES[tag_name].include?(attr)
|
359
362
|
Clean.html(val)
|
360
363
|
|
@@ -600,7 +603,7 @@ class WWW_App
|
|
600
603
|
end
|
601
604
|
|
602
605
|
when ::WWW_App::CSS::PROPERTIES.include?(raw_k)
|
603
|
-
Clean.
|
606
|
+
Clean.css raw_k, raw_val
|
604
607
|
|
605
608
|
else
|
606
609
|
fail "Invalid css attr: #{name.inspect}"
|
@@ -18,5 +18,20 @@ describe :forms do
|
|
18
18
|
}.message.should.match /google.com/
|
19
19
|
end
|
20
20
|
|
21
|
+
|
22
|
+
describe :label do
|
23
|
+
|
24
|
+
it "allows :for attribute" do
|
25
|
+
target :body, <<-EOF
|
26
|
+
<label for="me">Title</label>
|
27
|
+
EOF
|
28
|
+
actual {
|
29
|
+
label.for(:me) { 'Title' }
|
30
|
+
}
|
31
|
+
end # === it allows :for attribute
|
32
|
+
|
33
|
+
end # === describe :label
|
34
|
+
|
21
35
|
end # === describe :forms ===
|
22
36
|
|
37
|
+
|
@@ -10,4 +10,13 @@ describe "page_title" do
|
|
10
10
|
should == ['<title>yo</title>']
|
11
11
|
end # === it creates on :title tag
|
12
12
|
|
13
|
+
it "accepts a String argument" do
|
14
|
+
html = WWW_App.new {
|
15
|
+
title 'yo yo string'
|
16
|
+
}.to_html
|
17
|
+
|
18
|
+
html.scan(/<title>[^>]+<\/title>/).
|
19
|
+
should == ['<title>yo yo string</title>']
|
20
|
+
end # === it accepts a String argument
|
21
|
+
|
13
22
|
end # === describe "page_title"
|
@@ -12,8 +12,8 @@ describe :css do
|
|
12
12
|
}.message.should.match /hi;o/
|
13
13
|
end
|
14
14
|
|
15
|
-
it "raises
|
16
|
-
should.raise(
|
15
|
+
it "raises ArgumentError if css value has invalid chars: something *" do
|
16
|
+
should.raise(ArgumentError) {
|
17
17
|
actual do
|
18
18
|
div {
|
19
19
|
background 'something *'
|
@@ -30,8 +30,8 @@ describe :css do
|
|
30
30
|
}.message.should.match /s\*s/
|
31
31
|
end
|
32
32
|
|
33
|
-
it "raises
|
34
|
-
should.raise(
|
33
|
+
it "raises ArgumentError if contains 'expression:'" do
|
34
|
+
should.raise(ArgumentError) {
|
35
35
|
actual do
|
36
36
|
div {
|
37
37
|
background 'solid expression:'
|
@@ -40,8 +40,8 @@ describe :css do
|
|
40
40
|
}.message.should.match /expression:/
|
41
41
|
end
|
42
42
|
|
43
|
-
it "raises
|
44
|
-
should.raise(
|
43
|
+
it "raises ArgumentError if contains 'expression&'" do
|
44
|
+
should.raise(ArgumentError) {
|
45
45
|
actual do
|
46
46
|
div {
|
47
47
|
background 'solid expression&'
|
@@ -169,6 +169,19 @@ describe :css do
|
|
169
169
|
}
|
170
170
|
end
|
171
171
|
|
172
|
+
it "turns numbers into strings" do
|
173
|
+
target :style, %^
|
174
|
+
div {
|
175
|
+
margin: 0;
|
176
|
+
}
|
177
|
+
^
|
178
|
+
actual {
|
179
|
+
div {
|
180
|
+
margin 0
|
181
|
+
}
|
182
|
+
}
|
183
|
+
end # === it turns numbers into strings
|
184
|
+
|
172
185
|
end # === sanitize css selectors
|
173
186
|
|
174
187
|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
describe :heading_tags do
|
3
|
+
|
4
|
+
[:h1, :h2, :h3, :h4].each { |meth|
|
5
|
+
it "renders a :#{meth} tag" do
|
6
|
+
target :body, <<-EOF
|
7
|
+
<#{meth}>Title</#{meth}>
|
8
|
+
EOF
|
9
|
+
|
10
|
+
actual {
|
11
|
+
send(meth) { 'Title' }
|
12
|
+
}
|
13
|
+
end # === it renders a .... tag
|
14
|
+
|
15
|
+
it "accepts a String argument" do
|
16
|
+
target :body, <<-EOF
|
17
|
+
<#{meth}>Title Title</#{meth}>
|
18
|
+
EOF
|
19
|
+
|
20
|
+
actual {
|
21
|
+
send(meth, 'Title Title')
|
22
|
+
}
|
23
|
+
end # === it accepts a String argument
|
24
|
+
}
|
25
|
+
|
26
|
+
end # === describe :heading_tags
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: www_app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- da99
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yajl-ruby
|
@@ -250,6 +250,7 @@ files:
|
|
250
250
|
- specs/server-side/0042-slash.rb
|
251
251
|
- specs/server-side/0050-use.rb
|
252
252
|
- specs/server-side/0060-text.rb
|
253
|
+
- specs/server-side/0070-heading_tags.rb
|
253
254
|
- www_app.gemspec
|
254
255
|
homepage: https://github.com/da99/www_app
|
255
256
|
licenses:
|
@@ -271,7 +272,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
271
272
|
version: '0'
|
272
273
|
requirements: []
|
273
274
|
rubyforge_project:
|
274
|
-
rubygems_version: 2.4.
|
275
|
+
rubygems_version: 2.4.6
|
275
276
|
signing_key:
|
276
277
|
specification_version: 4
|
277
278
|
summary: Ruby -> HTML/CSS/JS
|