shortcode 0.3.1 → 0.3.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.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shortcode (0.3.1)
4
+ shortcode (0.3.2)
5
5
  haml (~> 4.0)
6
6
  parslet (= 1.6.0)
7
7
 
@@ -43,6 +43,10 @@ GEM
43
43
  multi_json
44
44
  simplecov-html (~> 0.8.0)
45
45
  simplecov-html (0.8.0)
46
+ slim (2.0.2)
47
+ temple (~> 0.6.6)
48
+ tilt (>= 1.3.3, < 2.1)
49
+ temple (0.6.7)
46
50
  term-ansicolor (1.3.0)
47
51
  tins (~> 1.0)
48
52
  thor (0.18.1)
@@ -59,3 +63,4 @@ DEPENDENCIES
59
63
  rake
60
64
  rspec
61
65
  shortcode!
66
+ slim (~> 2.0)
data/README.md CHANGED
@@ -46,7 +46,7 @@ Shortcode.process("[quote]Hello World[/quote]")
46
46
  Shortcode.setup do |config|
47
47
 
48
48
  # the template parser to use
49
- config.template_parser = :haml # :erb or :haml supported, :haml is default
49
+ config.template_parser = :haml # :erb, :haml, :slim supported, :haml is default
50
50
 
51
51
  # location of the template files, default is "app/views/shortcode_templates"
52
52
  config.template_path = "support/templates/haml"
@@ -1,5 +1,10 @@
1
1
  require 'parslet'
2
2
  require 'haml'
3
+
4
+ begin
5
+ require 'slim'
6
+ rescue LoadError; end
7
+
3
8
  require 'erb'
4
9
 
5
10
  module Shortcode
@@ -1,8 +1,8 @@
1
1
  class Shortcode::Configuration
2
- # Sets the template parser to use, supports :erb and :haml, default is :haml
2
+ # Sets the template parser to use, supports :erb, :haml, and :slim, default is :haml
3
3
  attr_accessor :template_parser
4
4
 
5
- # Sets the template parser to use, supports :erb and :haml, default is :haml
5
+ # Sets the path to search for template files
6
6
  attr_accessor :template_path
7
7
 
8
8
  # Allows templates to be set from strings rather than read from the filesystem
@@ -29,6 +29,8 @@ class Shortcode::Tag
29
29
 
30
30
  def render_template
31
31
  case Shortcode.configuration.template_parser
32
+ when :slim
33
+ Slim::Template.new { markup }.render(self)
32
34
  when :haml
33
35
  Haml::Engine.new(markup, ugly: true).render(binding)
34
36
  when :erb
@@ -1,3 +1,3 @@
1
1
  module Shortcode
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -25,4 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency "rake"
26
26
  spec.add_development_dependency "rspec"
27
27
  spec.add_development_dependency "coveralls"
28
+ spec.add_development_dependency "slim", "~> 2.0"
28
29
  end
@@ -3,9 +3,25 @@ require 'spec_helper'
3
3
  describe "rails helpers" do
4
4
 
5
5
  let(:template) { load_fixture :rails_helper }
6
+ let(:slim_output) { load_fixture :rails_helper_output_slim, :html }
6
7
  let(:haml_output) { load_fixture :rails_helper_output_haml, :html }
7
8
  let(:erb_output) { load_fixture :rails_helper_output_erb, :html }
8
9
 
10
+ describe "slim" do
11
+
12
+ before(:each) do
13
+ Shortcode.setup do |config|
14
+ config.template_parser = :slim
15
+ config.template_path = File.join File.dirname(__FILE__), "support/templates/slim"
16
+ end
17
+ end
18
+
19
+ it "are accessible within slim templates" do
20
+ Shortcode.process(template).gsub("\n",'').should == slim_output.gsub("\n",'')
21
+ end
22
+
23
+ end
24
+
9
25
  describe "haml" do
10
26
 
11
27
  it "are accessible within haml templates" do
@@ -0,0 +1 @@
1
+ = content_tag :i, @content
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shortcode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -107,6 +107,22 @@ dependencies:
107
107
  - - ! '>='
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: slim
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: '2.0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: '2.0'
110
126
  description: Gem for parsing wordpress style shortcodes
111
127
  email:
112
128
  - jamie@kernowsoul.com
@@ -156,6 +172,7 @@ files:
156
172
  - spec/support/fixtures/rails_helper.txt
157
173
  - spec/support/fixtures/rails_helper_output_erb.html
158
174
  - spec/support/fixtures/rails_helper_output_haml.html
175
+ - spec/support/fixtures/rails_helper_output_slim.html
159
176
  - spec/support/fixtures/simple_list.txt
160
177
  - spec/support/fixtures/simple_list_output.html
161
178
  - spec/support/fixtures/simple_quote.txt
@@ -177,6 +194,7 @@ files:
177
194
  - spec/support/templates/haml/timeline_event.html.haml
178
195
  - spec/support/templates/haml/timeline_info.html.haml
179
196
  - spec/support/templates/haml/timeline_person.html.haml
197
+ - spec/support/templates/slim/rails_helper.html.slim
180
198
  - spec/tag_spec.rb
181
199
  - spec/transformer_spec.rb
182
200
  homepage: https://github.com/kernow/shortcode
@@ -222,6 +240,7 @@ test_files:
222
240
  - spec/support/fixtures/rails_helper.txt
223
241
  - spec/support/fixtures/rails_helper_output_erb.html
224
242
  - spec/support/fixtures/rails_helper_output_haml.html
243
+ - spec/support/fixtures/rails_helper_output_slim.html
225
244
  - spec/support/fixtures/simple_list.txt
226
245
  - spec/support/fixtures/simple_list_output.html
227
246
  - spec/support/fixtures/simple_quote.txt
@@ -243,5 +262,6 @@ test_files:
243
262
  - spec/support/templates/haml/timeline_event.html.haml
244
263
  - spec/support/templates/haml/timeline_info.html.haml
245
264
  - spec/support/templates/haml/timeline_person.html.haml
265
+ - spec/support/templates/slim/rails_helper.html.slim
246
266
  - spec/tag_spec.rb
247
267
  - spec/transformer_spec.rb