summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKornelius Kalnbach <murphy@rubychan.de>2017-11-02 23:25:41 +0100
committerKornelius Kalnbach <murphy@rubychan.de>2017-11-02 23:25:41 +0100
commit853787554d17570dace133340e3ec555b0e56e0d (patch)
treec3fe74694c0ea315d7df7d8d35869df61b1191bb
parentffdd9ddb5cb5ab19a04ee0a714fa08d8d70f3437 (diff)
parente15cf96405177153e1418496a7a8e85beaa679fb (diff)
downloadcoderay-853787554d17570dace133340e3ec555b0e56e0d.tar.gz
Merge branch 'master' into possible-speedups
-rw-r--r--.travis.yml16
-rw-r--r--Changes.textile5
-rw-r--r--Gemfile18
-rw-r--r--MIT-LICENSE (renamed from MIT-LICENSE.txt)0
-rw-r--r--bench/bench.rb2
-rw-r--r--coderay.gemspec3
-rw-r--r--lib/coderay/encoders/encoder.rb2
-rw-r--r--lib/coderay/encoders/html.rb4
-rw-r--r--lib/coderay/scanners/haml.rb2
-rw-r--r--lib/coderay/scanners/java.rb2
-rw-r--r--[-rwxr-xr-x]lib/coderay/token_kinds.rb0
-rw-r--r--lib/coderay/version.rb2
-rw-r--r--rake_tasks/test.rake2
-rw-r--r--[-rwxr-xr-x]test/functional/basic.rb0
-rw-r--r--[-rwxr-xr-x]test/functional/examples.rb0
-rw-r--r--[-rwxr-xr-x]test/functional/suite.rb0
16 files changed, 29 insertions, 29 deletions
diff --git a/.travis.yml b/.travis.yml
index a8080ce..b99c95e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,21 +8,19 @@ rvm:
- 2.0
- 2.1
- 2.2
- - 2.3.0
+ - 2.3
+ - 2.4
- ruby-head
- - jruby-18mode
- - jruby-19mode
- - jruby-head
- - rbx-2
+ - jruby
branches:
only:
- master
+before_script:
+- if (ruby -e "exit RUBY_VERSION.to_f >= 2.3"); then export RUBYOPT="--enable-frozen-string-literal"; fi; echo $RUBYOPT
matrix:
allow_failures:
- rvm: ruby-head
- - rvm: jruby-18mode
- - rvm: jruby-19mode
- - rvm: jruby-head
- - rvm: rbx-2
+ - rvm: jruby
+ - rvm: rbx
script: "rake test" # test:scanners"
sudo: false
diff --git a/Changes.textile b/Changes.textile
index d77cff2..37de4ac 100644
--- a/Changes.textile
+++ b/Changes.textile
@@ -4,7 +4,10 @@ p=. _This files lists all changes in the CodeRay library since the 0.9.8 release
h2. Changes in 1.1.2
-* C++ scanner: Added C++11 keywords. [#195, thanks to Johnny Willemsen]
+* Ruby future: Add support for frozen string literals. [#211, thanks to Pat Allan]
+* C++ scanner: Add C++11 keywords. [#195, thanks to Johnny Willemsen]
+* Haml scanner: Allow @-@ in tags.
+* Java scanner: Allow Unicode characters in identifiers. [#212, thanks to t-gergely]
h2. Changes in 1.1.1
diff --git a/Gemfile b/Gemfile
index 592b79f..530c0e8 100644
--- a/Gemfile
+++ b/Gemfile
@@ -6,13 +6,13 @@ gemspec
# Add dependencies to develop your gem here.
# Include everything needed to run rake, tests, features, etc.
group :development do
- gem "bundler"
- gem "rake", "~> 10.5"
- gem "RedCloth", RUBY_PLATFORM == 'java' ? ">= 4.2.7" : ">= 4.0.3"
- gem "term-ansicolor"
- gem 'tins', '~> 1.6.0'
- gem "shoulda-context"
- gem "test-unit"
- gem "json" if RUBY_VERSION < '1.9'
- gem "rdoc"
+ gem 'bundler'
+ gem 'rake', RUBY_VERSION < '1.9' ? '~> 10.5' : '>= 10.5'
+ gem 'RedCloth', RUBY_PLATFORM == 'java' ? '= 4.2.9' : '>= 4.0.3'
+ gem 'term-ansicolor', RUBY_VERSION < '2.0' ? '~> 1.3.2' : '>= 1.3.2'
+ gem 'tins', RUBY_VERSION < '2.0' ? '~> 1.6.0' : '>= 1.6.0'
+ gem 'shoulda-context', RUBY_VERSION < '1.9' ? '= 1.2.1' : '>= 1.2.1'
+ gem 'test-unit', RUBY_VERSION < '1.9' ? '~> 2.0' : '>= 3.0'
+ gem 'json', '>= 1.8' if RUBY_VERSION < '1.9'
+ gem 'rdoc', RUBY_VERSION < '1.9' ? '~> 4.2.2' : '>= 4.2.2'
end
diff --git a/MIT-LICENSE.txt b/MIT-LICENSE
index d8d009d..d8d009d 100644
--- a/MIT-LICENSE.txt
+++ b/MIT-LICENSE
diff --git a/bench/bench.rb b/bench/bench.rb
index 34ea9f9..a47721e 100644
--- a/bench/bench.rb
+++ b/bench/bench.rb
@@ -15,7 +15,7 @@ raise 'Example file is empty.' if data.empty?
format = ARGV.fetch(1, 'html').downcase
encoder = CodeRay.encoder(format)
-size = ARGV.fetch(2, 2000).to_i * 1000
+size = ARGV.fetch(2, 3000).to_i * 1000
unless size.zero?
data += data until data.size >= size
data = data[0, size]
diff --git a/coderay.gemspec b/coderay.gemspec
index 6da3e1d..f95afc5 100644
--- a/coderay.gemspec
+++ b/coderay.gemspec
@@ -24,8 +24,7 @@ Gem::Specification.new do |s|
readme_file = 'README_INDEX.rdoc'
- s.files = `git ls-files -- lib/* test/functional/* Rakefile #{readme_file} MIT-LICENSE`.split("\n")
- s.test_files = `git ls-files -- test/functional/*`.split("\n")
+ s.files = `git ls-files -- lib/* #{readme_file} MIT-LICENSE`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
s.require_paths = ['lib']
diff --git a/lib/coderay/encoders/encoder.rb b/lib/coderay/encoders/encoder.rb
index fa5695d..2baeedb 100644
--- a/lib/coderay/encoders/encoder.rb
+++ b/lib/coderay/encoders/encoder.rb
@@ -146,7 +146,7 @@ module CodeRay
end
def get_output options
- options[:out] || ''
+ options[:out] || ''.dup
end
# Append data.to_s to the output. Returns the argument.
diff --git a/lib/coderay/encoders/html.rb b/lib/coderay/encoders/html.rb
index 0365022..5d55b00 100644
--- a/lib/coderay/encoders/html.rb
+++ b/lib/coderay/encoders/html.rb
@@ -161,7 +161,7 @@ module Encoders
if options[:wrap] || options[:line_numbers]
@real_out = @out
- @out = ''
+ @out = ''.dup
end
@break_lines = (options[:break_lines] == true)
@@ -297,7 +297,7 @@ module Encoders
end
def break_lines text, style
- reopen = ''
+ reopen = ''.dup
@opened.each_with_index do |kind, index|
reopen << (@span_for_kinds[index > 0 ? [kind, *@opened[0...index]] : kind] || '<span>')
end
diff --git a/lib/coderay/scanners/haml.rb b/lib/coderay/scanners/haml.rb
index 5433790..d516ba9 100644
--- a/lib/coderay/scanners/haml.rb
+++ b/lib/coderay/scanners/haml.rb
@@ -75,7 +75,7 @@ module Scanners
tag = false
- if match = scan(/%[\w:]+\/?/)
+ if match = scan(/%[-\w:]+\/?/)
encoder.text_token match, :tag
# if match = scan(/( +)(.+)/)
# encoder.text_token self[1], :space
diff --git a/lib/coderay/scanners/java.rb b/lib/coderay/scanners/java.rb
index 962154e..982a796 100644
--- a/lib/coderay/scanners/java.rb
+++ b/lib/coderay/scanners/java.rb
@@ -44,7 +44,7 @@ module Scanners
'"' => /[^\\"]+/,
'/' => /[^\\\/]+/,
} # :nodoc:
- IDENT = /[a-zA-Z_][A-Za-z_0-9]*/ # :nodoc:
+ IDENT = RUBY_VERSION < '1.9' ? /[a-zA-Z_][A-Za-z_0-9]*/ : Regexp.new('[[[:alpha:]]_][[[:alnum:]]_]*') # :nodoc:
protected
diff --git a/lib/coderay/token_kinds.rb b/lib/coderay/token_kinds.rb
index f911862..f911862 100755..100644
--- a/lib/coderay/token_kinds.rb
+++ b/lib/coderay/token_kinds.rb
diff --git a/lib/coderay/version.rb b/lib/coderay/version.rb
index 7ea3f70..f5e7a39 100644
--- a/lib/coderay/version.rb
+++ b/lib/coderay/version.rb
@@ -1,3 +1,3 @@
module CodeRay
- VERSION = '1.1.1'
+ VERSION = '1.1.2'
end
diff --git a/rake_tasks/test.rake b/rake_tasks/test.rake
index b15b999..1a23a5b 100644
--- a/rake_tasks/test.rake
+++ b/rake_tasks/test.rake
@@ -2,7 +2,7 @@ namespace :test do
desc 'run functional tests'
task :functional do
ruby './test/functional/suite.rb'
- ruby './test/functional/for_redcloth.rb'
+ ruby './test/functional/for_redcloth.rb' unless (''.chop! rescue true)
end
desc 'run unit tests'
diff --git a/test/functional/basic.rb b/test/functional/basic.rb
index 8554a78..8554a78 100755..100644
--- a/test/functional/basic.rb
+++ b/test/functional/basic.rb
diff --git a/test/functional/examples.rb b/test/functional/examples.rb
index 49337cb..49337cb 100755..100644
--- a/test/functional/examples.rb
+++ b/test/functional/examples.rb
diff --git a/test/functional/suite.rb b/test/functional/suite.rb
index ec23eec..ec23eec 100755..100644
--- a/test/functional/suite.rb
+++ b/test/functional/suite.rb