updated SSF dependency

This commit is contained in:
SheetJS 2013-11-12 09:08:20 -08:00
parent b4f7030634
commit 0a70e1950f
4 changed files with 11 additions and 10 deletions

@ -1,4 +1,5 @@
/* Spreadsheet Format -- jump to XLSX for the XLSX code */
if(typeof require !== "undefined") SSF = require('ssf');
var SSF = (function() {
var SSF = {};
String.prototype.reverse=function(){return this.split("").reverse().join("");};
@ -162,9 +163,10 @@ function eval_fmt(fmt, v, opts) {
if(c === 'h') c = hr;
q={t:c, v:o}; out.push(q); lst = c; break;
case 'A':
if(!dt) dt = parse_date_code(v, opts);
q={t:c,v:"A"};
if(fmt.substr(i, 3) === "A/P") {hr = 'h';i+=3;}
else if(fmt.substr(i,5) === "AM/PM") { q.v = "AM"; i+=5; hr = 'h'; }
if(fmt.substr(i, 3) === "A/P") {q.v = dt.H >= 12 ? "P" : "A"; q.t = 'T'; hr='h';i+=3;}
else if(fmt.substr(i,5) === "AM/PM") { q.v = dt.H >= 12 ? "PM" : "AM"; q.t = 'T'; i+=5; hr='h'; }
else q.t = "t";
out.push(q); lst = c; break;
case '[': /* TODO: Fix this -- ignore all conditionals and formatting */
@ -181,7 +183,6 @@ function eval_fmt(fmt, v, opts) {
case 'h': case 'H': out[i].t = hr; lst='h'; break;
case 'd': case 'y': case 's': case 'M': case 'e': lst=out[i].t; break;
case 'm': if(lst === 's') out[i].t = 'M'; break;
}
}
@ -217,6 +218,5 @@ SSF._choose = choose_fmt;
SSF._table = table_fmt;
SSF.load = function(fmt, idx) { table_fmt[idx] = fmt; };
SSF.format = format;
return SSF;
})();

@ -457,7 +457,7 @@ function getzipfile(zip, file) {
var f = file; if(zip.files[f]) return zip.files[f];
f = file.toLowerCase(); if(zip.files[f]) return zip.files[f];
f = f.replace(/\//g,'\\'); if(zip.files[f]) return zip.files[f];
throw new Error("Cannot find file " + file + " in zip")
throw new Error("Cannot find file " + file + " in zip");
}
function parseZip(zip) {

@ -9,6 +9,7 @@
},
"main": "./xlsx",
"dependencies": {
"ssf":">=0.1.1",
"codepage":"",
"commander":""
},

10
xlsx.js

@ -1,6 +1,7 @@
/* vim: set ts=2: */
/*jshint eqnull:true */
/* Spreadsheet Format -- jump to XLSX for the XLSX code */
if(typeof require !== "undefined") SSF = require('ssf');
var SSF = (function() {
var SSF = {};
String.prototype.reverse=function(){return this.split("").reverse().join("");};
@ -164,9 +165,10 @@ function eval_fmt(fmt, v, opts) {
if(c === 'h') c = hr;
q={t:c, v:o}; out.push(q); lst = c; break;
case 'A':
if(!dt) dt = parse_date_code(v, opts);
q={t:c,v:"A"};
if(fmt.substr(i, 3) === "A/P") {hr = 'h';i+=3;}
else if(fmt.substr(i,5) === "AM/PM") { q.v = "AM"; i+=5; hr = 'h'; }
if(fmt.substr(i, 3) === "A/P") {q.v = dt.H >= 12 ? "P" : "A"; q.t = 'T'; hr='h';i+=3;}
else if(fmt.substr(i,5) === "AM/PM") { q.v = dt.H >= 12 ? "PM" : "AM"; q.t = 'T'; i+=5; hr='h'; }
else q.t = "t";
out.push(q); lst = c; break;
case '[': /* TODO: Fix this -- ignore all conditionals and formatting */
@ -183,7 +185,6 @@ function eval_fmt(fmt, v, opts) {
case 'h': case 'H': out[i].t = hr; lst='h'; break;
case 'd': case 'y': case 's': case 'M': case 'e': lst=out[i].t; break;
case 'm': if(lst === 's') out[i].t = 'M'; break;
}
}
@ -219,7 +220,6 @@ SSF._choose = choose_fmt;
SSF._table = table_fmt;
SSF.load = function(fmt, idx) { table_fmt[idx] = fmt; };
SSF.format = format;
return SSF;
})();
var XLSX = {};
@ -888,7 +888,7 @@ function getzipfile(zip, file) {
var f = file; if(zip.files[f]) return zip.files[f];
f = file.toLowerCase(); if(zip.files[f]) return zip.files[f];
f = f.replace(/\//g,'\\'); if(zip.files[f]) return zip.files[f];
throw new Error("Cannot find file " + file + " in zip")
throw new Error("Cannot find file " + file + " in zip");
}
function parseZip(zip) {