wunderbar 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/wunderbar/builder.rb +2 -2
- data/lib/wunderbar/version.rb +1 -1
- data/test/test_builder.rb +23 -0
- data/wunderbar.gemspec +4 -4
- metadata +6 -4
data/lib/wunderbar/builder.rb
CHANGED
@@ -15,9 +15,9 @@ module Builder
|
|
15
15
|
data.sub! /\n\s*\Z/, ''
|
16
16
|
data.sub! /\A\s*\n/, ''
|
17
17
|
|
18
|
-
unindent = data.sub(/s+\Z/,'').scan(/^
|
18
|
+
unindent = data.sub(/s+\Z/,'').scan(/^ *\S/).map(&:length).min || 1
|
19
19
|
|
20
|
-
before = ::Regexp.new('^'.ljust(unindent
|
20
|
+
before = ::Regexp.new('^'.ljust(unindent))
|
21
21
|
after = " " * (@level * @indent)
|
22
22
|
data.gsub! before, after
|
23
23
|
end
|
data/lib/wunderbar/version.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'wunderbar'
|
4
|
+
|
5
|
+
class BuilderTest < Test::Unit::TestCase
|
6
|
+
def test_empty
|
7
|
+
x = Builder::XmlMarkup.new :indent => 2
|
8
|
+
x.script { x.indented_text! '' }
|
9
|
+
assert_equal %{<script>\n</script>\n}, x.target!
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_unindented_input
|
13
|
+
x = Builder::XmlMarkup.new :indent => 2
|
14
|
+
x.script { x.indented_text! "{\n x: 1\n}" }
|
15
|
+
assert_equal %{<script>\n {\n x: 1\n }\n</script>\n}, x.target!
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_indented_input
|
19
|
+
x = Builder::XmlMarkup.new :indent => 2
|
20
|
+
x.script { x.indented_text! " alert('danger');" }
|
21
|
+
assert_equal %{<script>\n alert('danger');\n</script>\n}, x.target!
|
22
|
+
end
|
23
|
+
end
|
data/wunderbar.gemspec
CHANGED
@@ -2,22 +2,22 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "wunderbar"
|
5
|
-
s.version = "0.8.
|
5
|
+
s.version = "0.8.2"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Sam Ruby"]
|
9
|
-
s.date = "2012-02-
|
9
|
+
s.date = "2012-02-04"
|
10
10
|
s.description = " Provides a number of globals, helper methods, and monkey patches which\n simplify the generation of HTML and the development of CGI scripts.\n"
|
11
11
|
s.email = "rubys@intertwingly.net"
|
12
12
|
s.extra_rdoc_files = ["COPYING", "README", "lib/wunderbar.rb", "lib/wunderbar/builder.rb", "lib/wunderbar/cgi-methods.rb", "lib/wunderbar/environment.rb", "lib/wunderbar/html-methods.rb", "lib/wunderbar/installation.rb", "lib/wunderbar/job-control.rb", "lib/wunderbar/version.rb"]
|
13
|
-
s.files = ["COPYING", "README", "Rakefile", "lib/wunderbar.rb", "lib/wunderbar/builder.rb", "lib/wunderbar/cgi-methods.rb", "lib/wunderbar/environment.rb", "lib/wunderbar/html-methods.rb", "lib/wunderbar/installation.rb", "lib/wunderbar/job-control.rb", "lib/wunderbar/version.rb", "test/test_html_markup.rb", "Manifest", "wunderbar.gemspec"]
|
13
|
+
s.files = ["COPYING", "README", "Rakefile", "lib/wunderbar.rb", "lib/wunderbar/builder.rb", "lib/wunderbar/cgi-methods.rb", "lib/wunderbar/environment.rb", "lib/wunderbar/html-methods.rb", "lib/wunderbar/installation.rb", "lib/wunderbar/job-control.rb", "lib/wunderbar/version.rb", "test/test_html_markup.rb", "Manifest", "wunderbar.gemspec", "test/test_builder.rb"]
|
14
14
|
s.homepage = "http://github.com/rubys/wunderbar"
|
15
15
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Wunderbar", "--main", "README"]
|
16
16
|
s.require_paths = ["lib"]
|
17
17
|
s.rubyforge_project = "wunderbar"
|
18
18
|
s.rubygems_version = "1.8.15"
|
19
19
|
s.summary = "HTML Generator and CGI application support"
|
20
|
-
s.test_files = ["test/test_html_markup.rb"]
|
20
|
+
s.test_files = ["test/test_html_markup.rb", "test/test_builder.rb"]
|
21
21
|
|
22
22
|
if s.respond_to? :specification_version then
|
23
23
|
s.specification_version = 3
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wunderbar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 59
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 8
|
9
|
-
-
|
10
|
-
version: 0.8.
|
9
|
+
- 2
|
10
|
+
version: 0.8.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sam Ruby
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-02-
|
18
|
+
date: 2012-02-04 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: builder
|
@@ -77,6 +77,7 @@ files:
|
|
77
77
|
- test/test_html_markup.rb
|
78
78
|
- Manifest
|
79
79
|
- wunderbar.gemspec
|
80
|
+
- test/test_builder.rb
|
80
81
|
homepage: http://github.com/rubys/wunderbar
|
81
82
|
licenses: []
|
82
83
|
|
@@ -118,3 +119,4 @@ specification_version: 3
|
|
118
119
|
summary: HTML Generator and CGI application support
|
119
120
|
test_files:
|
120
121
|
- test/test_html_markup.rb
|
122
|
+
- test/test_builder.rb
|