vanilla 1.11.0 → 1.11.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -24,7 +24,7 @@ if Object.const_defined?(:Gem)
24
24
 
25
25
  # Change these as appropriate
26
26
  s.name = "vanilla"
27
- s.version = "1.11.0"
27
+ s.version = "1.11.1"
28
28
  s.summary = "A bliki-type web content thing."
29
29
  s.author = "James Adam"
30
30
  s.email = "james@lazyatom.com.com"
@@ -41,7 +41,7 @@ if Object.const_defined?(:Gem)
41
41
 
42
42
  # All the other gems we need.
43
43
  s.add_dependency("rack", ">= 0.9.1")
44
- s.add_dependency("soup", ">= 0.9.10")
44
+ s.add_dependency("soup", ">= 0.9.12")
45
45
  s.add_dependency("ratom", ">= 0.3.5")
46
46
  s.add_dependency("RedCloth", ">= 4.1.1")
47
47
  s.add_dependency("BlueCloth", ">= 1.0.0")
@@ -5,31 +5,31 @@ module Vanilla
5
5
  module Renderers
6
6
  class Base
7
7
  include Routes
8
-
8
+
9
9
  # Render a snip.
10
10
  def self.render(snip, part=:content)
11
11
  new(app).render(snip, part)
12
12
  end
13
-
13
+
14
14
  def self.escape_curly_braces(str)
15
15
  str.gsub("{", "{").gsub("}", "}")
16
16
  end
17
-
17
+
18
18
  attr_reader :app
19
-
19
+
20
20
  def initialize(app)
21
21
  @app = app
22
22
  end
23
-
23
+
24
24
  # defined for the routes
25
25
  def soup
26
26
  @app.soup
27
27
  end
28
-
28
+
29
29
  def self.snip_regexp
30
30
  %r{(\{[\w\-_\d]+(\s+[^\}.]+)?\})}
31
31
  end
32
-
32
+
33
33
  # Default behaviour to include a snip's content
34
34
  def include_snips(content, enclosing_snip)
35
35
  content.gsub(Vanilla::Renderers::Base.snip_regexp) do
@@ -38,7 +38,7 @@ module Vanilla
38
38
  snip_name = snip_tree.snip
39
39
  snip_attribute = snip_tree.attribute
40
40
  snip_args = snip_tree.arguments
41
-
41
+
42
42
  # Render the snip or snip part with the given args, and the current
43
43
  # context, but with the default renderer for that snip. We dispatch
44
44
  # *back* out to the root Vanilla.render method to do this.
@@ -53,36 +53,36 @@ module Vanilla
53
53
  end
54
54
  end
55
55
  end
56
-
56
+
57
57
  def parse_snip_reference(string)
58
58
  @parser ||= SnipReferenceParser.new
59
59
  @parser.parse(string)
60
60
  end
61
-
61
+
62
62
  # Default rendering behaviour. Subclasses shouldn't really need to touch this.
63
63
  def render(snip, part=:content, args=[], enclosing_snip=snip)
64
64
  prepare(snip, part, args, enclosing_snip)
65
65
  processed_text = render_without_including_snips(snip, part)
66
66
  include_snips(processed_text, snip)
67
67
  end
68
-
68
+
69
69
  # Subclasses should override this to perform any actions required before
70
70
  # rendering
71
71
  def prepare(snip, part, args, enclosing_snip)
72
72
  # do nothing, by default
73
73
  end
74
-
74
+
75
75
  def render_without_including_snips(snip, part=:content)
76
76
  process_text(raw_content(snip, part))
77
77
  end
78
-
79
- # Handles processing the text of the content.
80
- # Subclasses should override this method to do fancy text processing
78
+
79
+ # Handles processing the text of the content.
80
+ # Subclasses should override this method to do fancy text processing
81
81
  # like markdown, or loading the content as Ruby code.
82
82
  def process_text(content)
83
83
  content
84
84
  end
85
-
85
+
86
86
  # Returns the raw content for the selected part of the selected snip
87
87
  def raw_content(snip, part)
88
88
  snip.__send__((part || :content).to_sym)
@@ -5,41 +5,41 @@ class SnipReferenceTest < Vanilla::TestCase
5
5
  super
6
6
  create_snip :name => "test", :content => "snip content"
7
7
  end
8
-
8
+
9
9
  should "match simple snips" do
10
10
  assert_equal "rendering snip content", render("rendering {test}")
11
11
  end
