Permalink
Browse files

Merge branch 'master' into develop

  • Loading branch information...
2 parents cb28e0d + 942520d commit 383d37285f4600b6f82a694b38d7742495c027e1 @awebneck committed Dec 28, 2011
Showing with 15 additions and 19 deletions.
  1. +1 −0 README.rdoc
  2. +1 −1 VERSION
  3. +0 −5 lib/savage.rb
  4. +3 −3 lib/savage/parser.rb
  5. +1 −1 lib/savage/sub_path.rb
  6. +8 −8 savage.gemspec
  7. +1 −1 spec/savage/parser_spec.rb
View
@@ -92,6 +92,7 @@ I have no doubt that will be some problems with this thing, as well as features
* Jeremy Holland (jeremy@jeremypholland.com, github:awebneck) -- author
* Christoffer Klang (toffeklang@yahoo.se, github:christoffer) -- regexp improvements
+* MatmaRex (github:MatmaRex) -- parser improvements and scientific notation support
== Copyright
View
@@ -1 +1 @@
-1.1.3
+1.1.4
View
@@ -1,8 +1,3 @@
-begin
- require 'active_support/core_ext/string/inflections'
-rescue LoadError, NameError
- require 'activesupport'
-end
SAVAGE_PATH = File.dirname(__FILE__) + "/savage/"
[
'utils',
View
@@ -18,7 +18,7 @@ def extract_subpaths(parsable)
subpaths = []
if move_index = parsable.index(/[Mm]/)
subpaths << parsable[0...move_index] if move_index > 0
- parsable.scan /[Mm](?:\d|[eE.,-]|[LlHhVvQqCcTtSsAaZz]|\W)+/m do |match_group|
+ parsable.scan /[Mm](?:\d|[eE.,+-]|[LlHhVvQqCcTtSsAaZz]|\W)+/m do |match_group|
subpaths << $&
end
else
@@ -35,7 +35,7 @@ def parse_subpath(parsable)
def extract_directions(parsable)
directions = []
- parsable.scan /[MmLlHhVvQqCcTtSsAaZz](?:\d|[eE.,-]|\W)*/m do |match_group|
+ parsable.scan /[MmLlHhVvQqCcTtSsAaZz](?:\d|[eE.,+-]|\W)*/m do |match_group|
direction = build_direction $&
if direction.kind_of?(Array)
directions.concat direction
@@ -127,7 +127,7 @@ def build_direction(parsable)
def extract_coordinates(command_string)
coordinates = []
- command_string.scan(/-?\d+(\.\d+)?([eE]-?\d+)?/) do |match_group|
+ command_string.scan(/-?\d+(\.\d+)?([eE][+-]?\d+)?/) do |match_group|
coordinates << $&.to_f
end
coordinates
View
@@ -7,7 +7,7 @@ class SubPath
define_method(sym) do |*args|
raise TypeError if const == "QuadraticCurveTo" && @directions.last.class != Directions::QuadraticCurveTo && [2,3].include?(args.length)
raise TypeError if const == "CubicCurveTo" && @directions.last.class != Directions::CubicCurveTo && [4,5].include?(args.length)
- (@directions << ("Savage::Directions::" << const).constantize.new(*args)).last
+ (@directions << Savage::Directions.const_get(const).new(*args)).last
end
end
View
@@ -4,14 +4,14 @@
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
- s.name = %q{savage}
- s.version = "1.1.2"
+ s.name = "savage"
+ s.version = "1.1.4"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Jeremy Holland"]
- s.date = %q{2011-07-21}
- s.description = %q{A little gem for extracting and manipulating SVG vector path data.}
- s.email = %q{jeremy@jeremypholland.com}
+ s.date = "2011-12-02"
+ s.description = "A little gem for extracting and manipulating SVG vector path data."
+ s.email = "jeremy@jeremypholland.com"
s.extra_rdoc_files = [
"LICENSE",
"README.rdoc"
@@ -60,10 +60,10 @@ Gem::Specification.new do |s|
"spec/shared/point_target.rb",
"spec/spec_helper.rb"
]
- s.homepage = %q{http://github.com/awebneck/savage}
+ s.homepage = "http://github.com/awebneck/savage"
s.require_paths = ["lib"]
- s.rubygems_version = %q{1.6.2}
- s.summary = %q{A little library to manipulate SVG path data}
+ s.rubygems_version = "1.8.10"
+ s.summary = "A little library to manipulate SVG path data"
if s.respond_to? :specification_version then
s.specification_version = 3
@@ -194,7 +194,7 @@
it "should support scienfitic notation in paths (eg. 2e-5)" do
# this is a 100x100 square
- path = Parser.parse "M 0,0 L 1e2,0 100,1000e-1 L 0,100"
+ path = Parser.parse "M 0,0 L 1e2,0 100,1000e-1 L 0,10e+1"
points = path.directions.map{|d| [d.target.x, d.target.y] }
points.should == [[0.0, 0.0], [100.0, 0.0], [100.0, 100.0], [0.0, 100.0]]
end

0 comments on commit 383d372

Please sign in to comment.