diff --git a/.rbenv-version b/.rbenv-version index ae6d5b9..472a24d 100644 --- a/.rbenv-version +++ b/.rbenv-version @@ -1 +1 @@ -1.9.3-p392 +1.9.3-p547 \ No newline at end of file diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..5255835 --- /dev/null +++ b/.rspec @@ -0,0 +1,3 @@ +--color +--format documentation +--require spec_helper \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 855d884..12d3d93 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,54 +7,121 @@ PATH GEM remote: https://rubygems.org/ specs: + actionmailer (4.1.6) + actionpack (= 4.1.6) + actionview (= 4.1.6) + mail (~> 2.5, >= 2.5.4) + actionpack (4.1.6) + actionview (= 4.1.6) + activesupport (= 4.1.6) + rack (~> 1.5.2) + rack-test (~> 0.6.2) + actionview (4.1.6) + activesupport (= 4.1.6) + builder (~> 3.1) + erubis (~> 2.7.0) + activemodel (4.1.6) + activesupport (= 4.1.6) + builder (~> 3.1) + activerecord (4.1.6) + activemodel (= 4.1.6) + activesupport (= 4.1.6) + arel (~> 5.0.0) + activesupport (4.1.6) + i18n (~> 0.6, >= 0.6.9) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) + thread_safe (~> 0.1) + tzinfo (~> 1.1) appraisal (1.0.0) bundler rake thor (>= 0.14.0) + arel (5.0.1.20140414130214) blankslate (2.1.2.4) - coveralls (0.7.0) + builder (3.2.2) + coveralls (0.7.1) multi_json (~> 1.3) rest-client simplecov (>= 0.7) term-ansicolor thor diff-lcs (1.2.5) - docile (1.1.3) + docile (1.1.5) + erubis (2.7.0) haml (4.0.5) tilt - mime-types (2.2) + hike (1.2.3) + i18n (0.6.11) + json (1.8.1) + mail (2.6.1) + mime-types (>= 1.16, < 3) + mime-types (2.4.1) + minitest (5.4.2) multi_json (1.10.1) + netrc (0.7.7) parslet (1.6.0) blankslate (~> 2.0) - rake (10.1.0) - rest-client (1.6.7) - mime-types (>= 1.16) + rack (1.5.2) + rack-test (0.6.2) + rack (>= 1.0) + rails (4.1.6) + actionmailer (= 4.1.6) + actionpack (= 4.1.6) + actionview (= 4.1.6) + activemodel (= 4.1.6) + activerecord (= 4.1.6) + activesupport (= 4.1.6) + bundler (>= 1.3.0, < 2.0) + railties (= 4.1.6) + sprockets-rails (~> 2.0) + railties (4.1.6) + actionpack (= 4.1.6) + activesupport (= 4.1.6) + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (10.3.2) + rest-client (1.7.2) + mime-types (>= 1.16, < 3.0) + netrc (~> 0.7) rspec (3.0.0) rspec-core (~> 3.0.0) rspec-expectations (~> 3.0.0) rspec-mocks (~> 3.0.0) - rspec-core (3.0.0) + rspec-core (3.0.4) rspec-support (~> 3.0.0) - rspec-expectations (3.0.0) + rspec-expectations (3.0.4) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.0.0) - rspec-mocks (3.0.0) + rspec-mocks (3.0.4) rspec-support (~> 3.0.0) - rspec-support (3.0.0) - simplecov (0.8.2) + rspec-support (3.0.4) + simplecov (0.9.1) docile (~> 1.1.0) - multi_json + multi_json (~> 1.0) simplecov-html (~> 0.8.0) simplecov-html (0.8.0) - slim (2.0.2) + slim (2.0.3) temple (~> 0.6.6) tilt (>= 1.3.3, < 2.1) - temple (0.6.7) + sprockets (2.12.2) + hike (~> 1.2) + multi_json (~> 1.0) + rack (~> 1.0) + tilt (~> 1.1, != 1.3.0) + sprockets-rails (2.2.0) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (>= 2.8, < 4.0) + temple (0.6.8) term-ansicolor (1.3.0) tins (~> 1.0) - thor (0.18.1) - tilt (2.0.1) - tins (1.3.0) + thor (0.19.1) + thread_safe (0.3.4) + tilt (1.4.1) + tins (1.3.3) + tzinfo (1.2.2) + thread_safe (~> 0.1) PLATFORMS ruby @@ -64,6 +131,7 @@ DEPENDENCIES bundler (~> 1.3) coveralls haml (~> 4.0) + rails (~> 4.0) rake rspec (~> 3.0.0) shortcode! diff --git a/README.md b/README.md index 0d17fe7..b1e7964 100644 --- a/README.md +++ b/README.md @@ -214,7 +214,7 @@ Shortcode.setup do |config| config.self_closing_tags = [:youtube] # the type of quotes to use for attribute values, default is double quotes (") - config.attribute_quote_type = '"' + config.attribute_quote_type = /[\"']/ # Allows quotes around attributes to be omitted # Defaults to true, quotes must be present around attribute values diff --git a/lib/shortcode/configuration.rb b/lib/shortcode/configuration.rb index 80e27da..664ad3d 100644 --- a/lib/shortcode/configuration.rb +++ b/lib/shortcode/configuration.rb @@ -30,7 +30,7 @@ def initialize @helpers = [] @block_tags = [] @self_closing_tags = [] - @attribute_quote_type = '"' + @attribute_quote_type = /\"/ @use_attribute_quotes = true end end diff --git a/lib/shortcode/parser.rb b/lib/shortcode/parser.rb index 3853ef7..59af41c 100644 --- a/lib/shortcode/parser.rb +++ b/lib/shortcode/parser.rb @@ -3,7 +3,7 @@ class Shortcode::Parser < Parslet::Parser rule(:block_tag) { match_any_of Shortcode.configuration.block_tags } rule(:self_closing_tag) { match_any_of Shortcode.configuration.self_closing_tags } - rule(:quotes) { str(Shortcode.configuration.attribute_quote_type) } + rule(:quotes) { match(Shortcode.configuration.attribute_quote_type) } rule(:space) { str(' ').repeat(1) } rule(:space?) { space.maybe } diff --git a/shortcode.gemspec b/shortcode.gemspec index 927ed5d..eb5f70b 100644 --- a/shortcode.gemspec +++ b/shortcode.gemspec @@ -26,4 +26,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency "coveralls" spec.add_development_dependency "slim", "~> 2.0" spec.add_development_dependency "haml", "~> 4.0" + + # Need rails for tests + spec.add_development_dependency "rails", "~> 4.0" end diff --git a/spec/parser_spec.rb b/spec/parser_spec.rb index 306eb6b..035f3ae 100644 --- a/spec/parser_spec.rb +++ b/spec/parser_spec.rb @@ -30,7 +30,7 @@ before do Shortcode.setup do |config| - config.attribute_quote_type = "'" + config.attribute_quote_type = /'/ end end