shortcode 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e0988a6e1f0ecb12fe3fed784a3510ed7453844
4
- data.tar.gz: 172791fe6e082acf4f886c0c579634f5512c3e35
3
+ metadata.gz: 314fc72e3ebd9b6705c95087c2c509123ffc239e
4
+ data.tar.gz: 705924df01ce2a39709ddf99fae925fadc23348f
5
5
  SHA512:
6
- metadata.gz: 0920cdbdfa0c5dd301e7f4a9ee6120222a97a3ee0603407f2d6938b89934801ebc5070ea4e00035b1f214a0dcf3ae218af2d5c249687d90f012a932f8a87eb3e
7
- data.tar.gz: 21c39fe3f962bbfe73e9a91c337dc2d52243711d9688b7e813c10ee92f1e8ab6a6c0a5d17d21aec65aed7a8ddffcd9eb02620e774f690e0486239b63f0245121
6
+ metadata.gz: 1dc80f9880a0ef8db9a4bc1fe978083ca8de474114cd6a28250f064f77f25e4ecb87750f4233ad3b38dd7160f6baac3f876f8b31fac1ccde2ea5e57b0368eb21
7
+ data.tar.gz: 52b2eeabbeb6fbf67583c6dedacf97617ea1c7afdab506fa90eae7ddb9687e545dd516d68405669495b06721cb67e8e0d2e08ffc0c0b64285c07581b89d797cb
data/.travis.yml CHANGED
@@ -1,9 +1,9 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
- - 2.0.0-p598
5
- - 2.1.6
6
- - 2.2.2
4
+ - 2.0.0-p647
5
+ - 2.1.7
6
+ - 2.2.3
7
7
  - ruby-head
8
8
  - jruby-19mode
9
9
  - jruby-head
@@ -12,6 +12,9 @@ sudo: false
12
12
 
13
13
  script: bundle exec rspec
14
14
 
15
+ before_install:
16
+ - gem install bundler -v 1.10.6
17
+
15
18
  matrix:
16
19
  allow_failures:
17
20
  - rvm: ruby-head
data/Appraisals CHANGED
@@ -7,9 +7,9 @@ appraise "rails-4.0" do
7
7
  end
8
8
 
9
9
  appraise "rails-4.1" do
10
- gem "rails", "~> 4.1.10"
10
+ gem "rails", "~> 4.1.13"
11
11
  end
12
12
 
13
13
  appraise "rails-4.2" do
14
- gem "rails", "4.2.1"
14
+ gem "rails", "4.2.4"
15
15
  end
data/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ ## 1.1.1 (September 14, 2015)
2
+
3
+ Features:
4
+
5
+ - Updated to parslet 1.7.1
6
+ - Updated to rspec 3.3
7
+
8
+ Fixes:
9
+
10
+ - The order registered tags are defined no longer causes parsing to work incorrectly
11
+
12
+ Misc:
13
+
14
+ - Testing against the latest versions of Rails 4.1 & 4.2
15
+
1
16
  ## 1.1.0 (May 15, 2015)
2
17
 
3
18
  Features:
data/Gemfile CHANGED
@@ -3,4 +3,4 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in shortcode.gemspec
4
4
  gemspec
5
5
 
6
- gem 'appraisal', '2.0.1'
6
+ gem 'appraisal', '2.1.0'
data/Gemfile.lock CHANGED
@@ -1,25 +1,18 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shortcode (1.1.0)
5
- parslet (= 1.7.0)
4
+ shortcode (1.1.1)
5
+ parslet (= 1.7.1)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activesupport (4.2.1)
11
- i18n (~> 0.7)
12
- json (~> 1.7, >= 1.7.7)
13
- minitest (~> 5.1)
14
- thread_safe (~> 0.3, >= 0.3.4)
15
- tzinfo (~> 1.1)
16
- appraisal (2.0.1)
17
- activesupport (>= 3.2.21)
10
+ appraisal (2.1.0)
18
11
  bundler
19
12
  rake
20
13
  thor (>= 0.14.0)
21
14
  blankslate (3.1.3)
22
- coveralls (0.8.1)
15
+ coveralls (0.8.2)
23
16
  json (~> 1.8)
24
17
  rest-client (>= 1.6.8, < 2)
25
18
  simplecov (~> 0.10.0)
@@ -29,52 +22,47 @@ GEM
29
22
  docile (1.1.5)
30
23
  domain_name (0.5.24)
31
24
  unf (>= 0.0.5, < 1.0.0)
32
- haml (4.0.6)
25
+ haml (4.0.7)
33
26
  tilt
34
27
  http-cookie (1.0.2)
35
28
  domain_name (~> 0.5)
36
- i18n (0.7.0)
37
- json (1.8.2)
38
- mime-types (2.5)
39
- minitest (5.6.1)
29
+ json (1.8.3)
30
+ mime-types (2.6.2)
40
31
  netrc (0.10.3)
41
- parslet (1.7.0)
32
+ parslet (1.7.1)
42
33
  blankslate (>= 2.0, <= 4.0)
43
34
  rake (10.4.2)
44
35
  rest-client (1.8.0)
45
36
  http-cookie (>= 1.0.2, < 2.0)
46
37
  mime-types (>= 1.16, < 3.0)
47
38
  netrc (~> 0.7)
48
- rspec (3.2.0)
49
- rspec-core (~> 3.2.0)
50
- rspec-expectations (~> 3.2.0)
51
- rspec-mocks (~> 3.2.0)
52
- rspec-core (3.2.3)
53
- rspec-support (~> 3.2.0)
54
- rspec-expectations (3.2.1)
39
+ rspec (3.3.0)
40
+ rspec-core (~> 3.3.0)
41
+ rspec-expectations (~> 3.3.0)
42
+ rspec-mocks (~> 3.3.0)
43
+ rspec-core (3.3.2)
44
+ rspec-support (~> 3.3.0)
45
+ rspec-expectations (3.3.1)
55
46
  diff-lcs (>= 1.2.0, < 2.0)
56
- rspec-support (~> 3.2.0)
57
- rspec-mocks (3.2.1)
47
+ rspec-support (~> 3.3.0)
48
+ rspec-mocks (3.3.2)
58
49
  diff-lcs (>= 1.2.0, < 2.0)
59
- rspec-support (~> 3.2.0)
60
- rspec-support (3.2.2)
50
+ rspec-support (~> 3.3.0)
51
+ rspec-support (3.3.0)
61
52
  simplecov (0.10.0)
62
53
  docile (~> 1.1.0)
63
54
  json (~> 1.8)
64
55
  simplecov-html (~> 0.10.0)
65
56
  simplecov-html (0.10.0)
66
- slim (3.0.3)
57
+ slim (3.0.6)
67
58
  temple (~> 0.7.3)
68
59
  tilt (>= 1.3.3, < 2.1)
69
- temple (0.7.5)
70
- term-ansicolor (1.3.0)
60
+ temple (0.7.6)
61
+ term-ansicolor (1.3.2)
71
62
  tins (~> 1.0)
72
63
  thor (0.19.1)
73
- thread_safe (0.3.5)
74
64
  tilt (2.0.1)
75
- tins (1.5.1)
76
- tzinfo (1.2.2)
77
- thread_safe (~> 0.1)
65
+ tins (1.6.0)
78
66
  unf (0.1.4)
79
67
  unf_ext
80
68
  unf_ext (0.0.7.1)
@@ -83,11 +71,14 @@ PLATFORMS
83
71
  ruby
84
72
 
85
73
  DEPENDENCIES
86
- appraisal (= 2.0.1)
87
- bundler (~> 1.3)
74
+ appraisal (= 2.1.0)
75
+ bundler (~> 1.10)
88
76
  coveralls (~> 0)
89
77
  haml (~> 4.0)
90
78
  rake (~> 10.4)
91
- rspec (~> 3.1)
79
+ rspec (~> 3.3)
92
80
  shortcode!
93
81
  slim (~> 3.0)
82
+
83
+ BUNDLED WITH
84
+ 1.10.6
data/README.md CHANGED
@@ -40,9 +40,23 @@ Shortcode is very simple to use, simply call the `process` method and pass it a
40
40
  Shortcode.process("[quote]Hello World[/quote]")
41
41
  ```
42
42
 
43
+ In a Rails app, you can create helper methods to handle your shortcoded content and use them in your views with something similar to `<%= content_html @page.content %>`. Those two helper method can be used if your content contains html to be escaped or not.
44
+
45
+ ```ruby
46
+ module PagesHelper
47
+ def content(c)
48
+ Shortcode.process(c)
49
+ end
50
+
51
+ def content_html(c)
52
+ raw content(c)
53
+ end
54
+ end
55
+ ```
56
+
43
57
  ### Tags
44
58
 
45
- Any tags you wish to use with Shortcode need to be configured in the setup block, there are 2 types of tag, `block_tags` and `self_closing_tags`. Block tags have a matching open and close tag such as `[quote]A quote[/quote]`, self closing tags have no close tag, for example `[gallery]`. To define the tags Shortcode should parse do so in the configuration as follows:
59
+ Any tags you wish to use with Shortcode need to be configured in the setup block, there are 2 types of tag, `block_tags` and `self_closing_tags`. Block tags have a matching open and close tag such as `[quote]A quote[/quote]`, self closing tags have no close tag, for example `[gallery]`. To define the tags Shortcode should parse do so in the configuration (in a Rails initializer for example) as follows:
46
60
 
47
61
  ```ruby
48
62
  Shortcode.setup do |config|
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "appraisal", "2.0.1"
5
+ gem "appraisal", "2.1.0"
6
6
  gem "rails", "~> 3.2.21"
