SassyJSON 1.0.9 → 1.0.10

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: 1cf04a52495a225d84b9f238e9fb8f33209ae5a3
4
+ data.tar.gz: 5ecabfe827ede30ad3ba986cc1f7d82379c42787
5
+ SHA512:
6
+ metadata.gz: 828cb801f2757a8b9e9bd9115031e1928263df28fba4f5337fe1d6ce336d93119ed544f94108e96a3f06cc0338773e9d66ccaa2f33b2c7bd233f8d09b0ac6520
7
+ data.tar.gz: 59bf68fe6d86dc866c27ad802c93afda71aa82ddd8723e477b6955df8899ac1ec44d50cb8b9aa057d5c4d7f82a252f54d7bb4813e71065f408f4c1ef0e821128
data/README.md CHANGED
@@ -79,7 +79,7 @@ All you need is a clean version of Sass 3.3. Otherwise it's just pure Sass madne
79
79
 
80
80
  * [NodeJS](http://nodejs.org)
81
81
  * [Ruby](https://www.ruby-lang.org/)
82
- * Sass 3.3 via `gem instals sass --pre`
82
+ * Sass 3.3 via `gem install sass --pre`
83
83
  * `grunt-cli` via `npm install -g grunt-cli`
84
84
 
85
85
  ### How to
data/lib/SassyJSON.rb CHANGED
@@ -5,8 +5,8 @@ Compass::Frameworks.register('SassyJSON', :path => extension_path)
5
5
  # Version is a number. If a version contains alphas, it will be created as a prerelease version
6
6
  # Date is in the form of YYYY-MM-DD
7
7
  module SassyJSON
8
- VERSION = "1.0.9"
9
- DATE = "2014-01-21"
8
+ VERSION = "1.0.10"
9
+ DATE = "2014-01-23"
10
10
  end
11
11
 
12
12
  module Sass::Script::Functions
@@ -9,25 +9,23 @@
9
9
 
10
10
  @function _find-digits($source, $pointer) {
11
11
  $length: str-length($source);
12
- $strings: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9';
13
- $numbers: 0 1 2 3 4 5 6 7 8 9;
12
+ $numbers: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9';
14
13
  $result: null;
15
14
  $runs: 1;
16
15
 
17
16
  @while $pointer <= $length {
18
17
  $token: to-lower-case(str-slice($source, $pointer, $pointer));
19
- $index: index($strings, $token);
18
+ $index: index($numbers, $token);
20
19
 
21
20
  @if $token == '.' {
22
21
  // @continue;
23
22
  }
24
23
  @else if $index and $index > 0 {
25
- $number: nth($numbers, $index);
26
24
  $runs: $runs * 10;
27
- $result: if($result == null, $number, $result * 10 + $number);
25
+ $result: if($result == null, ($index - 1), $result * 10 + ($index - 1));
28
26
  }
29
27
  @else {
30
- @if index('e' '.' ',' ']' '}' ' ', $token) {
28
+ @if index('e' '.' ' ' ',' ']' '}', $token) {
31
29
  @return $pointer, if($result != null, $result / $runs, $result);
32
30
  }
33
31
  @return _throw("Unexpected token `" + $token + "`.", $pointer);
@@ -9,14 +9,13 @@
9
9
 
10
10
  @function _find-exponent($source, $pointer) {
11
11
  $length: str-length($source);
12
- $strings: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9';
13
- $numbers: 0 1 2 3 4 5 6 7 8 9;
12
+ $numbers: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9';
14
13
  $result: null;
15
14
  $minus: false;
16
15
 
17
16
  @while $pointer <= $length {
18
17
  $token: to-lower-case(str-slice($source, $pointer, $pointer));
19
- $index: index($strings, $token);
18
+ $index: index($numbers, $token);
20
19
 
21
20
  @if $token == 'e' {
22
21
  // @continue;
@@ -28,11 +27,10 @@
28
27
  $minus: false;
29
28
  }
30
29
  @else if $index and $index > 0 {
31
- $number: nth($numbers, $index);
32
- $result: if($result == null, $number, $result * 10 + $number);
30
+ $result: if($result == null, ($index - 1), $result * 10 + ($index - 1));
33
31
  }
34
32
  @else {
35
- @if not index(" " " " "]" "}", $token) {
33
+ @if not index(' ' ',' ']' '}', $token) {
36
34
  @return _throw("Unexpected token `" + $token + "`.", $pointer);
37
35
  }
38
36
 
@@ -9,23 +9,21 @@
9
9
 
10
10
  @function _find-integer($source, $pointer) {
11
11
  $length: str-length($source);
12
- $strings: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9';
13
- $numbers: 0 1 2 3 4 5 6 7 8 9;
12
+ $numbers: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9';
14
13
  $result: 0;
15
14
 
16
15
  @while $pointer <= $length {
17
16
  $token: to-lower-case(str-slice($source, $pointer, $pointer));
18
- $index: index($strings, $token);
17
+ $index: index($numbers, $token);
19
18
 
20
19
  @if $token == '-' {
21
20
  // do nothing
22
21
  }
23
22
  @else if $index {
24
- $number: nth($numbers, $index);
25
- $result: $result * 10 + $number;
23
+ $result: $result * 10 + ($index - 1);
26
24
  }
27
25
  @else {
28
- @if index('e' '.' ',' ']' '}' ' ', $token) {
26
+ @if index('e' '.' ' ' ',' ']' '}', $token) {
29
27
  @return $pointer, $result;
30
28
  }
31
29
  @return _throw("Unexpected token `" + $token + "`.", $pointer);
@@ -2,35 +2,56 @@
2
2
  // --------------------------------------------------------------------------------
3
3
  // @param [string] $string: to search in
4
4
  // --------------------------------------------------------------------------------
5
- // @return [number] position of the last non escaped quote
5
+ // @return [number] position of the first non escaped quote
6
6
 
7
7
  @function _find-ending-quote($string){
8
- $backslash: str-slice("\\", 1, 1); // Dirty hack to have a single backslash
9
- $search: $string;
10
-
11
- $end-quote-found: false;
12
- $position: 0;
13
-
14
-
15
- @while not $end-quote-found {
16
- $index: str-index($search, '"');
17
-
18
- @if not $index or $index == 0 { // No end of string found
19
- @return $index;
8
+ $backslash: str-slice('\\', 1, 1); // Dirty hack to have a single backslash
9
+ $escaped-chars: '"\/bfnrtu'; // Characters that can be escaped in JSON
10
+ $hexadecimal-chars: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9' '0' 'a' 'b' 'c' 'd' 'e' 'f';
11
+
12
+ $pos: 1;
13
+ $length: str-length($string);
14
+ $backslash-found: false;
15
+
16
+ @while $pos <= $length {
17
+ $char: to-lower-case(str-slice($string, $pos, $pos));
18
+
19
+ // Previous char was a backslash
20
+ @if $backslash-found {
21
+
22
+ // Special case, the 'u' character
23
+ @if $char == 'u' {
24
+ // Next 4 characters must be hexadecimal
25
+ @if not index($hexadecimal-chars, str-slice($string, $pos + 1, $pos + 1)) or
26
+ not index($hexadecimal-chars, str-slice($string, $pos + 2, $pos + 2)) or
27
+ not index($hexadecimal-chars, str-slice($string, $pos + 3, $pos + 3)) or
28
+ not index($hexadecimal-chars, str-slice($string, $pos + 4, $pos + 4)) {
29
+ @return 0;
30
+ }
31
+
32
+ $pos: $pos + 4;
33
+ }
34
+
35
+ // Invalid character escaped
36
+ @else if not str-index($escaped-chars, $char) {
37
+ @return 0;
38
+ }
39
+
40
+ $backslash-found: false;
20
41
  }
21
42
 
22
- @else {
23
- $position: $position + $index;
43
+ @else if $char == $backslash {
44
+ $backslash-found: true;
24
45
  }
25
46
 
26
- $char-before-quote: str-slice($search, $index - 1, $index - 1);
27
-
28
- @if $char-before-quote != $backslash {
29
- $end-quote-found: true;
47
+ // Unescaped quote found
48
+ @else if $char == '"' {
49
+ @return $pos;
30
50
  }
31
51
 
32
- $search: str-slice($search, $index + 1);
52
+ $pos: $pos + 1;
33
53
  }
34
54
 
35
- @return $position;
55
+ // No end of string found
56
+ @return 0;
36
57
  }
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: SassyJSON
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
5
- prerelease:
4
+ version: 1.0.10
6
5
  platform: ruby
7
6
  authors:
8
7
  - Hugo Giraudel
@@ -10,7 +9,7 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2014-01-21 00:00:00.000000000 Z
12
+ date: 2014-01-23 00:00:00.000000000 Z
14
13
  dependencies: []
15
14
  description: Sass API for JSON
16
15
  email:
@@ -61,27 +60,26 @@ files:
61
60
  - stylesheets/SassyJSON.scss
62
61
  homepage: https://github.com/HugoGiraudel/SassyJSON/
63
62
  licenses: []
63
+ metadata: {}
64
64
  post_install_message:
65
65
  rdoc_options: []
66
66
  require_paths:
67
67
  - lib
68
68
  required_ruby_version: !ruby/object:Gem::Requirement
69
- none: false
70
69
  requirements:
71
- - - ! '>='
70
+ - - '>='
72
71
  - !ruby/object:Gem::Version
73
72
  version: '0'
74
73
  required_rubygems_version: !ruby/object:Gem::Requirement
75
- none: false
76
74
  requirements:
77
- - - ! '>='
75
+ - - '>='
78
76
  - !ruby/object:Gem::Version
79
77
  version: 1.3.6
80
78
  requirements: []
81
79
  rubyforge_project: SassyJSON
82
- rubygems_version: 1.8.24
80
+ rubygems_version: 2.0.3
83
81
  signing_key:
84
- specification_version: 3
82
+ specification_version: 4
85
83
  summary: SassyJSON is a Sass-powered API for JSON. It provides you the classic json-encode
86
84
  and json-decode directly from your Sass files.
87
85
  test_files: []