stringjs-rails 1.9.0 → 1.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dbf3c41630ea1f4e6a0f802379bdcf73c3b3efd5
4
- data.tar.gz: 1a947db6bae28352cf3068447cd5bfcb91647cae
3
+ metadata.gz: f623bac6fb3dcf5aa07aaf16035a06de468d0f27
4
+ data.tar.gz: d59a2d49712e70e53428d8604ecb27c2510c2685
5
5
  SHA512:
6
- metadata.gz: 41308de38060e4cb19ff9bf20a4935fd6c953e578919ed0391ee40937a6b7b0e8278d3d79b3e685eeccee0cf1df5c4f45a947f33cd85f24c29fe97a17fee5b5a
7
- data.tar.gz: 2ab95e69dd1a5de0f293f970f8c19a2ceeb72917e4157fa14102915f380ff7dabc96a7b304e04d60bad20dfcf6188e70056d663e2fe83bc57de4b222be6a47b8
6
+ metadata.gz: cf469d1b92908ec00c2b7eda669686aac6b0f87b632f8eb5c74c9fddc7d56b095f7607c03ad387cdf713e66745653493365a33a5bdbf1e7837d1ad36fb96eb64
7
+ data.tar.gz: fc4578525b2c513e8610910fe40b5d358eda5e36025efa72d13defdb2ac6d359bc8cdfb6bf5c4cb8a5e654804d3bd13ac9f170c54e353c4b747bf3b01354b22c
@@ -196,11 +196,11 @@ string.js - Copyright (C) 2012-2014, JP Richardson <jprichardson@gmail.com>
196
196
  },
197
197
 
198
198
  isAlpha: function() {
199
- return !/[^a-z\xC0-\xFF]/.test(this.s.toLowerCase());
199
+ return !/[^a-z\xDF-\xFF]/.test(this.s.toLowerCase());
200
200
  },
201
201
 
202
202
  isAlphaNumeric: function() {
203
- return !/[^0-9a-z\xC0-\xFF]/.test(this.s.toLowerCase());
203
+ return !/[^0-9a-z\xDF-\xFF]/.test(this.s.toLowerCase());
204
204
  },
205
205
 
206
206
  isEmpty: function() {
@@ -259,7 +259,7 @@ string.js - Copyright (C) 2012-2014, JP Richardson <jprichardson@gmail.com>
259
259
  if (typeof qualifier == 'undefined')
260
260
  qualifier = '"';
261
261
 
262
- var i = 0, fieldBuffer = [], fields = [], len = this.s.length, inField = false, self = this;
262
+ var i = 0, fieldBuffer = [], fields = [], len = this.s.length, inField = false, inUnqualifiedString = false, self = this;
263
263
  var ca = function(i){return self.s.charAt(i)};
264
264
  if (typeof lineDelimiter !== 'undefined') var rows = [];
265
265
 
@@ -270,17 +270,21 @@ string.js - Copyright (C) 2012-2014, JP Richardson <jprichardson@gmail.com>
270
270
  var current = ca(i);
271
271
  switch (current) {
272
272
  case escape:
273
- //fix for issues #32 and #35
274
- if (inField && ((escape !== qualifier) || ca(i+1) === qualifier)) {
273
+ //fix for issues #32 and #35
274
+ if (inField && ((escape !== qualifier) || ca(i+1) === qualifier)) {
275
275
  i += 1;
276
276
  fieldBuffer.push(ca(i));
277
277
  break;
278
- }
279
- if (escape !== qualifier) break;
278
+ }
279
+ if (escape !== qualifier) break;
280
280
  case qualifier:
281
281
  inField = !inField;
282
282
  break;
283
283
  case delimiter:
284
+ if(inUnqualifiedString) {
285
+ inField=false;
286
+ inUnqualifiedString=false;
287
+ }
284
288
  if (inField && qualifier)
285
289
  fieldBuffer.push(current);
286
290
  else {
@@ -289,20 +293,37 @@ string.js - Copyright (C) 2012-2014, JP Richardson <jprichardson@gmail.com>
289
293
  }
290
294
  break;
291
295
  case lineDelimiter:
292
- if (inField) {
293
- fieldBuffer.push(current);
296
+ if(inUnqualifiedString) {
297
+ inField=false;
298
+ inUnqualifiedString=false;
299
+ fields.push(fieldBuffer.join(''))
300
+ rows.push(fields);
301
+ fields = [];
302
+ fieldBuffer.length = 0;
303
+ }
304
+ else if (inField) {
305
+ fieldBuffer.push(current);
294
306
  } else {
295
- if (rows) {
296
- fields.push(fieldBuffer.join(''))
297
- rows.push(fields);
298
- fields = [];
299
- fieldBuffer.length = 0;
300
- }
307
+ if (rows) {
308
+ fields.push(fieldBuffer.join(''))
309
+ rows.push(fields);
310
+ fields = [];
311
+ fieldBuffer.length = 0;
312
+ }
301
313
  }
302
314
  break;
315
+ case ' ':
316
+ if (inField)
317
+ fieldBuffer.push(current);
318
+ break;
303
319
  default:
304
320
  if (inField)
305
321
  fieldBuffer.push(current);
322
+ else if(current!==qualifier) {
323
+ fieldBuffer.push(current);
324
+ inField=true;
325
+ inUnqualifiedString=true;
326
+ }
306
327
  break;
307
328
  }
308
329
  i += 1;
@@ -551,7 +572,7 @@ string.js - Copyright (C) 2012-2014, JP Richardson <jprichardson@gmail.com>
551
572
  //#Added a New Function called wrapHTML.
552
573
  wrapHTML: function (tagName, tagAttrs) {
553
574
  var s = this.s, el = (tagName == null) ? 'span' : tagName, elAttr = '', wrapped = '';
554
- if(typeof tagAttrs == 'object') for(var prop in tagAttrs) elAttr += ' ' + prop + '="' + tagAttrs[prop] + '"';
575
+ if(typeof tagAttrs == 'object') for(var prop in tagAttrs) elAttr += ' ' + prop + '="' +(new this.constructor(tagAttrs[prop])).escapeHTML() + '"';
555
576
  s = wrapped.concat('<', el, elAttr, '>', this, '</', el, '>');
556
577
  return new this.constructor(s);
557
578
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stringjs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesper Josefsson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-25 00:00:00.000000000 Z
11
+ date: 2014-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -89,3 +89,4 @@ signing_key:
89
89
  specification_version: 4
90
90
  summary: The String.js Javascript library ready for the Rails asset pipeline
91
91
  test_files: []
92
+ has_rdoc: