SassyStrings 0.0.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1858e81abf387817256c495624957d607f23ff37
4
+ data.tar.gz: 02bde1b71b1f9e115966456f75ca0790f19c96a2
5
+ SHA512:
6
+ metadata.gz: f8aa02689622cc9b8ed86ce1c77a527af828a95a4610919311b90eb72b3fea01490caaeff2fcddbc624ef9a82a1aec802c9d9c95b5a7fa730f5e672111e14369
7
+ data.tar.gz: 9336e6f541dbcfd7e549a8aa298c8bad6e1cfbecc99f584bd31e59d513793ee80fae5f313a6c5bd7e89f99ea4a01b72c447b69620eca31da3f1ae2fe27095eef
data/CHANGELOG.md CHANGED
@@ -1,3 +1,4 @@
1
1
  # Changelog
2
2
 
3
- * `1.0.0`: initial commit
3
+ * `1.0.0`: stable
4
+ * `0.0.1`: initial commit
data/lib/SassyStrings.rb CHANGED
@@ -1,14 +1,14 @@
1
- require 'compass'
2
-
3
- extension_path = File.expand_path(File.join(File.dirname(__FILE__), ".."))
4
- Compass::Frameworks.register("SassyStrings", :path => "#{File.dirname(__FILE__)}/..")
5
-
6
- module SassyStrings
7
- VERSION = "0.0.1"
8
- DATE = "2014-02-16"
9
- end
10
-
11
- # Sassy String Functions
12
- module Sass::Script::Functions
13
-
14
- end
1
+ require 'compass'
2
+
3
+ extension_path = File.expand_path(File.join(File.dirname(__FILE__), ".."))
4
+ Compass::Frameworks.register("SassyStrings", :path => "#{File.dirname(__FILE__)}/..")
5
+
6
+ module SassyStrings
7
+ VERSION = "1.0.0"
8
+ DATE = "2014-03-22"
9
+ end
10
+
11
+ # Sassy String Functions
12
+ module Sass::Script::Functions
13
+
14
+ end
@@ -1,99 +1,99 @@
1
- // Calculating Levenshtein distance between two strings
2
- // ----------------------------------------------------------------------------------------------------
3
- // @param $a: first string
4
- // @param $b: second string
5
- // ----------------------------------------------------------------------------------------------------
6
- // @return [number]
7
-
8
- @function levenshtein($a, $b) {
9
- @if type-of($a) != "string" {
10
- @warn "`str-count` function expecting a string for $a; #{type-of($a)} given.";
11
- @return false;
12
- }
13
-
14
- @if type-of($b) != "string" {
15
- @warn "`str-count` function expecting a string for $b; #{type-of($b)} given.";
16
- @return false;
17
- }
18
-
19
- $a: to-lower-case($a);
20
- $b: to-lower-case($b);
21
-
22
- $n: str-length($a);
23
- $m: str-length($b);
24
-
25
- $matrix: _matrix($n + 1, $m + 1);
26
- $cost: _matrix($n, $m);
27
-
28
- @if $a == $b { @return 0; }
29
- @if $n == 0 { @return $m; }
30
- @if $m == 0 { @return $n; }
31
-
32
- @for $i from 0 through $n {
33
- @for $j from 0 through $m {
34
- $v: if($i == 0, $j, if($j == 0, $i, 0));
35
- @if $v != 0 {
36
- $matrix: _set-matrix($matrix, $i + 1, $j + 1, $v);
37
- }
38
- @if $i != 0 and $j != 0 {
39
- $v: if(str-slice($a, $i, $i) == str-slice($b, $j, $j), 0, 1);
40
- @if $v != 0 {
41
- $cost: _set-matrix($cost, $i, $j, $v);
42
- }
43
- }
44
- }
45
- }
46
-
47
- @for $i from 2 through length($matrix) {
48
- @for $j from 2 through length(nth($matrix, $i)) {
49
- $matrix: _set-matrix($matrix, $i, $j, min(_e($matrix, $i - 1, $j) + 1, _e($matrix, $i, $j - 1) + 1, _e($matrix, $i - 1, $j - 1) + _e($cost, $i - 1, $j - 1)));
50
- }
51
- }
52
-
53
- @return _e($matrix, length($matrix), length(nth($matrix, 1)));
54
- }
55
-
56
-
57
- // Helper to target an element in a matrix
58
- // ----------------------------------------------------------------------------------------------------
59
- // @param $m: matrix
60
- // @param $x: x coord
61
- // @param $y: y coord
62
- // ----------------------------------------------------------------------------------------------------
63
- // @return [literal]
64
-
65
- @function _e($m, $x, $y) {
66
- @return nth(nth($m, $x), $y);
67
- }
68
-
69
- // Helper instanciation a matrix of $x by $y
70
- // ----------------------------------------------------------------------------------------------------
71
- // @param $x: number of cols
72
- // @param $y: number of lines
73
- // ----------------------------------------------------------------------------------------------------
74
- // @return [list]
75
-
76
- @function _matrix($x, $y) {
77
- $matrix: ();
78
- @for $i from 1 through $x {
79
- $tmp: ();
80
- @for $y from 1 through $y {
81
- $tmp: append($tmp, 0)
82
- }
83
- $matrix: append($matrix, $tmp);
84
- }
85
- @return $matrix;
86
- }
87
-
88
- // Helper assigning $value at $matrix[$x, $y]
89
- // ----------------------------------------------------------------------------------------------------
90
- // @param $matrix: matrix to update
91
- // @param $x: x coord
92
- // @param $y: y coord
93
- // @param $value: value to assign at $matrix[$x, $y]
94
- // ----------------------------------------------------------------------------------------------------
95
- // @return [list]
96
-
97
- @function _set-matrix($matrix, $x, $y, $value) {
98
- @return set-nth($matrix, $x, set-nth(nth($matrix, $x), $y, $value));
1
+ // Calculating Levenshtein distance between two strings
2
+ // ----------------------------------------------------------------------------------------------------
3
+ // @param $a: first string
4
+ // @param $b: second string
5
+ // ----------------------------------------------------------------------------------------------------
6
+ // @return [number]
7
+
8
+ @function levenshtein($a, $b) {
9
+ @if type-of($a) != "string" {
10
+ @warn "`str-count` function expecting a string for $a; #{type-of($a)} given.";
11
+ @return false;
12
+ }
13
+
14
+ @if type-of($b) != "string" {
15
+ @warn "`str-count` function expecting a string for $b; #{type-of($b)} given.";
16
+ @return false;
17
+ }
18
+
19
+ $a: to-lower-case($a);
20
+ $b: to-lower-case($b);
21
+
22
+ $n: str-length($a);
23
+ $m: str-length($b);
24
+
25
+ $matrix: _matrix($n + 1, $m + 1);
26
+ $cost: _matrix($n, $m);
27
+
28
+ @if $a == $b { @return 0; }
29
+ @if $n == 0 { @return $m; }
30
+ @if $m == 0 { @return $n; }
31
+
32
+ @for $i from 0 through $n {
33
+ @for $j from 0 through $m {
34
+ $v: if($i == 0, $j, if($j == 0, $i, 0));
35
+ @if $v != 0 {
36
+ $matrix: _set-matrix($matrix, $i + 1, $j + 1, $v);
37
+ }
38
+ @if $i != 0 and $j != 0 {
39
+ $v: if(str-slice($a, $i, $i) == str-slice($b, $j, $j), 0, 1);
40
+ @if $v != 0 {
41
+ $cost: _set-matrix($cost, $i, $j, $v);
42
+ }
43
+ }
44
+ }
45
+ }
46
+
47
+ @for $i from 2 through length($matrix) {
48
+ @for $j from 2 through length(nth($matrix, $i)) {
49
+ $matrix: _set-matrix($matrix, $i, $j, min(_e($matrix, $i - 1, $j) + 1, _e($matrix, $i, $j - 1) + 1, _e($matrix, $i - 1, $j - 1) + _e($cost, $i - 1, $j - 1)));
50
+ }
51
+ }
52
+
53
+ @return _e($matrix, length($matrix), length(nth($matrix, 1)));
54
+ }
55
+
56
+
57
+ // Helper to target an element in a matrix
58
+ // ----------------------------------------------------------------------------------------------------
59
+ // @param $m: matrix
60
+ // @param $x: x coord
61
+ // @param $y: y coord
62
+ // ----------------------------------------------------------------------------------------------------
63
+ // @return [literal]
64
+
65
+ @function _e($m, $x, $y) {
66
+ @return nth(nth($m, $x), $y);
67
+ }
68
+
69
+ // Helper instanciation a matrix of $x by $y
70
+ // ----------------------------------------------------------------------------------------------------
71
+ // @param $x: number of cols
72
+ // @param $y: number of lines
73
+ // ----------------------------------------------------------------------------------------------------
74
+ // @return [list]
75
+
76
+ @function _matrix($x, $y) {
77
+ $matrix: ();
78
+ @for $i from 1 through $x {
79
+ $tmp: ();
80
+ @for $y from 1 through $y {
81
+ $tmp: append($tmp, 0)
82
+ }
83
+ $matrix: append($matrix, $tmp);
84
+ }
85
+ @return $matrix;
86
+ }
87
+
88
+ // Helper assigning $value at $matrix[$x, $y]
89
+ // ----------------------------------------------------------------------------------------------------
90
+ // @param $matrix: matrix to update
91
+ // @param $x: x coord
92
+ // @param $y: y coord
93
+ // @param $value: value to assign at $matrix[$x, $y]
94
+ // ----------------------------------------------------------------------------------------------------
95
+ // @return [list]
96
+
97
+ @function _set-matrix($matrix, $x, $y, $value) {
98
+ @return set-nth($matrix, $x, set-nth(nth($matrix, $x), $y, $value));
99
99
  }
metadata CHANGED
@@ -1,48 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: SassyStrings
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 1.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Hugo Giraudel
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-02-16 00:00:00.000000000 Z
11
+ date: 2014-03-22 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: sass
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '3.3'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '3.3'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: compass
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
- version: 1.0.0
33
+ version: 1.0.0.alpha.18
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
- version: 1.0.0
40
+ version: 1.0.0.alpha.18
46
41
  description: A collection of Sass functions to manipulate strings.
47
42
  email:
48
43
  - hugo.giraudel@gmail.com
@@ -53,6 +48,7 @@ files:
53
48
  - README.md
54
49
  - CHANGELOG.md
55
50
  - lib/SassyStrings.rb
51
+ - stylesheets/_SassyStrings.scss
56
52
  - stylesheets/functions/_char-at.scss
57
53
  - stylesheets/functions/_levenshtein.scss
58
54
  - stylesheets/functions/_str-count.scss
@@ -73,29 +69,27 @@ files:
73
69
  - stylesheets/functions/_str-ucfirst.scss
74
70
  - stylesheets/functions/_str-word-count.scss
75
71
  - stylesheets/functions/_stringify.scss
76
- - stylesheets/_SassyStrings.scss
77
72
  homepage: https://github.com/HugoGiraudel/SassyStrings
78
73
  licenses: []
74
+ metadata: {}
79
75
  post_install_message:
80
76
  rdoc_options: []
81
77
  require_paths:
82
78
  - lib
83
79
  required_ruby_version: !ruby/object:Gem::Requirement
84
- none: false
85
80
  requirements:
86
- - - ! '>='
81
+ - - '>='
87
82
  - !ruby/object:Gem::Version
88
83
  version: '0'
89
84
  required_rubygems_version: !ruby/object:Gem::Requirement
90
- none: false
91
85
  requirements:
92
- - - ! '>='
86
+ - - '>='
93
87
  - !ruby/object:Gem::Version
94
88
  version: '1.2'
95
89
  requirements: []
96
90
  rubyforge_project: SassyStrings
97
- rubygems_version: 1.8.24
91
+ rubygems_version: 2.0.3
98
92
  signing_key:
99
- specification_version: 3
93
+ specification_version: 4
100
94
  summary: Advanced String handling for Sass
101
95
  test_files: []