From 36e9155f13308236387c535a5bbb95bb188dc8a5 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 7 Oct 2012 03:13:39 +0200 Subject: fixing rdoc task --- rake_tasks/documentation.rake | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/rake_tasks/documentation.rake b/rake_tasks/documentation.rake index 0b7f810..d555022 100644 --- a/rake_tasks/documentation.rake +++ b/rake_tasks/documentation.rake @@ -14,12 +14,13 @@ Rake::RDocTask.new :doc do |rd| rd.main = 'lib/README' rd.title = 'CodeRay Documentation' - rd.options << '--line-numbers' << '--inline-source' << '--tab-width' << '2' - rd.options << '--fmt' << ENV.fetch('format', 'html_coderay') - require 'pathname' - template = File.join ROOT, 'rake_helpers', 'coderay_rdoc_template.rb' - rd.template = Pathname.new(template).expand_path.to_s + rd.options << '--line-numbers' << '--tab-width' << '2' + # rd.options << '--fmt' << ENV.fetch('format', 'html_coderay') + # require 'pathname' + # template = File.join ROOT, 'rake_helpers', 'coderay_rdoc_template.rb' + # rd.template = Pathname.new(template).expand_path.to_s + rd.main = 'README_INDEX.rdoc' rd.rdoc_files.add 'README_INDEX.rdoc' rd.rdoc_files.add Dir['lib'] rd.rdoc_dir = 'doc' -- cgit v1.2.1 From 8ffc3da65f21494b59d33dedeac44f5ee68537b5 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 10 Mar 2013 22:54:06 +0100 Subject: cleanup .gitignore --- .gitignore | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.gitignore b/.gitignore index caab594..b173971 100644 --- a/.gitignore +++ b/.gitignore @@ -1,17 +1,7 @@ .DS_Store -*.gem -*.rbc -.bundle -.config coverage -InstalledFiles -lib/bundler/man pkg -rdoc spec/reports -test/tmp -test/version_tmp -tmp doc Gemfile.lock .rvmrc @@ -19,7 +9,4 @@ test/executable/source.rb.html test/executable/source.rb.json test/scanners bench/test.div.html -diff.html -etc/CodeRay.tmproj -*.swp old-stuff -- cgit v1.2.1 From 8fa3e19450bd069af0d8bc268a5ed1889217423e Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 10 Mar 2013 23:16:24 +0100 Subject: cleanup Gemfile --- Gemfile | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index aa03288..b4177f9 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,3 @@ -source "http://rubygems.org" - # Specify your gem's dependencies in coderay.gemspec gemspec @@ -7,10 +5,11 @@ gemspec # Include everything needed to run rake, tests, features, etc. group :development do gem "bundler", ">= 1.0.0" - gem "rake", "~> 0.9.2" + gem "rake" gem "RedCloth", RUBY_PLATFORM == 'java' ? ">= 4.2.7" : ">= 4.0.3" gem "term-ansicolor" - gem "shoulda-context", "~> 1.0.0" if RUBY_VERSION >= '1.8.7' - gem "json" unless RUBY_VERSION >= '1.9.1' - gem "rdoc" if RUBY_VERSION >= '1.8.7' + gem "shoulda-context", "~> 1.0.0" + gem "json" if RUBY_VERSION < '1.9' + gem "rdoc" + gem "activesupport" end -- cgit v1.2.1 From af5d3ac98d36253452c779ba3663f4c72dfb3823 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 10 Mar 2013 23:16:30 +0100 Subject: upgrade generate:scanner task --- rake_tasks/generator.rake | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/rake_tasks/generator.rake b/rake_tasks/generator.rake index 9f5c192..6c9c313 100644 --- a/rake_tasks/generator.rake +++ b/rake_tasks/generator.rake @@ -3,9 +3,9 @@ namespace :generate do task :scanner do raise 'I need a scanner name; use NAME=lang' unless scanner_class_name = ENV['NAME'] raise "Invalid lang: #{scanner_class_name}; use NAME=lang." unless /\A\w+\z/ === scanner_class_name - require 'active_support' + require 'active_support/all' lang = scanner_class_name.underscore - class_name = scanner_class_name.classify + class_name = scanner_class_name.camelize def scanner_file_for_lang lang File.join(LIB_ROOT, 'coderay', 'scanners', lang + '.rb') @@ -25,6 +25,7 @@ namespace :generate do File.open(scanner_file, 'w') do |file| file.write base_scanner. sub(/class \w+ < Scanner/, "class #{class_name} < Scanner"). + sub('# Scanner for JSON (JavaScript Object Notation).', "# A scanner for #{scanner_class_name}."). sub(/register_for :\w+/, "register_for :#{lang}"). sub(/file_extension '\S+'/, "file_extension '#{ENV.fetch('EXT', lang).split(',').first}'") end @@ -37,9 +38,9 @@ namespace :generate do test_suite_file = File.join(test_dir, 'suite.rb') unless File.exist? test_suite_file puts "Creating test suite file #{test_suite_file}..." - base_suite = File.read File.join(test_dir, '..', 'json', 'suite.rb') + base_suite = File.read File.join(test_dir, '..', 'ruby', 'suite.rb') File.open(test_suite_file, 'w') do |file| - file.write base_suite.sub(/class JSON/, "class #{class_name}") + file.write base_suite.sub(/class Ruby/, "class #{class_name}") end end @@ -59,17 +60,13 @@ namespace :generate do end end - print 'Add to SVN? [Y|n] ' + print 'Add to git? [Y|n] ' answer = $stdin.gets.chomp.downcase if answer.empty? || answer == 'y' - sh "svn add #{scanner_file}" - sh "svn add #{test_dir}" - svn_ignore = <<-SVN_IGNORE -*.actual.* -*.expected.html -*.debug.diff* - SVN_IGNORE - sh "svn pset svn:ignore '#{svn_ignore}' #{test_dir}" + sh "git add #{scanner_file}" + cd File.join('test', 'scanners') do + sh "git add #{lang}" + end end end end -- cgit v1.2.1 From e18ebab2c3419675212ccf6e2dec70497bee2b7f Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Mon, 11 Mar 2013 01:18:51 +0100 Subject: vastly improve Debug encoder speed on Ruby 1.9.3 --- lib/coderay/encoders/debug.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/coderay/encoders/debug.rb b/lib/coderay/encoders/debug.rb index 95d6138..62f9f0a 100644 --- a/lib/coderay/encoders/debug.rb +++ b/lib/coderay/encoders/debug.rb @@ -28,7 +28,7 @@ module Encoders @out << text else # TODO: Escape ( - text = text.gsub(/[)\\]/, '\\\\\0') # escape ) and \ + text = text.gsub(/[)\\]/, '\\\\\0') if text.index(/[)\\]/) @out << kind.to_s << '(' << text << ')' end end -- cgit v1.2.1 From 469dba8c6378fb62ebf12c4a2f32b6be433bb16e Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Mon, 11 Mar 2013 02:23:22 +0100 Subject: added Sass scanner (work in progress) --- lib/coderay/helpers/file_type.rb | 1 + lib/coderay/scanners/css.rb | 31 +++--- lib/coderay/scanners/sass.rb | 203 +++++++++++++++++++++++++++++++++++++++ lib/coderay/styles/alpha.rb | 2 + 4 files changed, 220 insertions(+), 17 deletions(-) create mode 100644 lib/coderay/scanners/sass.rb diff --git a/lib/coderay/helpers/file_type.rb b/lib/coderay/helpers/file_type.rb index 637001b..b06b9bc 100644 --- a/lib/coderay/helpers/file_type.rb +++ b/lib/coderay/helpers/file_type.rb @@ -116,6 +116,7 @@ module CodeRay 'rpdf' => :ruby, 'ru' => :ruby, 'rxml' => :ruby, + 'sass' => :sass, # 'sch' => :scheme, 'sql' => :sql, # 'ss' => :scheme, diff --git a/lib/coderay/scanners/css.rb b/lib/coderay/scanners/css.rb index 7b731ef..003eed6 100644 --- a/lib/coderay/scanners/css.rb +++ b/lib/coderay/scanners/css.rb @@ -15,19 +15,17 @@ module Scanners module RE # :nodoc: Hex = /[0-9a-fA-F]/ - Unicode = /\\#{Hex}{1,6}(?:\r\n|\s)?/ # differs from standard because it allows uppercase hex too - Escape = /#{Unicode}|\\[^\r\n\f0-9a-fA-F]/ - NMChar = /[-_a-zA-Z0-9]|#{Escape}/ - NMStart = /[_a-zA-Z]|#{Escape}/ - NL = /\r\n|\r|\n|\f/ - String1 = /"(?:[^\n\r\f\\"]|\\#{NL}|#{Escape})*"?/ # TODO: buggy regexp - String2 = /'(?:[^\n\r\f\\']|\\#{NL}|#{Escape})*'?/ # TODO: buggy regexp + Unicode = /\\#{Hex}{1,6}\b/ # differs from standard because it allows uppercase hex too + Escape = /#{Unicode}|\\[^\n0-9a-fA-F]/ + NMChar = /[-_a-zA-Z0-9]/ + NMStart = /[_a-zA-Z]/ + String1 = /"(?:[^\n\\"]+|\\\n|#{Escape})*"?/ # TODO: buggy regexp + String2 = /'(?:[^\n\\']+|\\\n|#{Escape})*'?/ # TODO: buggy regexp String = /#{String1}|#{String2}/ HexColor = /#(?:#{Hex}{6}|#{Hex}{3})/ - Color = /#{HexColor}/ - Num = /-?(?:[0-9]+|[0-9]*\.[0-9]+)/ + Num = /-?(?:[0-9]*\.[0-9]+|[0-9]+)/ Name = /#{NMChar}+/ Ident = /-?#{NMStart}#{NMChar}*/ AtKeyword = /@#{Ident}/ @@ -35,16 +33,15 @@ module Scanners reldimensions = %w[em ex px] absdimensions = %w[in cm mm pt pc] - Unit = Regexp.union(*(reldimensions + absdimensions + %w[s])) + Unit = Regexp.union(*(reldimensions + absdimensions + %w[s dpi dppx deg])) Dimension = /#{Num}#{Unit}/ - Comment = %r! /\* (?: .*? \*/ | .* ) !mx - Function = /(?:url|alpha|attr|counters?)\((?:[^)\n\r\f]|\\\))*\)?/ + Function = /(?:url|alpha|attr|counters?)\((?:[^)\n]|\\\))*\)?/ - Id = /##{Name}/ + Id = /(?!#{HexColor}\b(?!-))##{Name}/ Class = /\.#{Name}/ - PseudoClass = /:#{Name}/ + PseudoClass = /::?#{Ident}/ AttributeSelector = /\[[^\]]*\]?/ end @@ -52,7 +49,7 @@ module Scanners def setup @state = :initial - @value_expected = nil + @value_expected = false end def scan_tokens encoder, options @@ -158,7 +155,7 @@ module Scanners elsif match = scan(/(?: #{RE::Dimension} | #{RE::Percentage} | #{RE::Num} )/ox) encoder.text_token match, :float - elsif match = scan(/#{RE::Color}/o) + elsif match = scan(/#{RE::HexColor}/o) encoder.text_token match, :color elsif match = scan(/! *important/) @@ -170,7 +167,7 @@ module Scanners elsif match = scan(RE::AtKeyword) encoder.text_token match, :directive - elsif match = scan(/ [+>:;,.=()\/] /x) + elsif match = scan(/ [+>~:;,.=()\/] /x) if match == ':' value_expected = true elsif match == ';' diff --git a/lib/coderay/scanners/sass.rb b/lib/coderay/scanners/sass.rb new file mode 100644 index 0000000..89d7737 --- /dev/null +++ b/lib/coderay/scanners/sass.rb @@ -0,0 +1,203 @@ +module CodeRay +module Scanners + + # A scanner for Sass. + class Sass < CSS + + register_for :sass + file_extension 'sass' + + SASS_FUNCTION = /(?:inline-image|linear-gradient|color-stops|mix|lighten|darken|rotate|image-url|image-width|image-height|sprite|sprite-url|sprite-path|sprite-file|sprite-map|sprite-position|unquote|join|round|ceil|floor|nth)/ + + STRING_CONTENT_PATTERN = { + "'" => /(?:[^\n\'\#]+|\\\n|#{RE::Escape}|#(?!\{))+/, + '"' => /(?:[^\n\"\#]+|\\\n|#{RE::Escape}|#(?!\{))+/, + } + + protected + + def setup + @state = :initial + @value_expected = false + end + + def scan_tokens encoder, options + states = Array(options[:state] || @state) + string_delimiter = nil + value_expected = @value_expected + + until eos? + + if match = scan(/\s+/) + encoder.text_token match, :space + value_expected = false if match.index(/\n/) + + elsif states.last == :sass_inline && (match = scan(/\}/)) + encoder.text_token match, :inline_delimiter + encoder.end_group :inline + states.pop + + elsif case states.last + when :initial, :media, :sass_inline + if match = scan(/(?>#{RE::Ident})(?!\()/ox) + encoder.text_token match, value_expected ? :value : (check(/.*:/) ? :key : :type) + next + elsif !value_expected && (match = scan(/\*/)) + encoder.text_token match, :type + next + elsif match = scan(RE::Class) + encoder.text_token match, :class + next + elsif match = scan(RE::Id) + encoder.text_token match, :constant + next + elsif match = scan(RE::PseudoClass) + encoder.text_token match, :pseudo_class + next + elsif match = scan(RE::AttributeSelector) + # TODO: Improve highlighting inside of attribute selectors. + encoder.text_token match[0,1], :operator + encoder.text_token match[1..-2], :attribute_name if match.size > 2 + encoder.text_token match[-1,1], :operator if match[-1] == ?] + next + elsif match = scan(/(\=|@mixin +)#{RE::Ident}/o) + encoder.text_token match, :function + next + elsif match = scan(/@media/) + encoder.text_token match, :directive + # states.push :media_before_name + next + end + + when :block + if match = scan(/(?>#{RE::Ident})(?!\()/ox) + if value_expected + encoder.text_token match, :value + else + encoder.text_token match, :key + end + next + end + + when :string + if match = scan(STRING_CONTENT_PATTERN[string_delimiter]) + encoder.text_token match, :content + elsif match = scan(/['"]/) + encoder.text_token match, :delimiter + encoder.end_group :string + string_delimiter = nil + states.pop + elsif match = scan(/#\{/) + encoder.begin_group :inline + encoder.text_token match, :inline_delimiter + states.push :sass_inline + elsif match = scan(/ \\ | $ /x) + encoder.end_group state + encoder.text_token match, :error unless match.empty? + states.pop + else + raise_inspect "else case #{string_delimiter} reached; %p not handled." % peek(1), encoder + end + + else + #:nocov: + raise_inspect 'Unknown state', encoder + #:nocov: + + end + + elsif match = scan(/\$#{RE::Ident}/o) + encoder.text_token match, :variable + next + + elsif match = scan(/&/) + encoder.text_token match, :local_variable + + elsif match = scan(/\+#{RE::Ident}/o) + encoder.text_token match, :include + value_expected = true + + elsif match = scan(/\/\*(?:.*?\*\/|.*)|\/\/.*/) + encoder.text_token match, :comment + + elsif match = scan(/#\{/) + encoder.begin_group :inline + encoder.text_token match, :inline_delimiter + states.push :sass_inline + + elsif match = scan(/\{/) + value_expected = false + encoder.text_token match, :operator + states.push :block + + elsif match = scan(/\}/) + value_expected = false + encoder.text_token match, :operator + if states.last == :block || states.last == :media + states.pop + end + + elsif match = scan(/['"]/) + encoder.begin_group :string + string_delimiter = match + encoder.text_token match, :delimiter + states.push :string + + elsif match = scan(/#{SASS_FUNCTION}/o) + encoder.text_token match, :predefined + + elsif match = scan(/#{RE::Function}/o) + encoder.begin_group :function + start = match[/^[-\w]+\(/] + encoder.text_token start, :delimiter + if match[-1] == ?) + encoder.text_token match[start.size..-2], :content + encoder.text_token ')', :delimiter + else + encoder.text_token match[start.size..-1], :content + end + encoder.end_group :function + + elsif match = scan(/(?: #{RE::Dimension} | #{RE::Percentage} | #{RE::Num} )/ox) + encoder.text_token match, :float + + elsif match = scan(/#{RE::HexColor}/o) + encoder.text_token match, :color + + elsif match = scan(/! *(?:important|optional)/) + encoder.text_token match, :important + + elsif match = scan(/(?:rgb|hsl)a?\([^()\n]*\)?/) + encoder.text_token match, :color + + elsif match = scan(/@else if\b|#{RE::AtKeyword}/) + encoder.text_token match, :directive + value_expected = true + + elsif match = scan(/ == | != | [-+*\/>~:;,.=()] /x) + if match == ':' + value_expected = true + elsif match == ';' + value_expected = false + end + encoder.text_token match, :operator + + else + encoder.text_token getch, :error + + end + + end + + if options[:keep_state] + @state = states + @value_expected = value_expected + end + + encoder + end + + end + +end +end diff --git a/lib/coderay/styles/alpha.rb b/lib/coderay/styles/alpha.rb index 8506d10..1f073b6 100644 --- a/lib/coderay/styles/alpha.rb +++ b/lib/coderay/styles/alpha.rb @@ -78,6 +78,7 @@ table.CodeRay td { padding: 2px 4px; vertical-align: top; } .exception { color:#C00; font-weight:bold } .float { color:#60E } .function { color:#06B; font-weight:bold } +.function .delimiter { color:#024; font-weight:bold } .global-variable { color:#d70 } .hex { color:#02b } .imaginary { color:#f00 } @@ -86,6 +87,7 @@ table.CodeRay td { padding: 2px 4px; vertical-align: top; } .inline-delimiter { font-weight: bold; color: #666 } .instance-variable { color:#33B } .integer { color:#00D } +.important { color:#D00 } .key .char { color: #60f } .key .delimiter { color: #404 } .key { color: #606 } -- cgit v1.2.1 From 2fd96c38b2a488205267aa8bd402a8cfe26efcb1 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Mon, 11 Mar 2013 02:26:24 +0100 Subject: changelog --- Changes.textile | 1 + 1 file changed, 1 insertion(+) diff --git a/Changes.textile b/Changes.textile index 3984b83..625006a 100644 --- a/Changes.textile +++ b/Changes.textile @@ -4,6 +4,7 @@ p=. _This files lists all changes in the CodeRay library since the 0.9.8 release h2. Changes in 1.1 +* New scanner: Sass [#93] * Diff scanner: Highlight inline changes in multi-line changes [#99] * Remove double-click toggle handler from HTML table output * Display line numbers in HTML @:table@ mode even for single-line code (remove special case) [#41, thanks to Ariejan de Vroom] -- cgit v1.2.1 From 1cdf0e17af6c280dc12130a9200d8196b056bbe9 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Mon, 11 Mar 2013 02:27:17 +0100 Subject: minor tweaks to generator and scanner edge cases --- lib/coderay/scanners/c.rb | 2 +- lib/coderay/scanners/cpp.rb | 2 +- lib/coderay/scanners/java.rb | 2 +- lib/coderay/scanners/java_script.rb | 4 ++-- lib/coderay/scanners/json.rb | 2 +- lib/coderay/scanners/python.rb | 2 +- lib/coderay/scanners/sql.rb | 2 +- rake_tasks/generator.rake | 4 ++-- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/coderay/scanners/c.rb b/lib/coderay/scanners/c.rb index 8d24b99..84b6e8e 100644 --- a/lib/coderay/scanners/c.rb +++ b/lib/coderay/scanners/c.rb @@ -148,7 +148,7 @@ module Scanners encoder.text_token match, :char elsif match = scan(/ \\ | $ /x) encoder.end_group :string - encoder.text_token match, :error + encoder.text_token match, :error unless match.empty? state = :initial label_expected = false else diff --git a/lib/coderay/scanners/cpp.rb b/lib/coderay/scanners/cpp.rb index 9da62f4..e61f56f 100644 --- a/lib/coderay/scanners/cpp.rb +++ b/lib/coderay/scanners/cpp.rb @@ -160,7 +160,7 @@ module Scanners encoder.text_token match, :char elsif match = scan(/ \\ | $ /x) encoder.end_group :string - encoder.text_token match, :error + encoder.text_token match, :error unless match.empty? state = :initial label_expected = false else diff --git a/lib/coderay/scanners/java.rb b/lib/coderay/scanners/java.rb index c1490ac..b282864 100644 --- a/lib/coderay/scanners/java.rb +++ b/lib/coderay/scanners/java.rb @@ -147,7 +147,7 @@ module Scanners elsif match = scan(/ \\ | $ /x) encoder.end_group state state = :initial - encoder.text_token match, :error + encoder.text_token match, :error unless match.empty? else raise_inspect "else case \" reached; %p not handled." % peek(1), encoder end diff --git a/lib/coderay/scanners/java_script.rb b/lib/coderay/scanners/java_script.rb index 43ecb18..92e3dfa 100644 --- a/lib/coderay/scanners/java_script.rb +++ b/lib/coderay/scanners/java_script.rb @@ -175,11 +175,11 @@ module Scanners encoder.text_token match, :content elsif match = scan(/ \\ | $ /x) encoder.end_group state - encoder.text_token match, :error + encoder.text_token match, :error unless match.empty? key_expected = value_expected = false state = :initial else - raise_inspect "else case \" reached; %p not handled." % peek(1), encoder + raise_inspect "else case #{string_delimiter} reached; %p not handled." % peek(1), encoder end else diff --git a/lib/coderay/scanners/json.rb b/lib/coderay/scanners/json.rb index 0c90c34..4e0f462 100644 --- a/lib/coderay/scanners/json.rb +++ b/lib/coderay/scanners/json.rb @@ -70,7 +70,7 @@ module Scanners encoder.text_token match, :content elsif match = scan(/ \\ | $ /x) encoder.end_group state - encoder.text_token match, :error + encoder.text_token match, :error unless match.empty? state = :initial else raise_inspect "else case \" reached; %p not handled." % peek(1), encoder diff --git a/lib/coderay/scanners/python.rb b/lib/coderay/scanners/python.rb index cbdbbdb..a9492ab 100644 --- a/lib/coderay/scanners/python.rb +++ b/lib/coderay/scanners/python.rb @@ -133,7 +133,7 @@ module Scanners elsif match = scan(/ \\ | $ /x) encoder.end_group string_type string_type = nil - encoder.text_token match, :error + encoder.text_token match, :error unless match.empty? state = :initial else raise_inspect "else case \" reached; %p not handled." % peek(1), encoder, state diff --git a/lib/coderay/scanners/sql.rb b/lib/coderay/scanners/sql.rb index bcbffd5..b757278 100644 --- a/lib/coderay/scanners/sql.rb +++ b/lib/coderay/scanners/sql.rb @@ -148,7 +148,7 @@ module CodeRay module Scanners encoder.text_token string_content, :content string_content = '' end - encoder.text_token match, :error + encoder.text_token match, :error unless match.empty? state = :initial else raise "else case \" reached; %p not handled." % peek(1), encoder diff --git a/rake_tasks/generator.rake b/rake_tasks/generator.rake index 6c9c313..284adcb 100644 --- a/rake_tasks/generator.rake +++ b/rake_tasks/generator.rake @@ -1,5 +1,5 @@ namespace :generate do - desc 'generates a new scanner NAME=lang [ALT=alternative,plugin,ids] [EXT=file,extensions] [BASE=base lang] ' + desc 'generates a new scanner NAME=lang [ALT=alternative,plugin,ids] [EXT=file,extensions] [BASE=base lang]' task :scanner do raise 'I need a scanner name; use NAME=lang' unless scanner_class_name = ENV['NAME'] raise "Invalid lang: #{scanner_class_name}; use NAME=lang." unless /\A\w+\z/ === scanner_class_name @@ -52,7 +52,7 @@ namespace :generate do end end - if alternative_ids = ENV['ALT'] + if alternative_ids = ENV['ALT'] && alternative_ids != lang map_file = File.join(LIB_ROOT, 'coderay', 'scanners', '_map.rb') puts "Not automated. Remember to add your alternative plugin ids to #{map_file}:" for id in alternative_ids.split(',') -- cgit v1.2.1 From 1a3f0435a28319a08ec33c27ab2194c05395bab7 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Mon, 11 Mar 2013 02:28:02 +0100 Subject: remove activesupport from Gemfile --- Gemfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Gemfile b/Gemfile index b4177f9..0f49975 100644 --- a/Gemfile +++ b/Gemfile @@ -11,5 +11,4 @@ group :development do gem "shoulda-context", "~> 1.0.0" gem "json" if RUBY_VERSION < '1.9' gem "rdoc" - gem "activesupport" end -- cgit v1.2.1 From b4a9e6d82b326ef974a8271c61ad0d80dda3d406 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Mon, 11 Mar 2013 02:36:52 +0100 Subject: remove rdoc from Gemfile --- Gemfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 0f49975..efbd193 100644 --- a/Gemfile +++ b/Gemfile @@ -9,6 +9,5 @@ group :development do gem "RedCloth", RUBY_PLATFORM == 'java' ? ">= 4.2.7" : ">= 4.0.3" gem "term-ansicolor" gem "shoulda-context", "~> 1.0.0" - gem "json" if RUBY_VERSION < '1.9' - gem "rdoc" + gem "json" if RUBY_VERSION < '1.9' end -- cgit v1.2.1 From ca883f3181caf7a6e49c507c9ddffef8526328c5 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Mon, 11 Mar 2013 02:41:13 +0100 Subject: add source :rubygems back to Gemfile --- Gemfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Gemfile b/Gemfile index efbd193..9f47966 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,5 @@ +source :rubygems + # Specify your gem's dependencies in coderay.gemspec gemspec @@ -10,4 +12,5 @@ group :development do gem "term-ansicolor" gem "shoulda-context", "~> 1.0.0" gem "json" if RUBY_VERSION < '1.9' + gem "rdoc" end -- cgit v1.2.1 From 68d9a901b27eb2b648488f9b147d6d3eedefde04 Mon Sep 17 00:00:00 2001 From: Alexandre Vezina Date: Sat, 23 Mar 2013 13:46:01 -0400 Subject: Support for phtml files --- lib/coderay/helpers/file_type.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/coderay/helpers/file_type.rb b/lib/coderay/helpers/file_type.rb index 637001b..b137448 100644 --- a/lib/coderay/helpers/file_type.rb +++ b/lib/coderay/helpers/file_type.rb @@ -99,6 +99,7 @@ module CodeRay 'mab' => :ruby, 'pas' => :delphi, 'patch' => :diff, + 'phtml' => :html, 'php' => :php, 'php3' => :php, 'php4' => :php, -- cgit v1.2.1 From d71b7748672cac99d7f759c286ba3e177f01dd62 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sat, 30 Mar 2013 13:07:16 +0100 Subject: ignore .ruby-version, .ruby-gemset files --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index b173971..fe9b05f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,8 @@ spec/reports doc Gemfile.lock .rvmrc +.ruby-gemset +.ruby-version test/executable/source.rb.html test/executable/source.rb.json test/scanners -- cgit v1.2.1 From a56bf43f3278c626c0bbef36a5b436f80e2880d9 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Mon, 8 Apr 2013 21:33:34 +0300 Subject: Update README.markdown --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 42bdab6..b5ae9e2 100644 --- a/README.markdown +++ b/README.markdown @@ -1,4 +1,4 @@ -# CodeRay [![Build Status](https://travis-ci.org/rubychan/coderay.png)](https://travis-ci.org/rubychan/coderay) +# CodeRay [![Build Status](https://travis-ci.org/rubychan/coderay.png)](https://travis-ci.org/rubychan/coderay) [![Gem Version](https://badge.fury.io/rb/coderay.png)](http://badge.fury.io/rb/coderay) ## About -- cgit v1.2.1 From 2708fd32f45a6de34249ffbd5331c6df9c985889 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Thu, 11 Apr 2013 21:02:31 +0200 Subject: fix order of SASS_FUNCTIONs --- lib/coderay/scanners/sass.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/coderay/scanners/sass.rb b/lib/coderay/scanners/sass.rb index 89d7737..b1b1cba 100644 --- a/lib/coderay/scanners/sass.rb +++ b/lib/coderay/scanners/sass.rb @@ -7,7 +7,7 @@ module Scanners register_for :sass file_extension 'sass' - SASS_FUNCTION = /(?:inline-image|linear-gradient|color-stops|mix|lighten|darken|rotate|image-url|image-width|image-height|sprite|sprite-url|sprite-path|sprite-file|sprite-map|sprite-position|unquote|join|round|ceil|floor|nth)/ + SASS_FUNCTION = /(?:inline-image|linear-gradient|color-stops|mix|lighten|darken|rotate|image-url|image-width|image-height|sprite-url|sprite-path|sprite-file|sprite-map|sprite-position|sprite|unquote|join|round|ceil|floor|nth)/ STRING_CONTENT_PATTERN = { "'" => /(?:[^\n\'\#]+|\\\n|#{RE::Escape}|#(?!\{))+/, -- cgit v1.2.1 From 2f285f3d2803ef9742af240a1e5935a2dfc915fc Mon Sep 17 00:00:00 2001 From: Alexandre Vezina Date: Wed, 17 Apr 2013 14:45:16 -0400 Subject: PHP is a better highlight for phtml files --- lib/coderay/helpers/file_type.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/coderay/helpers/file_type.rb b/lib/coderay/helpers/file_type.rb index b137448..f52f17e 100644 --- a/lib/coderay/helpers/file_type.rb +++ b/lib/coderay/helpers/file_type.rb @@ -99,7 +99,7 @@ module CodeRay 'mab' => :ruby, 'pas' => :delphi, 'patch' => :diff, - 'phtml' => :html, + 'phtml' => :php, 'php' => :php, 'php3' => :php, 'php4' => :php, -- cgit v1.2.1 From 9af535622387dbec98ebcf9db1e9192d7eb1398b Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Fri, 24 May 2013 11:31:32 +0200 Subject: fix term-ansicolor version to prevent warnings spam on rake test:scanners (#128) --- Gemfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 9f47966..508f1e8 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -source :rubygems +source 'https://rubygems.org' # Specify your gem's dependencies in coderay.gemspec gemspec @@ -9,7 +9,7 @@ group :development do gem "bundler", ">= 1.0.0" gem "rake" gem "RedCloth", RUBY_PLATFORM == 'java' ? ">= 4.2.7" : ">= 4.0.3" - gem "term-ansicolor" + gem "term-ansicolor", '= 1.1.1' gem "shoulda-context", "~> 1.0.0" gem "json" if RUBY_VERSION < '1.9' gem "rdoc" -- cgit v1.2.1 From 57ffbc753f8e7fd676a13bf5960043b23ee1d5ed Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 9 Jun 2013 04:30:23 +0200 Subject: unfreeze TokenKinds hash, allow changes --- Changes.textile | 1 + lib/coderay/token_kinds.rb | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Changes.textile b/Changes.textile index 3984b83..6c643cc 100644 --- a/Changes.textile +++ b/Changes.textile @@ -7,6 +7,7 @@ h2. Changes in 1.1 * Diff scanner: Highlight inline changes in multi-line changes [#99] * Remove double-click toggle handler from HTML table output * Display line numbers in HTML @:table@ mode even for single-line code (remove special case) [#41, thanks to Ariejan de Vroom] +* @CodeRay::TokenKinds@ should not be frozen [#130, thanks to Gavin Kistner] h2. Changes in 1.0.9 diff --git a/lib/coderay/token_kinds.rb b/lib/coderay/token_kinds.rb index 3b8d07e..8db8530 100755 --- a/lib/coderay/token_kinds.rb +++ b/lib/coderay/token_kinds.rb @@ -85,6 +85,4 @@ module CodeRay TokenKinds[:method] = TokenKinds[:function] TokenKinds[:escape] = TokenKinds[:delimiter] TokenKinds[:docstring] = TokenKinds[:comment] - - TokenKinds.freeze end -- cgit v1.2.1 From 1952ef4c4dd1105665a3a4f9a0266598d6acf892 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 9 Jun 2013 06:22:39 +0200 Subject: two fixes for CSS scanner --- Changes.textile | 1 + lib/coderay/scanners/css.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Changes.textile b/Changes.textile index 6c643cc..a3f5ebb 100644 --- a/Changes.textile +++ b/Changes.textile @@ -6,6 +6,7 @@ h2. Changes in 1.1 * Diff scanner: Highlight inline changes in multi-line changes [#99] * Remove double-click toggle handler from HTML table output +* Fixes to CSS scanner (floats, pseudoclasses) * Display line numbers in HTML @:table@ mode even for single-line code (remove special case) [#41, thanks to Ariejan de Vroom] * @CodeRay::TokenKinds@ should not be frozen [#130, thanks to Gavin Kistner] diff --git a/lib/coderay/scanners/css.rb b/lib/coderay/scanners/css.rb index 7b731ef..dd5106e 100644 --- a/lib/coderay/scanners/css.rb +++ b/lib/coderay/scanners/css.rb @@ -27,7 +27,7 @@ module Scanners HexColor = /#(?:#{Hex}{6}|#{Hex}{3})/ Color = /#{HexColor}/ - Num = /-?(?:[0-9]+|[0-9]*\.[0-9]+)/ + Num = /-?(?:[0-9]+(?!\.\d)|[0-9]*\.[0-9]+)/ Name = /#{NMChar}+/ Ident = /-?#{NMStart}#{NMChar}*/ AtKeyword = /@#{Ident}/ @@ -44,7 +44,7 @@ module Scanners Id = /##{Name}/ Class = /\.#{Name}/ - PseudoClass = /:#{Name}/ + PseudoClass = /::?#{Name}/ AttributeSelector = /\[[^\]]*\]?/ end -- cgit v1.2.1 From 2347f995a70d7607fc0e417c5c7323eacfdcc341 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 9 Jun 2013 06:23:48 +0200 Subject: treat empty token as error in Debug encoder --- lib/coderay/encoders/debug.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/coderay/encoders/debug.rb b/lib/coderay/encoders/debug.rb index 62f9f0a..c03d3fb 100644 --- a/lib/coderay/encoders/debug.rb +++ b/lib/coderay/encoders/debug.rb @@ -24,6 +24,7 @@ module Encoders end def text_token text, kind + raise 'empty token' if $CODERAY_DEBUG && text.empty? if kind == :space @out << text else -- cgit v1.2.1 From 667d4262e42b5866859fb9eb91a0617c1722e7a4 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 9 Jun 2013 06:24:29 +0200 Subject: avoid empty tokens in Diff output, fix split_into_parts --- lib/coderay/scanners/diff.rb | 2 +- lib/coderay/tokens.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/coderay/scanners/diff.rb b/lib/coderay/scanners/diff.rb index 38efaf4..8e3bf3c 100644 --- a/lib/coderay/scanners/diff.rb +++ b/lib/coderay/scanners/diff.rb @@ -45,7 +45,7 @@ module Scanners if match = scan(/--- |\+\+\+ |=+|_+/) encoder.begin_line line_kind = :head encoder.text_token match, :head - if match = scan(/.*?(?=$|[\t\n\x00]| \(revision)/) + if match = scan(/.+?(?=$|[\t\n\x00]| \(revision)/) encoder.text_token match, :filename if options[:highlight_code] && match != '/dev/null' file_type = CodeRay::FileType.fetch(match, :text) diff --git a/lib/coderay/tokens.rb b/lib/coderay/tokens.rb index c747017..6957d69 100644 --- a/lib/coderay/tokens.rb +++ b/lib/coderay/tokens.rb @@ -93,6 +93,7 @@ module CodeRay # This method is used by @Scanner#tokenize@ when called with an Array # of source strings. The Diff encoder uses it for inline highlighting. def split_into_parts *sizes + return Array.new(sizes.size) { Tokens.new } if size == 2 && first == '' parts = [] opened = [] content = nil -- cgit v1.2.1 From 6946b47a35e597dd6447259db8c981360f669297 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 9 Jun 2013 06:24:52 +0200 Subject: update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index fe9b05f..dd001c8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .DS_Store +.*~ coverage pkg spec/reports -- cgit v1.2.1 From 4323bb7ad9b5c5ddc770691d66e5727553ca33a3 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 9 Jun 2013 06:27:14 +0200 Subject: bump version to 1.1.0 --- lib/coderay/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/coderay/version.rb b/lib/coderay/version.rb index bfb5f24..4b4f085 100644 --- a/lib/coderay/version.rb +++ b/lib/coderay/version.rb @@ -1,3 +1,3 @@ module CodeRay - VERSION = '1.0.9' + VERSION = '1.1.0' end -- cgit v1.2.1 From 1ad75645ad880ede3c0590fd6a700b1847cc3fe4 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 9 Jun 2013 07:14:12 +0200 Subject: don't allow \x00 in diff filenames --- lib/coderay/scanners/diff.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/coderay/scanners/diff.rb b/lib/coderay/scanners/diff.rb index 8e3bf3c..af0f755 100644 --- a/lib/coderay/scanners/diff.rb +++ b/lib/coderay/scanners/diff.rb @@ -45,7 +45,7 @@ module Scanners if match = scan(/--- |\+\+\+ |=+|_+/) encoder.begin_line line_kind = :head encoder.text_token match, :head - if match = scan(/.+?(?=$|[\t\n\x00]| \(revision)/) + if match = scan(/[^\x00\n]+?(?=$|[\t\n]| \(revision)/) encoder.text_token match, :filename if options[:highlight_code] && match != '/dev/null' file_type = CodeRay::FileType.fetch(match, :text) -- cgit v1.2.1 From 737fb3608c92506a573a79f611b94ff5d5da18e6 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 9 Jun 2013 07:25:15 +0200 Subject: do not warn about plugin fallback --- Changes.textile | 1 + lib/coderay/helpers/plugin.rb | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/Changes.textile b/Changes.textile index a3f5ebb..5eee244 100644 --- a/Changes.textile +++ b/Changes.textile @@ -7,6 +7,7 @@ h2. Changes in 1.1 * Diff scanner: Highlight inline changes in multi-line changes [#99] * Remove double-click toggle handler from HTML table output * Fixes to CSS scanner (floats, pseudoclasses) +* Plugin does not warn about fallback when default is defined * Display line numbers in HTML @:table@ mode even for single-line code (remove special case) [#41, thanks to Ariejan de Vroom] * @CodeRay::TokenKinds@ should not be frozen [#130, thanks to Gavin Kistner] diff --git a/lib/coderay/helpers/plugin.rb b/lib/coderay/helpers/plugin.rb index 137c1ab..dd4e830 100644 --- a/lib/coderay/helpers/plugin.rb +++ b/lib/coderay/helpers/plugin.rb @@ -180,7 +180,6 @@ module CodeRay rescue LoadError => boom if @plugin_map_loaded if h.has_key?(:default) - warn '%p could not load plugin %p; falling back to %p' % [self, id, h[:default]] h[:default] else raise PluginNotFound, '%p could not load plugin %p: %s' % [self, id, boom] -- cgit v1.2.1 From 8563acc7e29e3d5bf5281aedbc0b7088abe44877 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 9 Jun 2013 19:30:49 +0200 Subject: fix Sass highlighting in diff --- lib/coderay/scanners/sass.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/coderay/scanners/sass.rb b/lib/coderay/scanners/sass.rb index b1b1cba..17514c0 100644 --- a/lib/coderay/scanners/sass.rb +++ b/lib/coderay/scanners/sass.rb @@ -18,13 +18,11 @@ module Scanners def setup @state = :initial - @value_expected = false end def scan_tokens encoder, options states = Array(options[:state] || @state) string_delimiter = nil - value_expected = @value_expected until eos? @@ -191,7 +189,6 @@ module Scanners if options[:keep_state] @state = states - @value_expected = value_expected end encoder -- cgit v1.2.1 From 5bea8e3041de85266c3596627224ced102f195e0 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 9 Jun 2013 19:31:10 +0200 Subject: don't nest :string recursively in :sass_inline --- lib/coderay/scanners/sass.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/coderay/scanners/sass.rb b/lib/coderay/scanners/sass.rb index 17514c0..0eb2caa 100644 --- a/lib/coderay/scanners/sass.rb +++ b/lib/coderay/scanners/sass.rb @@ -139,7 +139,14 @@ module Scanners encoder.begin_group :string string_delimiter = match encoder.text_token match, :delimiter - states.push :string + if states.include? :sass_inline + content = scan_until(/(?=#{string_delimiter}|\}|\z)/) + encoder.text_token content, :content unless content.empty? + encoder.text_token string_delimiter, :delimiter if scan(/#{string_delimiter}/) + encoder.end_group :string + else + states.push :string + end elsif match = scan(/#{SASS_FUNCTION}/o) encoder.text_token match, :predefined -- cgit v1.2.1 From e13565493d07582d9e9f9cffb671ee0a3590ab51 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 9 Jun 2013 19:46:24 +0200 Subject: fix tests --- test/functional/for_redcloth.rb | 14 ++++---------- test/unit/plugin.rb | 5 +---- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/test/functional/for_redcloth.rb b/test/functional/for_redcloth.rb index e980667..9fd244e 100644 --- a/test/functional/for_redcloth.rb +++ b/test/functional/for_redcloth.rb @@ -1,5 +1,4 @@ require 'test/unit' -require File.expand_path('../../lib/assert_warning', __FILE__) $:.unshift File.expand_path('../../../lib', __FILE__) require 'coderay' @@ -66,19 +65,14 @@ class BasicTest < Test::Unit::TestCase # See http://jgarber.lighthouseapp.com/projects/13054/tickets/124-code-markup-does-not-allow-brackets. def test_for_redcloth_false_positive require 'coderay/for_redcloth' - assert_warning 'CodeRay::Scanners could not load plugin :project; falling back to :text' do - assert_equal '

