renshi 0.2.1 → 0.2.2

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/README CHANGED
@@ -165,6 +165,8 @@ Thus, n requests for the template mean 1 call to Renshi to generate the necessar
165
165
 
166
166
  When integrating this feature with other frameworks, simply use a delegate object to hold the compiled code and evaluate it against the binding you want to use. See the Rails and Sinatra bridges to get you started.
167
167
 
168
+ If you're curious to see the source it creates, add an environment variable called RENSHI_SHOW_SRC.
169
+
168
170
  Development
169
171
  ===========
170
172
  Please report any bugs at the http://renshi.lighthouseapp.com .
@@ -11,7 +11,7 @@ module Renshi
11
11
 
12
12
  if sibling_commands.first
13
13
  expression = sibling_commands.first[0][2..-1]
14
- if expression == "else"
14
+ if expression == "else" or expression == "elsif"
15
15
  return
16
16
  end
17
17
  end
data/lib/renshi.rb CHANGED
@@ -9,7 +9,7 @@ require 'renshi/attribute_expressions'
9
9
  require 'renshi/frameworks'
10
10
 
11
11
  module Renshi
12
- VERSION="0.2.1"
12
+ VERSION="0.2.2"
13
13
 
14
14
  class SyntaxError < StandardError; end
15
15
  end
@@ -0,0 +1,13 @@
1
+ <html xmlns="http://www.w3.org/1999/xhtml">
2
+ <body>
3
+ <div id="content" r:if="foo == 1">
4
+ 1
5
+ </div>
6
+ <div id="content" r:elsif="foo == 2">
7
+ 2
8
+ </div>
9
+ <div id="content" r:elsif="foo == 3">
10
+ 3
11
+ </div>
12
+ </body>
13
+ </html>
data/spec/elsif_spec.rb CHANGED
@@ -16,4 +16,15 @@ describe Renshi::Parser do
16
16
  doc = N(out)
17
17
  (doc/"div[@id='content']").text.strip.should =~ /neither/
18
18
  end
19
+
20
+ it "should evaluate many of them" do
21
+ foo = 1
22
+ out = interpret("data/elsif2.ren", binding)
23
+ doc = N(out)
24
+ (doc/"div[@id='content']").text.strip.should =~ /1/
25
+ foo = 3
26
+ out = interpret("data/elsif2.ren", binding)
27
+ doc = N(out)
28
+ (doc/"div[@id='content']").text.strip.should =~ /3/
29
+ end
19
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: renshi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicholas Faiz
@@ -9,7 +9,7 @@ autorequire: renshi
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-21 00:00:00 +10:00
12
+ date: 2009-09-22 00:00:00 +10:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -78,6 +78,7 @@ specification_version: 3
78
78
  summary: Renshi is a templating language for Ruby which is versatile and cooperative with HTML.
79
79
  test_files:
80
80
  - spec/data/attribute_values_parsed.ren
81
+ - spec/data/elsif2.ren
81
82
  - spec/data/example1.ren
82
83
  - spec/data/for.ren
83
84
  - spec/data/hello_world1.ren