comfortable_mexican_sofa 1.0.11 → 1.0.12

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -14,7 +14,7 @@ Add gem definition to your Gemfile:
14
14
  config.gem 'comfortable_mexican_sofa'
15
15
 
16
16
  Then from the Rails project's root run:
17
-
17
+
18
18
  bundle install
19
19
  rails g cms
20
20
  rake db:migrate
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.11
1
+ 1.0.12
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{comfortable_mexican_sofa}
8
- s.version = "1.0.11"
8
+ s.version = "1.0.12"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Oleg Khabarov", "The Working Group Inc"]
12
- s.date = %q{2010-11-01}
12
+ s.date = %q{2010-11-03}
13
13
  s.description = %q{}
14
14
  s.email = %q{oleg@theworkinggroup.ca}
15
15
  s.extra_rdoc_files = [
@@ -6,7 +6,7 @@
6
6
  # end
7
7
  module CmsTag
8
8
 
9
- TOKENIZER_REGEX = /(\{\{\s*cms:.*?\}\})|((?:[^\{\{]|\{\{(?!\s*cms:.*?\}\}))+)/
9
+ TOKENIZER_REGEX = /(\{\{\s*cms:[^{}]*\}\})|((?:\{?[^{])+|\{+)/
10
10
 
11
11
  attr_accessor :params,
12
12
  :parent
@@ -5,13 +5,25 @@ class CmsTagTest < ActiveSupport::TestCase
5
5
  def test_tokenizer_regex
6
6
  regex = CmsTag::TOKENIZER_REGEX
7
7
 
8
+ tokens = 'text { text } text'.scan(regex)
9
+ assert_equal nil, tokens[0][0]
10
+ assert_equal 'text { text } text', tokens[0][1]
11
+
8
12
  tokens = 'content<{{cms:some_tag content'.scan(regex)
9
- assert_equal nil, tokens[0][0]
10
- assert_equal 'content<{{cms:some_tag content', tokens[0][1]
13
+ assert_equal nil, tokens[0][0]
14
+ assert_equal 'content<', tokens[0][1]
15
+ assert_equal nil, tokens[1][0]
16
+ assert_equal '{{', tokens[1][1]
17
+ assert_equal nil, tokens[2][0]
18
+ assert_equal 'cms:some_tag content', tokens[2][1]
11
19
 
12
20
  tokens = 'content<{{cms some_tag}}>content'.scan(regex)
13
- assert_equal nil, tokens[0][0]
14
- assert_equal 'content<{{cms some_tag}}>content', tokens[0][1]
21
+ assert_equal nil, tokens[0][0]
22
+ assert_equal 'content<', tokens[0][1]
23
+ assert_equal nil, tokens[1][0]
24
+ assert_equal '{{', tokens[1][1]
25
+ assert_equal nil, tokens[2][0]
26
+ assert_equal 'cms some_tag}}>content',tokens[2][1]
15
27
 
16
28
  tokens = 'content<{{cms:some_tag}}>content'.scan(regex)
17
29
  assert_equal nil, tokens[0][0]
@@ -32,6 +32,10 @@ class PartialTest < ActiveSupport::TestCase
32
32
  assert_equal "<%= render :partial => 'path/to/partial' %>", tag.content
33
33
  assert_equal "<%= render :partial => 'path/to/partial' %>", tag.render
34
34
 
35
+ tag = CmsTag::Partial.initialize_tag(cms_pages(:default), '{{cms:partial:path/to/partial:param1}}')
36
+ assert_equal "<%= render :partial => 'path/to/partial', :locals => {:param_1 => 'param1'} %>", tag.content
37
+ assert_equal "<%= render :partial => 'path/to/partial', :locals => {:param_1 => 'param1'} %>", tag.render
38
+
35
39
  tag = CmsTag::Partial.initialize_tag(cms_pages(:default), '{{cms:partial:path/to/partial:param1:param2}}')
36
40
  assert_equal "<%= render :partial => 'path/to/partial', :locals => {:param_1 => 'param1', :param_2 => 'param2'} %>", tag.content
37
41
  assert_equal "<%= render :partial => 'path/to/partial', :locals => {:param_1 => 'param1', :param_2 => 'param2'} %>", tag.render
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comfortable_mexican_sofa
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 11
10
- version: 1.0.11
9
+ - 12
10
+ version: 1.0.12
11
11
  platform: ruby
12
12
  authors:
13
13
  - Oleg Khabarov
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-11-01 00:00:00 -04:00
19
+ date: 2010-11-03 00:00:00 -04:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency