deklarativna 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -3
- data/VERSION +1 -1
- data/deklarativna.gemspec +2 -2
- data/test/test_deklarativna.rb +39 -92
- metadata +17 -17
data/README.md
CHANGED
@@ -13,9 +13,8 @@ This is a work in progress and *I hope* someday will have integration
|
|
13
13
|
with the most popular web frameworks
|
14
14
|
|
15
15
|
##Current Status
|
16
|
-
All *HTML* common tags are implemented
|
17
|
-
|
18
|
-
Support for *XML* tags with *xml_single_tag* and *xml_double_tag*
|
16
|
+
All *HTML* common tags are implemented.
|
17
|
+
Full support for *XML* tags with *xml_single_tag* and *xml_double_tag*
|
19
18
|
is added.
|
20
19
|
|
21
20
|
### Updates
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.10
|
data/deklarativna.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "deklarativna"
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.10"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["David Litvak"]
|
12
|
-
s.date = "2012-01-
|
12
|
+
s.date = "2012-01-27"
|
13
13
|
s.description = "A Declarative HTML embedded DSL for HTML/XML Templating in Ruby,\n This gem was intended to be use as teaching material for universitary students."
|
14
14
|
s.email = "david.litvakb@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
data/test/test_deklarativna.rb
CHANGED
@@ -4,102 +4,43 @@ require 'deklarativna'
|
|
4
4
|
class DeklarativnaTest < Test::Unit::TestCase
|
5
5
|
include Deklarativna
|
6
6
|
|
7
|
+
def assert_double_tag tag_name_symbol
|
8
|
+
assert_equal "<#{tag_name_symbol.id2name}></#{tag_name_symbol.id2name}>",
|
9
|
+
(self.method tag_name_symbol).call
|
10
|
+
end
|
11
|
+
|
12
|
+
def assert_single_tag tag_name_symbol
|
13
|
+
assert_equal "<#{tag_name_symbol.id2name} />",
|
14
|
+
(self.method tag_name_symbol).call
|
15
|
+
end
|
16
|
+
|
7
17
|
def test_html_renders_single_element
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
18
|
+
double_tag_renderables = [:html, :head, :title, :script, :style, :body,
|
19
|
+
:header, :footer, :h1, :h2, :h3, :h4, :h5, :h6,
|
20
|
+
:p, :div, :span, :table, :tr, :td, :ul, :ol, :li,
|
21
|
+
:a, :form, :textarea, :center, :dd, :dl, :dt, :i,
|
22
|
+
:b, :em, :strong, :pre, :select, :option,
|
23
|
+
:article, :section, :code, :abbr, :acronym,
|
24
|
+
:address, :bdo, :big, :tt, :small, :blockquote,
|
25
|
+
:button, :caption, :dfn, :cite, :code, :samp,
|
26
|
+
:kbd, :var, :colgroup, :del, :ins, :dir,
|
27
|
+
:fieldset, :legend, :frameset, :iframe,
|
28
|
+
:noframes, :noscript, :object, :optgroup,
|
29
|
+
:q, :sub, :sup, :thead, :tfoot, :tbody]
|
30
|
+
double_tag_renderables.each { |e| assert_double_tag e }
|
31
|
+
|
14
32
|
assert_equal "<script type=\"text/javascript\"></script>", javascript
|
15
|
-
assert_equal "<style></style>", style
|
16
33
|
assert_equal "<style type=\"text/css\"></style>", css
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
assert_equal "<h3></h3>", h3
|
23
|
-
assert_equal "<h4></h4>", h4
|
24
|
-
assert_equal "<h5></h5>", h5
|
25
|
-
assert_equal "<h6></h6>", h6
|
26
|
-
assert_equal "<p></p>", p
|
27
|
-
assert_equal "<div></div>", div
|
28
|
-
assert_equal "<span></span>", span
|
29
|
-
assert_equal "<table></table>", table
|
30
|
-
assert_equal "<tr></tr>", tr
|
31
|
-
assert_equal "<td></td>", td
|
32
|
-
assert_equal "<ul></ul>", ul
|
33
|
-
assert_equal "<ol></ol>", ol
|
34
|
-
assert_equal "<li></li>", li
|
35
|
-
assert_equal "<a></a>", a
|
36
|
-
assert_equal "<form></form>", form
|
37
|
-
assert_equal "<input />", input
|
34
|
+
|
35
|
+
single_tag_renderables = [:br, :hr, :img, :base, :input, :col, :frame,
|
36
|
+
:param, :link, :meta]
|
37
|
+
single_tag_renderables.each { |e| assert_single_tag e }
|
38
|
+
|
38
39
|
assert_equal "<input type=\"text\" />", text
|
39
40
|
assert_equal "<input type=\"password\" />", password
|
40
41
|
assert_equal "<input type=\"radio\" />", radio
|
41
42
|
assert_equal "<input type=\"checkbox\" />", checkbox
|
42
|
-
assert_equal "<textarea></textarea>", textarea
|
43
43
|
assert_equal "<input type=\"submit\" />", submit
|
44
|
-
assert_equal "<center></center>", center
|
45
|
-
assert_equal "<dd></dd>", dd
|
46
|
-
assert_equal "<dl></dl>", dl
|
47
|
-
assert_equal "<dt></dt>", dt
|
48
|
-
assert_equal "<i></i>", i
|
49
|
-
assert_equal "<b></b>", b
|
50
|
-
assert_equal "<em></em>", em
|
51
|
-
assert_equal "<strong></strong>", strong
|
52
|
-
assert_equal "<pre></pre>", pre
|
53
|
-
assert_equal "<select></select>", select
|
54
|
-
assert_equal "<option></option>", option
|
55
|
-
assert_equal "<article></article>", article
|
56
|
-
assert_equal "<section></section>", section
|
57
|
-
assert_equal "<code></code>", code
|
58
|
-
assert_equal "<abbr></abbr>", abbr
|
59
|
-
assert_equal "<acronym></acronym>", acronym
|
60
|
-
assert_equal "<address></address>", address
|
61
|
-
assert_equal "<bdo></bdo>", bdo
|
62
|
-
assert_equal "<big></big>", big
|
63
|
-
assert_equal "<tt></tt>", tt
|
64
|
-
assert_equal "<small></small>", small
|
65
|
-
assert_equal "<blockquote></blockquote>", blockquote
|
66
|
-
assert_equal "<button></button>", button
|
67
|
-
assert_equal "<caption></caption>", caption
|
68
|
-
assert_equal "<dfn></dfn>", dfn
|
69
|
-
assert_equal "<cite></cite>", cite
|
70
|
-
assert_equal "<code></code>", code
|
71
|
-
assert_equal "<samp></samp>", samp
|
72
|
-
assert_equal "<kbd></kbd>", kbd
|
73
|
-
assert_equal "<var></var>", var
|
74
|
-
assert_equal "<colgroup></colgroup>", colgroup
|
75
|
-
assert_equal "<del></del>", del
|
76
|
-
assert_equal "<ins></ins>", ins
|
77
|
-
assert_equal "<dir></dir>", dir
|
78
|
-
assert_equal "<fieldset></fieldset>", fieldset
|
79
|
-
assert_equal "<legend></legend>", legend
|
80
|
-
assert_equal "<frameset></frameset>", frameset
|
81
|
-
assert_equal "<iframe></iframe>", iframe
|
82
|
-
assert_equal "<noframes></noframes>", noframes
|
83
|
-
assert_equal "<noscript></noscript>", noscript
|
84
|
-
assert_equal "<object></object>", object
|
85
|
-
assert_equal "<optgroup></optgroup>", optgroup
|
86
|
-
assert_equal "<q></q>", q
|
87
|
-
assert_equal "<sub></sub>", sub
|
88
|
-
assert_equal "<sup></sup>", sup
|
89
|
-
assert_equal "<thead></thead>", thead
|
90
|
-
assert_equal "<tfoot></tfoot>", tfoot
|
91
|
-
assert_equal "<tbody></tbody>", tbody
|
92
|
-
|
93
|
-
assert_equal "<br />", br
|
94
|
-
assert_equal "<hr />", hr
|
95
|
-
assert_equal "<img />", img
|
96
|
-
assert_equal "<meta />", meta
|
97
|
-
assert_equal "<base />", base
|
98
|
-
assert_equal "<link />", link
|
99
|
-
assert_equal "<input />", input
|
100
|
-
assert_equal "<col />", col
|
101
|
-
assert_equal "<frame />", frame
|
102
|
-
assert_equal "<param />", param
|
103
44
|
|
104
45
|
assert_equal "<!---->", comment
|
105
46
|
|
@@ -134,21 +75,26 @@ class DeklarativnaTest < Test::Unit::TestCase
|
|
134
75
|
p { "chau" }
|
135
76
|
]}
|
136
77
|
]}
|
137
|
-
assert_equal "<html><head><script type=\"text/javascript\"
|
78
|
+
assert_equal "<html><head><script type=\"text/javascript\">" +
|
79
|
+
"</script></head><body><p>hola</p><p>chau</p></body></html>",
|
80
|
+
renderable
|
138
81
|
end
|
139
82
|
|
140
83
|
def test_style_can_render_css
|
141
84
|
renderable = css {
|
142
85
|
"h1, p {text-align: left;}"
|
143
86
|
}
|
144
|
-
assert_equal "<style type=\"text/css\">h1, p {text-align: left;}</style>",
|
87
|
+
assert_equal "<style type=\"text/css\">h1, p {text-align: left;}</style>",
|
88
|
+
renderable
|
145
89
|
end
|
146
90
|
|
147
91
|
def test_script_can_render_javascript
|
148
92
|
renderable = javascript {
|
149
93
|
"var y = 2; alert(y);"
|
150
94
|
}
|
151
|
-
assert_equal "<script type=\"text/javascript\">var y = 2;
|
95
|
+
assert_equal "<script type=\"text/javascript\">var y = 2;" +
|
96
|
+
" alert(y);</script>",
|
97
|
+
renderable
|
152
98
|
end
|
153
99
|
|
154
100
|
def test_comment_block
|
@@ -175,6 +121,7 @@ class DeklarativnaTest < Test::Unit::TestCase
|
|
175
121
|
end
|
176
122
|
|
177
123
|
def test_base_template
|
178
|
-
assert_equal "<html><head></head><body></body></html>",
|
124
|
+
assert_equal "<html><head></head><body></body></html>",
|
125
|
+
BaseTemplate.new.render
|
179
126
|
end
|
180
127
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deklarativna
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: launchy
|
16
|
-
requirement: &
|
16
|
+
requirement: &12101940 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *12101940
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: sinatra
|
27
|
-
requirement: &
|
27
|
+
requirement: &12100660 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *12100660
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: thin
|
38
|
-
requirement: &
|
38
|
+
requirement: &12098940 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *12098940
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: shoulda
|
49
|
-
requirement: &
|
49
|
+
requirement: &12113400 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *12113400
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: bundler
|
60
|
-
requirement: &
|
60
|
+
requirement: &12111180 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.0.0
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *12111180
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: jeweler
|
71
|
-
requirement: &
|
71
|
+
requirement: &12109020 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 1.6.4
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *12109020
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: rcov
|
82
|
-
requirement: &
|
82
|
+
requirement: &12106580 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *12106580
|
91
91
|
description: ! "A Declarative HTML embedded DSL for HTML/XML Templating in Ruby,\n
|
92
92
|
\ This gem was intended to be use as teaching material for universitary students."
|
93
93
|
email: david.litvakb@gmail.com
|
@@ -138,7 +138,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
138
138
|
version: '0'
|
139
139
|
segments:
|
140
140
|
- 0
|
141
|
-
hash:
|
141
|
+
hash: -3487965413159789251
|
142
142
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
143
|
none: false
|
144
144
|
requirements:
|