simply 0.1.3 → 0.2.3
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.
- data/Rakefile +4 -4
- data/VERSION.yml +1 -1
- data/benchmarks/003_fd604401b1b03096ec35cdb3036821b92a71791b.out +27 -0
- data/benchmarks/004_b75e031f96b342559036444f502d44da7e7104f0.out +27 -0
- data/benchmarks/comparison.rb +1 -1
- data/lib/simply.rb +1 -2
- data/lib/simply/escaping.rb +20 -0
- data/lib/simply/html_builder.rb +2 -5
- data/lib/simply/version.rb +3 -1
- data/simply.gemspec +43 -29
- data/spec/simply/html_builder/indentation_spec.rb +7 -7
- data/spec/simply/html_builder/locals_spec.rb +4 -4
- data/spec/simply/html_builder_spec.rb +1 -1
- metadata +6 -3
data/Rakefile
CHANGED
@@ -5,11 +5,11 @@ PROJECT_NAME = "simply"
|
|
5
5
|
begin
|
6
6
|
require 'jeweler'
|
7
7
|
Jeweler::Tasks.new do |s|
|
8
|
-
s.name =
|
9
|
-
s.summary = "A markaby-
|
8
|
+
s.name = "simply"
|
9
|
+
s.summary = "A minimal markaby-esq ruby templating language"
|
10
10
|
s.email = "scott@railsnewbie.com"
|
11
|
-
s.homepage = "http://github.com/smtlaissezfaire
|
12
|
-
s.description = "
|
11
|
+
s.homepage = "http://github.com/smtlaissezfaire/simply"
|
12
|
+
s.description = "A minimal markaby-esq ruby templating language"
|
13
13
|
s.authors = ["Scott Taylor"]
|
14
14
|
end
|
15
15
|
rescue LoadError
|
data/VERSION.yml
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
# of iterations = 10000
|
2
|
+
Rehearsal ------------------------------------------------------------------------------
|
3
|
+
counter time 0.000000 0.000000 0.000000 ( 0.001055)
|
4
|
+
counter time + function call overhead time 0.000000 0.000000 0.000000 ( 0.002811)
|
5
|
+
tagz 2.540000 0.020000 2.560000 ( 2.744199)
|
6
|
+
markaby 9.940000 0.080000 10.020000 ( 10.658650)
|
7
|
+
builder 1.020000 0.010000 1.030000 ( 1.171982)
|
8
|
+
haml 5.500000 0.050000 5.550000 ( 6.917135)
|
9
|
+
erb 2.270000 0.010000 2.280000 ( 2.797811)
|
10
|
+
erubis 0.430000 0.010000 0.440000 ( 0.463208)
|
11
|
+
nokogiri 1.950000 0.020000 1.970000 ( 2.138772)
|
12
|
+
simply 2.330000 0.020000 2.350000 ( 2.550994)
|
13
|
+
erector 0.220000 0.000000 0.220000 ( 0.223103)
|
14
|
+
-------------------------------------------------------------------- total: 26.420000sec
|
15
|
+
|
16
|
+
user system total real
|
17
|
+
counter time 0.000000 0.000000 0.000000 ( 0.001063)
|
18
|
+
counter time + function call overhead time 0.000000 0.000000 0.000000 ( 0.004023)
|
19
|
+
tagz 2.480000 0.020000 2.500000 ( 3.047870)
|
20
|
+
markaby 9.880000 0.070000 9.950000 ( 10.771271)
|
21
|
+
builder 1.030000 0.010000 1.040000 ( 1.093748)
|
22
|
+
haml 5.650000 0.040000 5.690000 ( 6.100592)
|
23
|
+
erb 2.370000 0.030000 2.400000 ( 2.575887)
|
24
|
+
erubis 0.400000 0.000000 0.400000 ( 0.479711)
|
25
|
+
nokogiri 1.910000 0.020000 1.930000 ( 2.054972)
|
26
|
+
simply 2.320000 0.020000 2.340000 ( 2.604975)
|
27
|
+
erector 0.150000 0.000000 0.150000 ( 0.172422)
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# of iterations = 10000
|
2
|
+
Rehearsal ------------------------------------------------------------------------------
|
3
|
+
counter time 0.000000 0.000000 0.000000 ( 0.001575)
|
4
|
+
counter time + function call overhead time 0.000000 0.000000 0.000000 ( 0.003454)
|
5
|
+
tagz 2.560000 0.020000 2.580000 ( 2.703877)
|
6
|
+
markaby 9.950000 0.070000 10.020000 ( 10.547215)
|
7
|
+
builder 1.030000 0.020000 1.050000 ( 1.096580)
|
8
|
+
haml 5.700000 0.030000 5.730000 ( 5.992496)
|
9
|
+
erb 2.400000 0.020000 2.420000 ( 2.540554)
|
10
|
+
erubis 0.420000 0.000000 0.420000 ( 0.441572)
|
11
|
+
nokogiri 1.940000 0.020000 1.960000 ( 2.038399)
|
12
|
+
simply 2.340000 0.010000 2.350000 ( 2.482033)
|
13
|
+
erector 0.210000 0.000000 0.210000 ( 0.212933)
|
14
|
+
-------------------------------------------------------------------- total: 26.740000sec
|
15
|
+
|
16
|
+
user system total real
|
17
|
+
counter time 0.000000 0.000000 0.000000 ( 0.001111)
|
18
|
+
counter time + function call overhead time 0.010000 0.000000 0.010000 ( 0.002913)
|
19
|
+
tagz 2.570000 0.020000 2.590000 ( 2.706161)
|
20
|
+
markaby 9.770000 0.060000 9.830000 ( 10.536178)
|
21
|
+
builder 1.030000 0.010000 1.040000 ( 1.083472)
|
22
|
+
haml 5.690000 0.040000 5.730000 ( 6.061707)
|
23
|
+
erb 2.380000 0.010000 2.390000 ( 2.513181)
|
24
|
+
erubis 0.420000 0.010000 0.430000 ( 0.445088)
|
25
|
+
nokogiri 1.890000 0.010000 1.900000 ( 2.005374)
|
26
|
+
simply 2.340000 0.020000 2.360000 ( 2.466595)
|
27
|
+
erector 0.160000 0.000000 0.160000 ( 0.164743)
|
data/benchmarks/comparison.rb
CHANGED
data/lib/simply.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
module Simply
|
2
|
+
module Escaping
|
3
|
+
#
|
4
|
+
# A utility method for escaping HTML tag characters in _s_.
|
5
|
+
#
|
6
|
+
# Taken from ERB::Util
|
7
|
+
#
|
8
|
+
# puts html_escape("is a > 0 & a < 10?")
|
9
|
+
#
|
10
|
+
# _Generates_
|
11
|
+
#
|
12
|
+
# is a > 0 & a < 10?
|
13
|
+
#
|
14
|
+
def html_escape(s)
|
15
|
+
s.to_s.gsub(/&/, "&").gsub(/\"/, """).gsub(/>/, ">").gsub(/</, "<")
|
16
|
+
end
|
17
|
+
|
18
|
+
alias_method :h, :html_escape
|
19
|
+
end
|
20
|
+
end
|
data/lib/simply/html_builder.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module Simply
|
2
2
|
class HTMLBuilder
|
3
3
|
include Locals
|
4
|
+
include Escaping
|
4
5
|
|
5
6
|
unless defined?(SELF_CLOSING_TAGS)
|
6
7
|
SELF_CLOSING_TAGS = HTMLTags::SELF_CLOSING_TAGS
|
@@ -14,7 +15,7 @@ module Simply
|
|
14
15
|
self.locals = locals_hash
|
15
16
|
end
|
16
17
|
|
17
|
-
@indented =
|
18
|
+
@indented = options[:indented].equal?(false) ? false : true
|
18
19
|
@out.extend Indentation if indented?
|
19
20
|
|
20
21
|
instance_eval(&block) if block_given?
|
@@ -78,10 +79,6 @@ module Simply
|
|
78
79
|
text html_escape(out)
|
79
80
|
end
|
80
81
|
|
81
|
-
def html_escape(out)
|
82
|
-
out.to_s.to_xs
|
83
|
-
end
|
84
|
-
|
85
82
|
def to_s
|
86
83
|
@out
|
87
84
|
end
|
data/lib/simply/version.rb
CHANGED
data/simply.gemspec
CHANGED
@@ -2,53 +2,67 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{simply}
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.2.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Scott Taylor"]
|
9
|
-
s.date = %q{2009-
|
10
|
-
s.description = %q{
|
9
|
+
s.date = %q{2009-07-29}
|
10
|
+
s.description = %q{A minimal markaby-esq ruby templating language}
|
11
11
|
s.email = %q{scott@railsnewbie.com}
|
12
12
|
s.extra_rdoc_files = [
|
13
13
|
"README"
|
14
14
|
]
|
15
15
|
s.files = [
|
16
|
-
"
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
16
|
+
".gitignore",
|
17
|
+
"README",
|
18
|
+
"Rakefile",
|
19
|
+
"VERSION.yml",
|
20
|
+
"benchmarks/001_7a22450a80d6253bf9f0aabb2ee0110c2d67c8a6.out",
|
21
|
+
"benchmarks/002_e462499cd6bd8dface62e433311b3bc0b0b55a42",
|
22
|
+
"benchmarks/003_fd604401b1b03096ec35cdb3036821b92a71791b.out",
|
23
|
+
"benchmarks/004_b75e031f96b342559036444f502d44da7e7104f0.out",
|
24
|
+
"benchmarks/comparison.rb",
|
25
|
+
"lib/simply.rb",
|
26
|
+
"lib/simply/escaping.rb",
|
27
|
+
"lib/simply/html_builder.rb",
|
28
|
+
"lib/simply/html_tags.rb",
|
29
|
+
"lib/simply/indentation.rb",
|
30
|
+
"lib/simply/locals.rb",
|
31
|
+
"lib/simply/version.rb",
|
32
|
+
"profiling/run_static.rb",
|
33
|
+
"profiling/run_static_001_0e246c3de41a891c206c8cb5a552d17d78e4b8ec.out",
|
34
|
+
"reference/ABOUT",
|
35
|
+
"reference/xhtml1-frameset.xsd",
|
36
|
+
"reference/xhtml1-strict.xsd",
|
37
|
+
"reference/xhtml1-transitional.xsd",
|
38
|
+
"simply.gemspec",
|
39
|
+
"spec/simply/html_builder/indentation_spec.rb",
|
40
|
+
"spec/simply/html_builder/locals_spec.rb",
|
41
|
+
"spec/simply/html_builder_spec.rb",
|
42
|
+
"spec/simply/indentation_spec.rb",
|
43
|
+
"spec/simply/simply_spec.rb",
|
44
|
+
"spec/simply/version_spec.rb",
|
45
|
+
"spec/spec.opts",
|
46
|
+
"spec/spec_helper.rb"
|
32
47
|
]
|
33
|
-
s.has_rdoc = true
|
34
48
|
s.homepage = %q{http://github.com/smtlaissezfaire/simply}
|
35
49
|
s.rdoc_options = ["--charset=UTF-8"]
|
36
50
|
s.require_paths = ["lib"]
|
37
|
-
s.rubygems_version = %q{1.3.
|
38
|
-
s.summary = %q{
|
51
|
+
s.rubygems_version = %q{1.3.4}
|
52
|
+
s.summary = %q{A minimal markaby-esq ruby templating language}
|
39
53
|
s.test_files = [
|
40
54
|
"spec/simply/html_builder/indentation_spec.rb",
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
55
|
+
"spec/simply/html_builder/locals_spec.rb",
|
56
|
+
"spec/simply/html_builder_spec.rb",
|
57
|
+
"spec/simply/indentation_spec.rb",
|
58
|
+
"spec/simply/simply_spec.rb",
|
59
|
+
"spec/simply/version_spec.rb",
|
60
|
+
"spec/spec_helper.rb"
|
47
61
|
]
|
48
62
|
|
49
63
|
if s.respond_to? :specification_version then
|
50
64
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
51
|
-
s.specification_version =
|
65
|
+
s.specification_version = 3
|
52
66
|
|
53
67
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
54
68
|
else
|
@@ -3,22 +3,22 @@ require File.dirname(__FILE__) + "/../../spec_helper"
|
|
3
3
|
module Simply
|
4
4
|
describe HTMLBuilder, "with indentation" do
|
5
5
|
before(:each) do
|
6
|
-
@builder = HTMLBuilder.new(:
|
6
|
+
@builder = HTMLBuilder.new(:indented => true)
|
7
7
|
end
|
8
8
|
|
9
|
-
it "should be indented when passed :
|
10
|
-
builder = HTMLBuilder.new(:
|
9
|
+
it "should be indented when passed :indented => true" do
|
10
|
+
builder = HTMLBuilder.new(:indented => true)
|
11
11
|
builder.should be_indented
|
12
12
|
end
|
13
13
|
|
14
|
-
it "should not be indented when passed :
|
15
|
-
builder = HTMLBuilder.new(:
|
14
|
+
it "should not be indented when passed :indented => false" do
|
15
|
+
builder = HTMLBuilder.new(:indented => false)
|
16
16
|
builder.should_not be_indented
|
17
17
|
end
|
18
18
|
|
19
|
-
it "should
|
19
|
+
it "should be indented by default" do
|
20
20
|
builder = HTMLBuilder.new
|
21
|
-
builder.
|
21
|
+
builder.should be_indented
|
22
22
|
end
|
23
23
|
|
24
24
|
it "should indent html when indented = true, and given a block structure" do
|
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + "/../../spec_helper"
|
|
3
3
|
module Simply
|
4
4
|
describe HTMLBuilder, "with locals" do
|
5
5
|
before(:each) do
|
6
|
-
@builder = HTMLBuilder.new
|
6
|
+
@builder = HTMLBuilder.new(:indented => false)
|
7
7
|
end
|
8
8
|
|
9
9
|
it "should have access to a variables value" do
|
@@ -36,7 +36,7 @@ module Simply
|
|
36
36
|
end
|
37
37
|
|
38
38
|
it "should take locals in the constructor" do
|
39
|
-
builder = HTMLBuilder.new(:locals => { :foo => "bar", :bar => "baz" }) do
|
39
|
+
builder = HTMLBuilder.new(:locals => { :foo => "bar", :bar => "baz" }, :indented => false) do
|
40
40
|
ul do
|
41
41
|
li foo
|
42
42
|
li bar
|
@@ -47,7 +47,7 @@ module Simply
|
|
47
47
|
end
|
48
48
|
|
49
49
|
it "should be able to pass in several sets of locals at different times" do
|
50
|
-
builder = HTMLBuilder.new(:locals => {:foo => "1"})
|
50
|
+
builder = HTMLBuilder.new(:locals => {:foo => "1"}, :indented => false)
|
51
51
|
builder.locals = {:bar => "2"}
|
52
52
|
builder.ul do
|
53
53
|
li foo
|
@@ -57,4 +57,4 @@ module Simply
|
|
57
57
|
builder.to_s.should == "<ul><li>1</li><li>2</li></ul>"
|
58
58
|
end
|
59
59
|
end
|
60
|
-
end
|
60
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simply
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Taylor
|
@@ -13,7 +13,7 @@ date: 2009-11-09 00:00:00 -05:00
|
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
16
|
-
description:
|
16
|
+
description: A minimal markaby-esq ruby templating language
|
17
17
|
email: scott@railsnewbie.com
|
18
18
|
executables: []
|
19
19
|
|
@@ -28,8 +28,11 @@ files:
|
|
28
28
|
- VERSION.yml
|
29
29
|
- benchmarks/001_7a22450a80d6253bf9f0aabb2ee0110c2d67c8a6.out
|
30
30
|
- benchmarks/002_e462499cd6bd8dface62e433311b3bc0b0b55a42
|
31
|
+
- benchmarks/003_fd604401b1b03096ec35cdb3036821b92a71791b.out
|
32
|
+
- benchmarks/004_b75e031f96b342559036444f502d44da7e7104f0.out
|
31
33
|
- benchmarks/comparison.rb
|
32
34
|
- lib/simply.rb
|
35
|
+
- lib/simply/escaping.rb
|
33
36
|
- lib/simply/html_builder.rb
|
34
37
|
- lib/simply/html_tags.rb
|
35
38
|
- lib/simply/indentation.rb
|
@@ -77,7 +80,7 @@ rubyforge_project:
|
|
77
80
|
rubygems_version: 1.3.5
|
78
81
|
signing_key:
|
79
82
|
specification_version: 3
|
80
|
-
summary: A markaby-
|
83
|
+
summary: A minimal markaby-esq ruby templating language
|
81
84
|
test_files:
|
82
85
|
- spec/simply/html_builder/indentation_spec.rb
|
83
86
|
- spec/simply/html_builder/locals_spec.rb
|