vanilla 1.9.15.1 → 1.9.15.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -25,7 +25,7 @@ if Object.const_defined?(:Gem)
25
25
 
26
26
  # Change these as appropriate
27
27
  s.name = "vanilla"
28
- s.version = "1.9.15.1"
28
+ s.version = "1.9.15.2"
29
29
  s.summary = "A bliki-type web content thing."
30
30
  s.author = "James Adam"
31
31
  s.email = "james@lazyatom.com.com"
@@ -27,7 +27,7 @@ module Vanilla
27
27
  end
28
28
 
29
29
  def self.snip_regexp
30
- %r{(\{[^\}.]+\})}
30
+ %r{(\{[\w\-_\d]+(\s+[^\}.]+)?\})}
31
31
  end
32
32
 
33
33
  # Default behaviour to include a snip's content
@@ -0,0 +1,47 @@
1
+ require File.join(File.dirname(__FILE__), *%w[test_helper])
2
+
3
+ class SnipReferenceTest < Vanilla::TestCase
4
+ def setup
5
+ super
6
+ create_snip :name => "test", :content => "snip content"
7
+ end
8
+
9
+ should "match simple snips" do
10
+ assert_equal "rendering snip content", render("rendering {test}")
11
+ end
12
+
13
+ should "match snips with an argument" do
14
+ assert_equal "rendering snip content", render("rendering {test arg1}")
15
+ end
16
+
17
+ should "match snips with several arguments" do
18
+ assert_equal "rendering snip content", render("rendering {test arg1, arg2}")
19
+ end
20
+
21
+ should "match snips with hyphens" do
22
+ create_snip :name => "test-snip", :content => "snip content"
23
+ assert_equal "rendering snip content", render("rendering {test-snip}")
24
+ end
25
+
26
+ should "match snips with underscores" do
27
+ create_snip :name => "test_snip", :content => "snip content"
28
+ assert_equal "rendering snip content", render("rendering {test_snip}")
29
+ end
30
+
31
+ should "match snips with numbers" do
32
+ create_snip :name => "test1", :content => "snip content"
33
+ assert_equal "rendering snip content", render("rendering {test1}")
34
+ end
35
+
36
+ should "ignore references that are rubyish" do
37
+ assert_equal "10.times { |x| puts x }", render("10.times { |x| puts x }")
38
+ assert_equal "10.times {|x| puts x }", render("10.times {|x| puts x }")
39
+ end
40
+
41
+ private
42
+
43
+ def render(content)
44
+ snip = create_snip :name => "test-content", :content => content
45
+ Vanilla::Renderers::Base.new(@app).render(snip)
46
+ end
47
+ end
@@ -1,6 +1,7 @@
1
1
  CurrentSnip--- # Soup attributes
2
- :updated_at: 2009-11-24 11:25:40.019881 +00:00
2
+ :created_at: 2009-11-30 23:14:12.070423 +00:00
3
3
  :name: current_snip
4
+ :updated_at: 2009-11-30 23:14:12.070425 +00:00
4
5
  :render_as: Ruby
5
6
  :usage: |-
6
7
  The current_snip dyna normally returns the result of rendering the snip named by the
@@ -12,4 +13,3 @@ CurrentSnip--- # Soup attributes
12
13
  &#123;current_snip name&#125;
13
14
 
14
15
  will output the name of the current snip, or the name of the snip currently being edited.
15
- :created_at: 2009-11-24 11:25:40.019878 +00:00
@@ -1,5 +1,5 @@
1
1
  --- # Soup attributes
2
- :updated_at: 2009-11-24 11:25:40.020545 +00:00
2
+ :created_at: 2009-11-30 23:14:12.071138 +00:00
3
3
  :name: system
4
+ :updated_at: 2009-11-30 23:14:12.071141 +00:00
4
5
  :main_template: "{current_snip}"
5
- :created_at: 2009-11-24 11:25:40.020543 +00:00
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vanilla
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.15.1
4
+ version: 1.9.15.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Adam
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-24 00:00:00 +00:00
12
+ date: 2009-11-30 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -122,7 +122,8 @@ files:
122
122
  - test/markdown_renderer_test.rb
123
123
  - test/raw_renderer_test.rb
124
124
  - test/ruby_renderer_test.rb
125
- - test/snip_parser_test.rb
125
+ - test/snip_reference_parser_test.rb
126
+ - test/snip_reference_test.rb
126
127
  - test/test_helper.rb
127
128
  - test/tmp/config.yml
128
129
  - test/tmp/soup/current_snip.yml