[project]_dff.skjd

', - RedCloth.new('@[project]_dff.skjd@').to_html - end + assert_equal '

[project]_dff.skjd

', + RedCloth.new('@[project]_dff.skjd@').to_html # false positive, but expected behavior / known issue assert_equal "

_dff.skjd

", RedCloth.new('@[ruby]_dff.skjd@').to_html - assert_warning 'CodeRay::Scanners could not load plugin :project; falling back to :text' do - assert_equal <<-BLOCKCODE.chomp, + assert_equal <<-BLOCKCODE.chomp, RedCloth.new('bc. [project]_dff.skjd').to_html
[project]_dff.skjd
- BLOCKCODE - RedCloth.new('bc. [project]_dff.skjd').to_html - end + BLOCKCODE end end if defined? RedCloth \ No newline at end of file diff --git a/test/unit/plugin.rb b/test/unit/plugin.rb index a1d06e1..41eec51 100755 --- a/test/unit/plugin.rb +++ b/test/unit/plugin.rb @@ -1,6 +1,5 @@ require 'test/unit' require 'pathname' -require File.expand_path('../../lib/assert_warning', __FILE__) $:.unshift File.expand_path('../../../lib', __FILE__) require 'coderay' @@ -39,9 +38,7 @@ class PluginScannerTest < Test::Unit::TestCase def test_default assert_nothing_raised do - assert_warning 'PluginScannerTest::PluginsWithDefault could not load plugin :gargamel; falling back to :default_plugin' do - assert_operator PluginsWithDefault[:gargamel], :<, PluginsWithDefault::Plugin - end + assert_operator PluginsWithDefault[:gargamel], :<, PluginsWithDefault::Plugin end assert_equal PluginsWithDefault::Default, PluginsWithDefault.default end -- cgit v1.2.1 From afa283677ba133cdf91ee9fe05fb127945519553 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 9 Jun 2013 20:00:57 +0200 Subject: update shoulda-context --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 508f1e8..df6d563 100644 --- a/Gemfile +++ b/Gemfile @@ -10,7 +10,7 @@ group :development do gem "rake" gem "RedCloth", RUBY_PLATFORM == 'java' ? ">= 4.2.7" : ">= 4.0.3" gem "term-ansicolor", '= 1.1.1' - gem "shoulda-context", "~> 1.0.0" + gem "shoulda-context", "~> 1.1.2" gem "json" if RUBY_VERSION < '1.9' gem "rdoc" end -- cgit v1.2.1 From 410e51ea3225b2a5c043c2ddd754dd614f4fcf1d Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 9 Jun 2013 20:20:15 +0200 Subject: update term-ansicolor --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index df6d563..15a71ae 100644 --- a/Gemfile +++ b/Gemfile @@ -9,7 +9,7 @@ group :development do gem "bundler", ">= 1.0.0" gem "rake" gem "RedCloth", RUBY_PLATFORM == 'java' ? ">= 4.2.7" : ">= 4.0.3" - gem "term-ansicolor", '= 1.1.1' + gem "term-ansicolor", '~> 1.2.2' gem "shoulda-context", "~> 1.1.2" gem "json" if RUBY_VERSION < '1.9' gem "rdoc" -- cgit v1.2.1 From eb918d5564ca36cfee3fb42e66ed9d1c872a68c7 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 9 Jun 2013 21:21:24 +0300 Subject: Update README.markdown --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index b5ae9e2..ae19fdd 100644 --- a/README.markdown +++ b/README.markdown @@ -1,4 +1,4 @@ -# CodeRay [![Build Status](https://travis-ci.org/rubychan/coderay.png)](https://travis-ci.org/rubychan/coderay) [![Gem Version](https://badge.fury.io/rb/coderay.png)](http://badge.fury.io/rb/coderay) +# CodeRay [![Build Status](https://travis-ci.org/rubychan/coderay.png)](https://travis-ci.org/rubychan/coderay) [![Gem Version](https://badge.fury.io/rb/coderay.png)](http://badge.fury.io/rb/coderay) [![Dependency Status](https://gemnasium.com/rubychan/coderay.png)](https://gemnasium.com/rubychan/coderay) ## About -- cgit v1.2.1 From 17ea9f4896bba4b350411921930c3f3b0415839b Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 9 Jun 2013 20:37:30 +0200 Subject: tweak .travis.yaml --- .travis.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7c29c56..59bb791 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,19 @@ rvm: - 1.8.7 - - 1.9.2 + - ree - 1.9.3 + - 2.0.0 + - ruby-head - jruby-18mode - jruby-19mode + - jruby-head - rbx-18mode - rbx-19mode - - ruby-head # test again later: RedCloth not compiling - - jruby-head - - ree branches: only: - master +matrix: + allow_failures: + - rvm: rbx-18mode + - rvm: rbx-19mode script: "rake test" # test:scanners" -- cgit v1.2.1 From 880aa337431f1135abeeb15f12343513d65f064f Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 9 Jun 2013 20:41:25 +0200 Subject: update README --- README.markdown | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.markdown b/README.markdown index ae19fdd..f333655 100644 --- a/README.markdown +++ b/README.markdown @@ -1,4 +1,8 @@ -# CodeRay [![Build Status](https://travis-ci.org/rubychan/coderay.png)](https://travis-ci.org/rubychan/coderay) [![Gem Version](https://badge.fury.io/rb/coderay.png)](http://badge.fury.io/rb/coderay) [![Dependency Status](https://gemnasium.com/rubychan/coderay.png)](https://gemnasium.com/rubychan/coderay) +# CodeRay + +[![Build Status](https://travis-ci.org/rubychan/coderay.png)](https://travis-ci.org/rubychan/coderay) +[![Gem Version](https://badge.fury.io/rb/coderay.png)](http://badge.fury.io/rb/coderay) +[![Dependency Status](https://gemnasium.com/rubychan/coderay.png)](https://gemnasium.com/rubychan/coderay) ## About @@ -12,7 +16,7 @@ You put your code in, and you get it back colored; Keywords, strings, floats, co ### Dependencies -CodeRay needs Ruby 1.8.7+ or 1.9.2+. It also runs on Rubinius and JRuby. +CodeRay needs Ruby 1.8.7, 1.9.3 or 2.0. It also runs on JRuby. ## Example Usage -- cgit v1.2.1 From 8a95c0a59eab55caaa4aff142f6448ede91db4d7 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 9 Jun 2013 21:11:29 +0200 Subject: whitespace --- lib/coderay/encoders/html.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/coderay/encoders/html.rb b/lib/coderay/encoders/html.rb index 635a4d8..0fd1317 100644 --- a/lib/coderay/encoders/html.rb +++ b/lib/coderay/encoders/html.rb @@ -286,8 +286,7 @@ module Encoders def end_group kind if $CODERAY_DEBUG && (@opened.empty? || @opened.last != kind) - warn 'Malformed token stream: Trying to close a token (%p) ' \ - 'that is not open. Open are: %p.' % [kind, @opened[1..-1]] + warn 'Malformed token stream: Trying to close a token group (%p) that is not open. Open are: %p.' % [kind, @opened[1..-1]] end if @opened.pop @out << '' @@ -312,8 +311,7 @@ module Encoders def end_line kind if $CODERAY_DEBUG && (@opened.empty? || @opened.last != kind) - warn 'Malformed token stream: Trying to close a line (%p) ' \ - 'that is not open. Open are: %p.' % [kind, @opened[1..-1]] + warn 'Malformed token stream: Trying to close a line (%p) that is not open. Open are: %p.' % [kind, @opened[1..-1]] end if @opened.pop @out << '' -- cgit v1.2.1 From 60d03a22df232528d7cc1b6a11e0ecc68171873a Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 9 Jun 2013 21:17:31 +0200 Subject: add .xaml file type (use XML scanner) --- lib/coderay/helpers/file_type.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/coderay/helpers/file_type.rb b/lib/coderay/helpers/file_type.rb index 12556d0..a5d83ff 100644 --- a/lib/coderay/helpers/file_type.rb +++ b/lib/coderay/helpers/file_type.rb @@ -118,10 +118,9 @@ module CodeRay 'ru' => :ruby, 'rxml' => :ruby, 'sass' => :sass, - # 'sch' => :scheme, 'sql' => :sql, - # 'ss' => :scheme, 'tmproj' => :xml, + 'xaml' => :xml, 'xhtml' => :html, 'xml' => :xml, 'yaml' => :yaml, -- cgit v1.2.1 From 2de5dab7d59021622dabf4728e0b8123dc29da8a Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 9 Jun 2013 21:18:52 +0200 Subject: changelog --- Changes.textile | 1 + 1 file changed, 1 insertion(+) diff --git a/Changes.textile b/Changes.textile index 6dcb0ee..8d0dc59 100644 --- a/Changes.textile +++ b/Changes.textile @@ -10,6 +10,7 @@ h2. Changes in 1.1 * Fixes to CSS scanner (floats, pseudoclasses) * Plugin does not warn about fallback when default is defined * Display line numbers in HTML @:table@ mode even for single-line code (remove special case) [#41, thanks to Ariejan de Vroom] +* Add .xaml file type [#121, thanks to Kozman Bálint] * @CodeRay::TokenKinds@ should not be frozen [#130, thanks to Gavin Kistner] h2. Changes in 1.0.9 -- cgit v1.2.1