-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
86 changed files
with
16,705 additions
and
16,705 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<<<<<<< HEAD | ||
node_modules | ||
======= | ||
.c9revisions | ||
>>>>>>> rangeHandler | ||
<<<<<<< HEAD | ||
node_modules | ||
======= | ||
.c9revisions | ||
>>>>>>> rangeHandler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,42 @@ | ||
#includes | ||
{exec} = require 'child_process' | ||
http = require 'http' | ||
fs = require 'fs' | ||
querystring = require 'querystring' | ||
|
||
#Globals | ||
VERSION = '0.9.4' | ||
YEAR = (new Date).getFullYear | ||
LICENSE = fs.readFileSync './license.include', 'utf8' | ||
|
||
COMPILER_PATH = './node_modules/closure-compiler/lib/vendor/compiler.jar' | ||
DOCCO_PATH = './node_modules/docco/lib/docco.js' | ||
CORE_PATH = './src/core.js' | ||
EXCEL_FORMULA_UTILITIES_PATH = './src/ExcelFormulaUtilities.js' | ||
LICENSE_PATH = './license.include' | ||
DEV_BUILD_PATH = "./excelFormulaUtilities-#{VERSION}.js" | ||
PROD_BUILD_PATH = "./excelFormulaUtilities-#{VERSION}.min.js" | ||
|
||
# build | ||
#------ | ||
task 'build', 'Building', -> | ||
|
||
fileLicense = fs.readFileSync(LICENSE_PATH, 'utf8').toString().replace('#{VERSION}', "#{VERSION}").replace('#{YEAR}', (new Date()).getFullYear()) | ||
jsFileCore = fs.readFileSync CORE_PATH, 'utf8' | ||
jsFileExcelFormulaUtilities = fs.readFileSync EXCEL_FORMULA_UTILITIES_PATH, 'utf8' | ||
|
||
jsCode = jsFileCore + "\n" + jsFileExcelFormulaUtilities | ||
|
||
# Write the js file | ||
fs.writeFile DEV_BUILD_PATH, jsCode, 'utf8', (err)-> | ||
console.log "Saved script to #{DEV_BUILD_PATH}" | ||
|
||
# Minify | ||
exec "java -jar #{COMPILER_PATH} --compilation_level SIMPLE_OPTIMIZATIONS --js ./src/core.js --js ./src/ExcelFormulaUtilities.js --js_output_file ./excelFormulaUtilities-#{VERSION}.min.js" , (err, stdout, stderr) -> | ||
throw err if err | ||
console.log stdout + stderr | ||
|
||
# Generate Docco Docs | ||
exec "node #{DOCCO_PATH} ./src/*.js", (err, stdout, stderr) -> | ||
throw err if err | ||
#includes | ||
{exec} = require 'child_process' | ||
http = require 'http' | ||
fs = require 'fs' | ||
querystring = require 'querystring' | ||
|
||
#Globals | ||
VERSION = '0.9.4' | ||
YEAR = (new Date).getFullYear | ||
LICENSE = fs.readFileSync './license.include', 'utf8' | ||
|
||
COMPILER_PATH = './node_modules/closure-compiler/lib/vendor/compiler.jar' | ||
DOCCO_PATH = './node_modules/docco/lib/docco.js' | ||
CORE_PATH = './src/core.js' | ||
EXCEL_FORMULA_UTILITIES_PATH = './src/ExcelFormulaUtilities.js' | ||
LICENSE_PATH = './license.include' | ||
DEV_BUILD_PATH = "./excelFormulaUtilities-#{VERSION}.js" | ||
PROD_BUILD_PATH = "./excelFormulaUtilities-#{VERSION}.min.js" | ||
|
||
# build | ||
#------ | ||
task 'build', 'Building', -> | ||
|
||
fileLicense = fs.readFileSync(LICENSE_PATH, 'utf8').toString().replace('#{VERSION}', "#{VERSION}").replace('#{YEAR}', (new Date()).getFullYear()) | ||
jsFileCore = fs.readFileSync CORE_PATH, 'utf8' | ||
jsFileExcelFormulaUtilities = fs.readFileSync EXCEL_FORMULA_UTILITIES_PATH, 'utf8' | ||
|
||
jsCode = jsFileCore + "\n" + jsFileExcelFormulaUtilities | ||
|
||
# Write the js file | ||
fs.writeFile DEV_BUILD_PATH, jsCode, 'utf8', (err)-> | ||
console.log "Saved script to #{DEV_BUILD_PATH}" | ||
|
||
# Minify | ||
exec "java -jar #{COMPILER_PATH} --compilation_level SIMPLE_OPTIMIZATIONS --js ./src/core.js --js ./src/ExcelFormulaUtilities.js --js_output_file ./excelFormulaUtilities-#{VERSION}.min.js" , (err, stdout, stderr) -> | ||
throw err if err | ||
console.log stdout + stderr | ||
|
||
# Generate Docco Docs | ||
exec "node #{DOCCO_PATH} ./src/*.js", (err, stdout, stderr) -> | ||
throw err if err | ||
console.log stdout + stderr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,68 @@ | ||
# ExcelFormulaBeautifier.com | ||
|
||
This lives under the gh-pages branch. | ||
To submit pull requests for [ExcelFormulaBeautifier.com](http://ExcelFormulaBeautifier.com) please use this branch. | ||
Changes to the core js library live in the master branch. | ||
|
||
# Excel Formula Utilities for JavaScript | ||
|
||
##Installation | ||
1. Save excelFormulaUtilities-[version].js(For dev) or excelFormulaUtilities-[version].js.min (For prod). | ||
2. Save excelFormulaUtilities.css if you'd like basic styling when outputting formulas to html. | ||
3. Drop these files into your project. | ||
|
||
Check out the examples below or if you'd like to use the beautifier online click here http://excelformulabeautifier.com/ | ||
|
||
##Basic usage | ||
|
||
This will return a formated formula in plain text. | ||
|
||
excelFormulaUtilities.formatFormula('IF(1+1=2,"true","false")'); //Returns a string containing the formatted formula. | ||
|
||
##Example | ||
|
||
To see this example check out ./examples/basic_example1/index.html | ||
|
||
###The JavaScript | ||
window.onload = function(){ | ||
//Beautify an Excel formula output to text | ||
var formula_1 = 'SUM((A1:A10>=5)*(A1:A10<=10)*A1:A10)'; | ||
document.getElementById('fomatFormula_1').innerHTML = formula_1; | ||
document.getElementById('fomatFormula_1_out').innerHTML = excelFormulaUtilities.formatFormula(formula_1); | ||
|
||
//Beautify an Excel formula output to html. | ||
var formula_2 = '=RIGHT(A2,LEN(A2)-FIND("*",SUBSTITUTE(A2," ","*",LEN(A2)-LEN(SUBSTITUTE(A2," ","")))))'; | ||
document.getElementById('fomatFormula_2').innerHTML = formula_2; | ||
document.getElementById('fomatFormula_2_out').innerHTML = excelFormulaUtilities.formatFormulaHTML(formula_2); | ||
|
||
//Convert an Excel formula to C# | ||
var formula_3 = '=IF(A2:A3="YES","A2 equals yes", "A2 does not equal yes")'; | ||
document.getElementById('fomatFormula_3').innerHTML = formula_3; | ||
document.getElementById('fomatFormula_3_out').innerHTML = excelFormulaUtilities.formula2CSharp(formula_3); | ||
|
||
//Convert an Excel formula to JavaScript | ||
var formula_4 = 'ADDRESS(ROW(DataRange2),COLUMN(DataRange2),4)&":"&ADDRESS(MAX((DataRange2<>"")*ROW(DataRange2)),COLUMN(DataRange2)+COLUMNS(DataRange2)-1,4)'; | ||
document.getElementById('fomatFormula_4').innerHTML = formula_4; | ||
document.getElementById('fomatFormula_4_out').innerHTML = excelFormulaUtilities.formula2JavaScript(formula_4); | ||
} | ||
|
||
###The HTML | ||
<div class="formula"> | ||
<h2>excelFormulaUtilities.formatFormula( "<span id="fomatFormula_1"></span>" );</h2> | ||
<pre id="fomatFormula_1_out"></pre> | ||
</div> | ||
|
||
<div class="formula"> | ||
<h2>excelFormulaUtilities.formatFormulaHTML( "<span id="fomatFormula_2"></span>" );</h2> | ||
<pre id="fomatFormula_2_out"></pre> | ||
</div> | ||
|
||
<div class="formula"> | ||
<h2>excelFormulaUtilities.formula2CSharp( "<span id="fomatFormula_3"></span>" );</h2> | ||
<div id="fomatFormula_3_out"></div> | ||
</div> | ||
|
||
<div class="formula"> | ||
<h2>excelFormulaUtilities.formula2Javascript( "<span id="fomatFormula_4"></span>" );</h2> | ||
<pre id="fomatFormula_4_out"></pre> | ||
# ExcelFormulaBeautifier.com | ||
|
||
This lives under the gh-pages branch. | ||
To submit pull requests for [ExcelFormulaBeautifier.com](http://ExcelFormulaBeautifier.com) please use this branch. | ||
Changes to the core js library live in the master branch. | ||
|
||
# Excel Formula Utilities for JavaScript | ||
|
||
##Installation | ||
1. Save excelFormulaUtilities-[version].js(For dev) or excelFormulaUtilities-[version].js.min (For prod). | ||
2. Save excelFormulaUtilities.css if you'd like basic styling when outputting formulas to html. | ||
3. Drop these files into your project. | ||
|
||
Check out the examples below or if you'd like to use the beautifier online click here http://excelformulabeautifier.com/ | ||
|
||
##Basic usage | ||
|
||
This will return a formated formula in plain text. | ||
|
||
excelFormulaUtilities.formatFormula('IF(1+1=2,"true","false")'); //Returns a string containing the formatted formula. | ||
|
||
##Example | ||
|
||
To see this example check out ./examples/basic_example1/index.html | ||
|
||
###The JavaScript | ||
window.onload = function(){ | ||
//Beautify an Excel formula output to text | ||
var formula_1 = 'SUM((A1:A10>=5)*(A1:A10<=10)*A1:A10)'; | ||
document.getElementById('fomatFormula_1').innerHTML = formula_1; | ||
document.getElementById('fomatFormula_1_out').innerHTML = excelFormulaUtilities.formatFormula(formula_1); | ||
|
||
//Beautify an Excel formula output to html. | ||
var formula_2 = '=RIGHT(A2,LEN(A2)-FIND("*",SUBSTITUTE(A2," ","*",LEN(A2)-LEN(SUBSTITUTE(A2," ","")))))'; | ||
document.getElementById('fomatFormula_2').innerHTML = formula_2; | ||
document.getElementById('fomatFormula_2_out').innerHTML = excelFormulaUtilities.formatFormulaHTML(formula_2); | ||
|
||
//Convert an Excel formula to C# | ||
var formula_3 = '=IF(A2:A3="YES","A2 equals yes", "A2 does not equal yes")'; | ||
document.getElementById('fomatFormula_3').innerHTML = formula_3; | ||
document.getElementById('fomatFormula_3_out').innerHTML = excelFormulaUtilities.formula2CSharp(formula_3); | ||
|
||
//Convert an Excel formula to JavaScript | ||
var formula_4 = 'ADDRESS(ROW(DataRange2),COLUMN(DataRange2),4)&":"&ADDRESS(MAX((DataRange2<>"")*ROW(DataRange2)),COLUMN(DataRange2)+COLUMNS(DataRange2)-1,4)'; | ||
document.getElementById('fomatFormula_4').innerHTML = formula_4; | ||
document.getElementById('fomatFormula_4_out').innerHTML = excelFormulaUtilities.formula2JavaScript(formula_4); | ||
} | ||
|
||
###The HTML | ||
<div class="formula"> | ||
<h2>excelFormulaUtilities.formatFormula( "<span id="fomatFormula_1"></span>" );</h2> | ||
<pre id="fomatFormula_1_out"></pre> | ||
</div> | ||
|
||
<div class="formula"> | ||
<h2>excelFormulaUtilities.formatFormulaHTML( "<span id="fomatFormula_2"></span>" );</h2> | ||
<pre id="fomatFormula_2_out"></pre> | ||
</div> | ||
|
||
<div class="formula"> | ||
<h2>excelFormulaUtilities.formula2CSharp( "<span id="fomatFormula_3"></span>" );</h2> | ||
<div id="fomatFormula_3_out"></div> | ||
</div> | ||
|
||
<div class="formula"> | ||
<h2>excelFormulaUtilities.formula2Javascript( "<span id="fomatFormula_4"></span>" );</h2> | ||
<pre id="fomatFormula_4_out"></pre> | ||
</div> |
Oops, something went wrong.