12
-
12
+
13
13
  should "match snips with an argument" do
14
14
  assert_equal "rendering snip content", render("rendering {test arg1}")
15
15
  end
16
-
16
+
17
17
  should "match snips with several arguments" do
18
18
  assert_equal "rendering snip content", render("rendering {test arg1, arg2}")
19
19
  end
20
-
20
+
21
21
  should "match snips with hyphens" do
22
22
  create_snip :name => "test-snip", :content => "snip content"
23
23
  assert_equal "rendering snip content", render("rendering {test-snip}")
24
24
  end
25
-
25
+
26
26
  should "match snips with underscores" do
27
27
  create_snip :name => "test_snip", :content => "snip content"
28
28
  assert_equal "rendering snip content", render("rendering {test_snip}")
29
29
  end
30
-
30
+
31
31
  should "match snips with numbers" do
32
32
  create_snip :name => "test1", :content => "snip content"
33
33
  assert_equal "rendering snip content", render("rendering {test1}")
34
34
  end
35
-
35
+
36
36
  should "ignore references that are rubyish" do
37
37
  assert_equal "10.times { |x| puts x }", render("10.times { |x| puts x }")
38
38
  assert_equal "10.times {|x| puts x }", render("10.times {|x| puts x }")
39
39
  end
40
-
40
+
41
41
  private
42
-
42
+
43
43
  def render(content)
44
44
  snip = create_snip :name => "test-content", :content => content
45
45
  Vanilla::Renderers::Base.new(@app).render(snip)
data/test/test_helper.rb CHANGED
@@ -75,4 +75,8 @@ class Vanilla::TestCase < Test::Unit::TestCase
75
75
  def setup
76
76
  setup_clean_environment
77
77
  end
78
+
79
+ def test_nothing
80
+ # please, please stop complaining.
81
+ end
78
82
  end
@@ -9,7 +9,7 @@ CurrentSnip--- # Soup attributes
9
9
  &#123;current_snip name&#125;
10
10
 
11
11
  will output the name of the current snip, or the name of the snip currently being edited.
12
- :updated_at: 2010-06-10 15:00:13.119623 +01:00
13
- :render_as: Ruby
12
+ :updated_at: 2010-07-14 12:51:59.809435 +01:00
14
13
  :name: current_snip
15
- :created_at: 2010-06-10 15:00:13.119621 +01:00
14
+ :created_at: 2010-07-14 12:51:59.809433 +01:00
15
+ :render_as: Ruby
@@ -1,5 +1,5 @@
1
1
  --- # Soup attributes
2
- :updated_at: 2010-06-10 15:00:13.120125 +01:00
2
+ :updated_at: 2010-07-14 12:51:59.809910 +01:00
3
3
  :name: system
4
+ :created_at: 2010-07-14 12:51:59.809908 +01:00
4
5
  :main_template: "{current_snip}"
5
- :created_at: 2010-06-10 15:00:13.120123 +01:00
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 11
8
- - 0
9
- version: 1.11.0
8
+ - 1
9
+ version: 1.11.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - James Adam
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-06-10 00:00:00 +01:00
17
+ date: 2010-07-14 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -41,8 +41,8 @@ dependencies:
41
41
  segments:
42
42
  - 0
43
43
  - 9
44
- - 10
45
- version: 0.9.10
44
+ - 12
45
+ version: 0.9.12
46
46
  type: :runtime
47
47
  version_requirements: *id002
48
48
  - !ruby/object:Gem::Dependency
@@ -174,12 +174,10 @@ files:
174
174
  - test/ruby_renderer_test.rb
175
175
  - test/snip_reference_parser_test.rb
176
176
  - test/snip_reference_test.rb
177
- - test/soup/whatwhat.yml
178
177
  - test/test_helper.rb
179
178
  - test/tmp/config.yml
180
179
  - test/tmp/soup/current_snip.yml
181
180
  - test/tmp/soup/system.yml
182
- - test/tmp/soup/temp.yml
183
181
  - test/vanilla_app_test.rb
184
182
  - test/vanilla_presenting_test.rb
185
183
  - test/vanilla_request_test.rb
@@ -1,2 +0,0 @@
1
- --- # Soup attributes
2
- :name: whatwhat
@@ -1,4 +0,0 @@
1
- --- # Soup attributes
2
- :updated_at: 2010-06-10 15:00:13.120894 +01:00
3
- :name: temp
4
- :created_at: 2010-06-10 15:00:13 +01:00