From d01d0c3cb6054c3190e03c3cceafcdcabaaed0f5 Mon Sep 17 00:00:00 2001 From: Eric Wood Date: Wed, 4 Jan 2017 18:24:24 -0500 Subject: [PATCH] Make input escaping optional. Fixes #11 --- converter.js | 10 ++++++---- index.html | 6 ++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/converter.js b/converter.js index 7a05a17..f97aced 100644 --- a/converter.js +++ b/converter.js @@ -12,6 +12,8 @@ latexEnvironment: 'array', latexEscape: function(text) { + if(!$('#escape').is(':checked')) return text; + var escapeRegExpr = function(str) { return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); }; @@ -63,7 +65,7 @@ } latex += "\\end{" + excelParser.latexEnvironment + "}\n"; - + return latex; }, @@ -110,7 +112,7 @@ // read the workbook meta data to get the names and crap workbookMeta.getData(new zip.TextWriter(), function(text) { var doc = $(text); - + // extract the names of the workbooks and their IDs for use later on... $.each(doc.find('sheets sheet'), function(i, tag) { tag = $(tag); @@ -125,12 +127,12 @@ $.each(sheets, function(_, sheet) { // the ID of the spreadsheet can only be found in the filename apparently :P var id = sheet.filename.match(/(\d)\.xml/)[1]; - + sheet.getData(new zip.TextWriter(), function(text) { var table = excelParser.processSheet(text, stringTable); var latex = excelParser.toLatex(table); latexOutput[id] = latex; - + // I apologize for the hack :( if(id === '1') { excelParser.showOutput(1); diff --git a/index.html b/index.html index 69ce3ac..53d8738 100644 --- a/index.html +++ b/index.html @@ -29,6 +29,12 @@ + +
+ + +
+

Mostly untested, so if you find a bug or have a feature request, let me know!

Note: this only works with .xlsx files. That means .xls files will not work.

Formatting from the Excel document won't be preserved, only the text will be extracted.