Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removed <r:puts> (now in Conditional Tags).

  • Loading branch information...
commit f16695846ecf7277c8242d00eb856e1fa54c2f2c 1 parent 0dfdc93
@chrisparrish chrisparrish authored
Showing with 6 additions and 68 deletions.
  1. +3 −13 README
  2. +3 −55 spec/lib/page_tags_spec.rb
View
16 README
@@ -6,8 +6,6 @@ within Radiant pages (and snippets and layouts).
It enhances <r:snippet> and <r:content> tags to let them declare variables
(similar to parameterized snippets).
-It also adds a <r:puts> tag to render your variable values.
-
And finally, it adds an evaluator for use by the Conditional Tags extension so
you can do things like:
@@ -15,7 +13,9 @@ you can do things like:
<r:content part="extended" class="someClass" />
-- in your extended part --
- <p<r:if cond="vars[class] exists?"> class="<r:puts value_for="class" />">Some Text</p>
+ <p<r:if cond="vars[class] exists?"> class="<r:puts value_for="vars[class]" />">
+ Some Text
+ </p>
@@ -45,16 +45,6 @@ Note: Local variables declarations do not overwrite global ones but they do
supercede them.
-== The 'puts' Tag
-
-The new 'puts' tag renders the current value of a variable (local or global):
-
- <r:puts value_for="myVar" />
-
-Additionally, you can use the value_for="*all*" option to render a list of all
-current variable values.
-
-
== The Vars Evaluator
There is also a 'vars' evaluator implemented to work with the Conditional Tags
View
58 spec/lib/page_tags_spec.rb
@@ -25,22 +25,6 @@
- describe "<r:puts> tag" do
-
- it 'should raise appropriate error if a "value_for" attribute is not given' do
- @page.should render('<r:puts bogus="attribute" />').with_error(
- "`puts' tag must contain a 'value_for' attribute"
- )
- end
-
-
- it 'should return an empty string if the variable named is not set' do
- @page.should render('<r:puts value_for="a" />').as("")
- end
-
- end
-
-
[ { :input_text => "true", :result => true },
{ :input_text => " true ", :result => true },
{ :input_text => "True", :result => true },
@@ -83,7 +67,7 @@
describe "<r:set_vars> tag" do
- it "should read the attribute name/value pair into a variable name/value pair" do
+ it "should set the attribute name/value pair into a variable name/value pair" do
tag = build_tag('set_vars', :myVar => curr_value[:input_text])
@page.should render(tag + evaluate_var('myVar')).
and_evaluate_as(curr_value[:result])
@@ -110,22 +94,9 @@
- describe "<r:puts> tag" do
-
- it 'should display the value of the named variable as a string' do
- tag = build_tag('set_vars', :myVar => curr_value[:input_text])
- @page.should render(tag + '<r:puts value_for="myVar" />').
- as(curr_value[:result].to_s)
- end
-
- end
-
-
-
-
describe "<r:snippets> tag" do
- it 'should read any attribute (other than "name") into a variable' do
+ it 'should set any attribute (other than "name") into a variable' do
create_snippet 'a snippet', :content => evaluate_var('myVar')
tag = build_tag('snippet', :name => 'a snippet', :myVar => curr_value[:input_text])
@page.should render(tag).and_evaluate_as(curr_value[:result])
@@ -138,7 +109,7 @@
describe '<r:content> tag' do
- it 'should read any attribute (other than "name") into a variable' do
+ it 'should set any attribute (other than "name") into a variable' do
create_page_part 'other part', :page_id => @page.id, :content => evaluate_var('myVar')
tag = build_tag('content', :part => 'other part', :myVar => curr_value[:input_text])
@page.should render(tag).and_evaluate_as(curr_value[:result])
@@ -194,27 +165,4 @@
end
-
-
-
- describe '<r:puts value_for="*all*">' do
-
- it 'should render all of the current variables sorted by name' do
- create_snippet 'snippet 1', :content => '<r:snippet name="snippet 2" d="high" b="score" />'
- create_snippet 'snippet 2', :content => '<r:content part="other part" d="years" a="ago" />'
- create_page_part 'other part', :page_id => @page.id, :content => '<r:content part="another part" c="7" a="4" />'
- create_page_part 'another part', :page_id => @page.id, :content => '<r:puts value_for="*all*" />'
- @page.should render('<r:set_vars empty="nil" final="98.6" />' +
- '<r:snippet name="snippet 1" b="true" c="a string" d="nil" a="10" />').
- as("Current Variables:\n" +
- " a = 4.0\n" +
- " b = \"score\"\n" +
- " c = 7.0\n" +
- " d = \"years\"\n" +
- " empty = nil\n" +
- " final = 98.6\n"
- )
- end
-
- end
end
Please sign in to comment.
Something went wrong with that request. Please try again.