html2fortitude 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec-local +4 -0
- data/.travis.yml +16 -0
- data/.yardopts +1 -0
- data/Gemfile +5 -0
- data/MIT-LICENSE +38 -0
- data/README.md +97 -0
- data/Rakefile +29 -0
- data/bin/html2fortitude +7 -0
- data/html2fortitude.gemspec +31 -0
- data/lib/html2fortitude.rb +6 -0
- data/lib/html2fortitude/html.rb +755 -0
- data/lib/html2fortitude/html/erb.rb +156 -0
- data/lib/html2fortitude/run.rb +103 -0
- data/lib/html2fortitude/source_template.rb +93 -0
- data/lib/html2fortitude/version.rb +3 -0
- data/spec/helpers/global_helper.rb +6 -0
- data/spec/helpers/html2fortitude_result.rb +71 -0
- data/spec/helpers/standard_helper.rb +70 -0
- data/spec/system/basic_system_spec.rb +13 -0
- data/spec/system/command_line_spec.rb +411 -0
- data/spec/system/erb_system_spec.rb +208 -0
- data/spec/system/needs_system_spec.rb +73 -0
- data/spec/system/options_system_spec.rb +43 -0
- data/spec/system/other_stuff_system_spec.rb +39 -0
- data/spec/system/rails_system_spec.rb +9 -0
- data/spec/system/tags_system_spec.rb +252 -0
- data/spec/system/text_system_spec.rb +106 -0
- data/test/erb_test.rb +546 -0
- data/test/html2fortitude_test.rb +424 -0
- data/test/jruby/erb_test.rb +39 -0
- data/test/jruby/html2fortitude_test.rb +72 -0
- data/test/test_helper.rb +22 -0
- metadata +238 -0
@@ -0,0 +1,72 @@
|
|
1
|
+
class Html2FortitudeTest
|
2
|
+
|
3
|
+
def test_doctype
|
4
|
+
empty_body = "\n%html\n %head\n %body"
|
5
|
+
assert_equal '!!!' + empty_body, render("<!DOCTYPE html>")
|
6
|
+
assert_equal '!!! 1.1' + empty_body, render('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">')
|
7
|
+
assert_equal '!!! Strict' + empty_body, render('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">')
|
8
|
+
assert_equal '!!! Frameset' + empty_body, render('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">')
|
9
|
+
assert_equal '!!! Mobile 1.2' + empty_body, render('<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">')
|
10
|
+
assert_equal '!!! Basic 1.1' + empty_body, render('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">')
|
11
|
+
assert_equal '!!!' + empty_body, render('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">')
|
12
|
+
assert_equal '!!! Strict' + empty_body, render('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">')
|
13
|
+
assert_equal '!!! Frameset' + empty_body, render('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">')
|
14
|
+
assert_equal '!!!' + empty_body, render('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">')
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_xhtml_strict_doctype
|
18
|
+
assert_equal(<<FORTITUDE.rstrip, render(<<HTML))
|
19
|
+
!!! Strict
|
20
|
+
%html
|
21
|
+
%head
|
22
|
+
%body
|
23
|
+
FORTITUDE
|
24
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
25
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
26
|
+
HTML
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_html_document_without_doctype
|
30
|
+
assert_equal(<<FORTITUDE.rstrip, render(<<HTML))
|
31
|
+
%html
|
32
|
+
%head
|
33
|
+
%title Hello
|
34
|
+
%body
|
35
|
+
%p Hello
|
36
|
+
FORTITUDE
|
37
|
+
<html>
|
38
|
+
<head>
|
39
|
+
<title>Hello</title>
|
40
|
+
</head>
|
41
|
+
<body>
|
42
|
+
<p>Hello</p>
|
43
|
+
</body>
|
44
|
+
</html>
|
45
|
+
HTML
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_should_have_attributes_without_values
|
49
|
+
assert_equal('%input{:disabled => ""}/', render('<input disabled>'))
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_style_to_css_filter_with_following_content
|
53
|
+
assert_equal(<<FORTITUDE.rstrip, render(<<HTML))
|
54
|
+
%head
|
55
|
+
:css
|
56
|
+
foo {
|
57
|
+
bar: baz;
|
58
|
+
}
|
59
|
+
%body
|
60
|
+
Hello
|
61
|
+
FORTITUDE
|
62
|
+
<head>
|
63
|
+
<style type="text/css">
|
64
|
+
foo {
|
65
|
+
bar: baz;
|
66
|
+
}
|
67
|
+
</style>
|
68
|
+
</head>
|
69
|
+
<body>Hello</body>
|
70
|
+
HTML
|
71
|
+
end
|
72
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
if ENV["COVERAGE"]
|
3
|
+
require "simplecov"
|
4
|
+
SimpleCov.start
|
5
|
+
end
|
6
|
+
|
7
|
+
require "bundler/setup"
|
8
|
+
require "minitest/autorun"
|
9
|
+
require "html2fortitude"
|
10
|
+
require 'html2fortitude/html'
|
11
|
+
require 'html2fortitude/html/erb'
|
12
|
+
|
13
|
+
class MiniTest::Unit::TestCase
|
14
|
+
protected
|
15
|
+
def render(text, options = {})
|
16
|
+
Html2fortitude::HTML.new(text, options).render.rstrip
|
17
|
+
end
|
18
|
+
|
19
|
+
def render_erb(text)
|
20
|
+
render(text, :erb => true)
|
21
|
+
end
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,238 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: html2fortitude
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Norman Clarke
|
8
|
+
- Stefan Natchev
|
9
|
+
- Andrew Geweke
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2014-06-24 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: activesupport
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ">="
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.0.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: 3.0.0
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: nokogiri
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - "~>"
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 1.6.0
|
36
|
+
type: :runtime
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 1.6.0
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: erubis
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 2.7.0
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 2.7.0
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: ruby_parser
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 3.4.1
|
64
|
+
type: :runtime
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - "~>"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 3.4.1
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: trollop
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - "~>"
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 2.0.0
|
78
|
+
type: :runtime
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - "~>"
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: 2.0.0
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: haml
|
87
|
+
requirement: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - "~>"
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: 4.0.0
|
92
|
+
type: :runtime
|
93
|
+
prerelease: false
|
94
|
+
version_requirements: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - "~>"
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 4.0.0
|
99
|
+
- !ruby/object:Gem::Dependency
|
100
|
+
name: simplecov
|
101
|
+
requirement: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - "~>"
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: 0.7.1
|
106
|
+
type: :development
|
107
|
+
prerelease: false
|
108
|
+
version_requirements: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - "~>"
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: 0.7.1
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: minitest
|
115
|
+
requirement: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - "~>"
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: 4.4.0
|
120
|
+
type: :development
|
121
|
+
prerelease: false
|
122
|
+
version_requirements: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - "~>"
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: 4.4.0
|
127
|
+
- !ruby/object:Gem::Dependency
|
128
|
+
name: rake
|
129
|
+
requirement: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
141
|
+
- !ruby/object:Gem::Dependency
|
142
|
+
name: rspec
|
143
|
+
requirement: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - "~>"
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '2.14'
|
148
|
+
type: :development
|
149
|
+
prerelease: false
|
150
|
+
version_requirements: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - "~>"
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: '2.14'
|
155
|
+
description: Converts HTML into the Fortitude Ruby HTML-generation DSL
|
156
|
+
email:
|
157
|
+
- norman@njclarke.com
|
158
|
+
- stefan.natchev@gmail.com
|
159
|
+
- andrew@geweke.org
|
160
|
+
executables:
|
161
|
+
- html2fortitude
|
162
|
+
extensions: []
|
163
|
+
extra_rdoc_files: []
|
164
|
+
files:
|
165
|
+
- ".gitignore"
|
166
|
+
- ".rspec-local"
|
167
|
+
- ".travis.yml"
|
168
|
+
- ".yardopts"
|
169
|
+
- Gemfile
|
170
|
+
- MIT-LICENSE
|
171
|
+
- README.md
|
172
|
+
- Rakefile
|
173
|
+
- bin/html2fortitude
|
174
|
+
- html2fortitude.gemspec
|
175
|
+
- lib/html2fortitude.rb
|
176
|
+
- lib/html2fortitude/html.rb
|
177
|
+
- lib/html2fortitude/html/erb.rb
|
178
|
+
- lib/html2fortitude/run.rb
|
179
|
+
- lib/html2fortitude/source_template.rb
|
180
|
+
- lib/html2fortitude/version.rb
|
181
|
+
- spec/helpers/global_helper.rb
|
182
|
+
- spec/helpers/html2fortitude_result.rb
|
183
|
+
- spec/helpers/standard_helper.rb
|
184
|
+
- spec/system/basic_system_spec.rb
|
185
|
+
- spec/system/command_line_spec.rb
|
186
|
+
- spec/system/erb_system_spec.rb
|
187
|
+
- spec/system/needs_system_spec.rb
|
188
|
+
- spec/system/options_system_spec.rb
|
189
|
+
- spec/system/other_stuff_system_spec.rb
|
190
|
+
- spec/system/rails_system_spec.rb
|
191
|
+
- spec/system/tags_system_spec.rb
|
192
|
+
- spec/system/text_system_spec.rb
|
193
|
+
- test/erb_test.rb
|
194
|
+
- test/html2fortitude_test.rb
|
195
|
+
- test/jruby/erb_test.rb
|
196
|
+
- test/jruby/html2fortitude_test.rb
|
197
|
+
- test/test_helper.rb
|
198
|
+
homepage: http://github.com/ageweke/html2fortitude
|
199
|
+
licenses: []
|
200
|
+
metadata: {}
|
201
|
+
post_install_message:
|
202
|
+
rdoc_options: []
|
203
|
+
require_paths:
|
204
|
+
- lib
|
205
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
206
|
+
requirements:
|
207
|
+
- - ">="
|
208
|
+
- !ruby/object:Gem::Version
|
209
|
+
version: 1.9.2
|
210
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
211
|
+
requirements:
|
212
|
+
- - ">="
|
213
|
+
- !ruby/object:Gem::Version
|
214
|
+
version: '0'
|
215
|
+
requirements: []
|
216
|
+
rubyforge_project:
|
217
|
+
rubygems_version: 2.2.2
|
218
|
+
signing_key:
|
219
|
+
specification_version: 4
|
220
|
+
summary: Converts HTML into the Fortitude Ruby HTML-generation DSL
|
221
|
+
test_files:
|
222
|
+
- spec/helpers/global_helper.rb
|
223
|
+
- spec/helpers/html2fortitude_result.rb
|
224
|
+
- spec/helpers/standard_helper.rb
|
225
|
+
- spec/system/basic_system_spec.rb
|
226
|
+
- spec/system/command_line_spec.rb
|
227
|
+
- spec/system/erb_system_spec.rb
|
228
|
+
- spec/system/needs_system_spec.rb
|
229
|
+
- spec/system/options_system_spec.rb
|
230
|
+
- spec/system/other_stuff_system_spec.rb
|
231
|
+
- spec/system/rails_system_spec.rb
|
232
|
+
- spec/system/tags_system_spec.rb
|
233
|
+
- spec/system/text_system_spec.rb
|
234
|
+
- test/erb_test.rb
|
235
|
+
- test/html2fortitude_test.rb
|
236
|
+
- test/jruby/erb_test.rb
|
237
|
+
- test/jruby/html2fortitude_test.rb
|
238
|
+
- test/test_helper.rb
|