7
7
 
8
8
  gemspec :path => "../"
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "appraisal", "2.0.1"
5
+ gem "appraisal", "2.1.0"
6
6
  gem "rails", "~> 4.0.13"
7
7
 
8
8
  gemspec :path => "../"
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "appraisal", "2.0.1"
6
- gem "rails", "~> 4.1.10"
5
+ gem "appraisal", "2.1.0"
6
+ gem "rails", "~> 4.1.13"
7
7
 
8
8
  gemspec :path => "../"
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "appraisal", "2.0.1"
6
- gem "rails", "4.2.1"
5
+ gem "appraisal", "2.1.0"
6
+ gem "rails", "4.2.4"
7
7
 
8
8
  gemspec :path => "../"
@@ -12,10 +12,16 @@ class Shortcode::Configuration
12
12
  attr_accessor :helpers
13
13
 
14
14
  # Set the supported block_tags
15
- attr_accessor :block_tags
15
+ attr_reader :block_tags
16
+ def block_tags=(block_tags)
17
+ @block_tags = block_tags.sort_by(&:length).reverse
18
+ end
16
19
 
17
20
  # Set the supported self_closing_tags
18
- attr_accessor :self_closing_tags
21
+ attr_reader :self_closing_tags
22
+ def self_closing_tags=(self_closing_tags)
23
+ @self_closing_tags = self_closing_tags.sort_by(&:length).reverse
24
+ end
19
25
 
20
26
  # Set the quotation sign used for attribute values. Defaults to double quote (")
21
27
  attr_accessor :attribute_quote_type
@@ -1,3 +1,3 @@
1
1
  module Shortcode
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
data/shortcode.gemspec CHANGED
@@ -18,11 +18,11 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "parslet", "1.7.0"
21
+ spec.add_dependency "parslet", "1.7.1"
22
22
 
23
- spec.add_development_dependency "bundler", "~> 1.3"
23
+ spec.add_development_dependency "bundler", "~> 1.10"
24
24
  spec.add_development_dependency "rake", "~> 10.4"
25
- spec.add_development_dependency "rspec", "~> 3.1"
25
+ spec.add_development_dependency "rspec", "~> 3.3"
26
26
  spec.add_development_dependency "coveralls", "~> 0"
27
27
  spec.add_development_dependency "slim", "~> 3.0"
28
28
  spec.add_development_dependency "haml", "~> 4.0"
data/spec/parser_spec.rb CHANGED
@@ -26,6 +26,46 @@ describe Shortcode::Parser do
26
26
  end
27
27
  end
28
28
 
29
+ describe "matching similar tags" do
30
+
31
+ context "with the smaller tag listed first" do
32
+
33
+ before do
34
+ Shortcode.setup do |config|
35
+ config.block_tags = [:xx, :xxx]
36
+ end
37
+ end
38
+
39
+ it "parses xx" do
40
+ expect(parser.open).to parse("[xx]")
41
+ end
42
+
43
+ it "parses xxx" do
44
+ expect(parser.open).to parse("[xxx]")
45
+ end
46
+
47
+ end
48
+
49
+ context "with the smaller tag listed last" do
50
+
51
+ before do
52
+ Shortcode.setup do |config|
53
+ config.block_tags = [:xxx, :xx]
54
+ end
55
+ end
56
+
57
+ it "parses xx" do
58
+ expect(parser.open).to parse("[xx]")
59
+ end
60
+
61
+ it "parses xxx" do
62
+ expect(parser.open).to parse("[xxx]")
63
+ end
64
+
65
+ end
66
+
67
+ end
68
+
29
69
  context "attribute_quote_type configuration" do
30
70
 
31
71
  before do
data/spec/spec_helper.rb CHANGED
@@ -12,7 +12,7 @@ require 'shortcode'
12
12
  require 'support/fixtures'
13
13
 
14
14
  # Set slim's attribute quotes to use single quotes so it's the same as haml
15
- Slim::Engine.set_default_options attr_quote: "'"
15
+ Slim::Engine.set_options attr_quote: "'"
16
16
 
17
17
  RSpec.configure do |config|
18
18
  config.order = "random"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shortcode
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamie Dyer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-15 00:00:00.000000000 Z
11
+ date: 2015-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parslet
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.7.0
19
+ version: 1.7.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 1.7.0
26
+ version: 1.7.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.3'
33
+ version: '1.10'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.3'
40
+ version: '1.10'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '3.1'
61
+ version: '3.3'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '3.1'
68
+ version: '3.3'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: coveralls
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -221,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
221
221
  version: '0'
222
222
  requirements: []
223
223
  rubyforge_project:
224
- rubygems_version: 2.4.5
224
+ rubygems_version: 2.4.8
225
225
  signing_key:
226
226
  specification_version: 4
227
227
  summary: Gem for parsing wordpress style shortcodes in ruby projects