ruhl 0.13.0 → 0.14.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.
- data/VERSION +1 -1
- data/lib/ruhl/engine.rb +7 -2
- data/lib/ruhl.rb +2 -1
- data/ruhl.gemspec +3 -2
- data/spec/html/swap.html +9 -0
- data/spec/ruhl_spec.rb +14 -2
- data/spec/spec_helper.rb +4 -0
- metadata +3 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.14.0
|
data/lib/ruhl/engine.rb
CHANGED
@@ -15,9 +15,10 @@ module Ruhl
|
|
15
15
|
if @layout || @local_object || @block_object
|
16
16
|
@document = Nokogiri::HTML.fragment(html)
|
17
17
|
else
|
18
|
-
|
19
18
|
@document = Nokogiri::HTML(html)
|
19
|
+
@document.encoding = Ruhl.encoding
|
20
20
|
end
|
21
|
+
|
21
22
|
end
|
22
23
|
|
23
24
|
def render(current_scope)
|
@@ -28,7 +29,7 @@ module Ruhl
|
|
28
29
|
if @layout
|
29
30
|
render_with_layout
|
30
31
|
else
|
31
|
-
document.to_s
|
32
|
+
document.to_s.gsub(/\302\240/, ' ')
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
@@ -175,6 +176,10 @@ module Ruhl
|
|
175
176
|
current_tag.inner_html = render_partial
|
176
177
|
end
|
177
178
|
|
179
|
+
def ruhl_swap
|
180
|
+
current_tag.swap(call_result)
|
181
|
+
end
|
182
|
+
|
178
183
|
def process_results
|
179
184
|
if call_result.is_a?(Hash)
|
180
185
|
apply_hash(current_tag, call_result)
|
data/lib/ruhl.rb
CHANGED
data/ruhl.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ruhl}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.14.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Andrew Stone"]
|
12
|
-
s.date = %q{2009-11-
|
12
|
+
s.date = %q{2009-11-18}
|
13
13
|
s.description = %q{Make your HTML dynamic with the addition of a data-ruhl attribute.}
|
14
14
|
s.email = %q{andy@stonean.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -45,6 +45,7 @@ Gem::Specification.new do |s|
|
|
45
45
|
"spec/html/seo.html",
|
46
46
|
"spec/html/sidebar.html",
|
47
47
|
"spec/html/special.html",
|
48
|
+
"spec/html/swap.html",
|
48
49
|
"spec/html/use.html",
|
49
50
|
"spec/html/use_if.html",
|
50
51
|
"spec/rcov.opts",
|
data/spec/html/swap.html
ADDED
data/spec/ruhl_spec.rb
CHANGED
@@ -352,8 +352,8 @@ describe Ruhl do
|
|
352
352
|
|
353
353
|
it "will convert entities" do
|
354
354
|
ps = @doc.xpath("/html/body/p")
|
355
|
-
ps[0].inner_html.should
|
356
|
-
ps[1].inner_html.should == "RuHL
|
355
|
+
ps[0].inner_html.should == "Here is a space and another one."
|
356
|
+
ps[1].inner_html.should == "RuHL © 2009"
|
357
357
|
|
358
358
|
# To verify everything is correct, I did it the old fashioned way
|
359
359
|
# File.open('test.html',"w") do |f|
|
@@ -362,6 +362,18 @@ describe Ruhl do
|
|
362
362
|
end
|
363
363
|
end
|
364
364
|
|
365
|
+
describe "swap.html" do
|
366
|
+
before do
|
367
|
+
@html = File.read html(:swap)
|
368
|
+
@doc = create_doc
|
369
|
+
end
|
370
|
+
|
371
|
+
it "will convert entities" do
|
372
|
+
ps = @doc.xpath("/html/body/p")
|
373
|
+
ps.inner_html.should == "The programming language, Ruby, is awesome."
|
374
|
+
end
|
375
|
+
end
|
376
|
+
|
365
377
|
describe "when no method" do
|
366
378
|
before do
|
367
379
|
@html = "<p data-ruhl='nonexistant_method'>I am bad</p>"
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruhl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Stone
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-18 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -70,6 +70,7 @@ files:
|
|
70
70
|
- spec/html/seo.html
|
71
71
|
- spec/html/sidebar.html
|
72
72
|
- spec/html/special.html
|
73
|
+
- spec/html/swap.html
|
73
74
|
- spec/html/use.html
|
74
75
|
- spec/html/use_if.html
|
75
76
|
- spec/rcov.opts
|