forked from caenrigen/LatexKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSettingsHardcode.js
More file actions
150 lines (142 loc) · 8.17 KB
/
Copy pathSettingsHardcode.js
File metadata and controls
150 lines (142 loc) · 8.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
var getDevSettings = function(){
return {
getAppName: function(){return 'LatexKit'},
getAppVersion: function(){return 'v1.1.4'},
getSettingsSheetName: function(){return 'LatexKitSettings'},
getErrorColumnTag: function(){return 'err'},
getDataColSeparators: function(){return {space:' ',tab:'\t',enter:'\r\n',LF:'\n',CR:'\r'}},
getFeedbackFormLink: function(){return 'https://goo.gl/forms/WbqcEpMbYx3VGA2b2'},
getFacebookLink: function(){return 'https://www.facebook.com/latexkit/'},
getGitHubLink: function(){return 'https://github.com/caenrigen/LatexKit'},
getMailLink: function(){return 'mailto:latexkit.dev@gmail.com'},
getHomepageLink: function(){return 'http://caenrigen.tech/LatexKit/'},
getMenuLabels: function(){return {'singleTabular': 'Make Tabular',
'allTabular': 'Export All Tabulars',
'showSettings': 'Show Settings',
'updateSettings':'Update Settings',
'singleData': 'Export Data',
'allData': 'Export All Data',
'feedbackForm': 'Send Feedback, pleeeese!',
'donateFunny': 'Keep Us Awake',
'donate': 'Donate'}}
};
};
var getDefaultSettings = function(){
return {
getGeneralDefaults : function(){return [
['LatexKit',getDevSettings().getAppVersion(),'Created By: Victor Negîrneac & Daniel Hachmeister'],
['Tabular Named Ranges Identifier:','.tab','For latest updates, feature requests and feedback please visit:'],
['Data Named Ranges Identifier:','.dat','facebook.com/latexkit/'],
['Use Settings Sheet for Single Export:',true, 'http://caenrigen.tech/LatexKit/']
];},
getTabsHeader : function(){return [
['TABS'],
['Range Name:','Folder:','Extension:','Template:','Option:','Bigstrut:','Escape characters:']
];},
// Note that this default is not an array of arrays
// This makes it more convenient for most calls
getTabDefault : function(){return ['default','./tabs','.tex',false,false,false,''];},
getDataHeader : function(){return[
['DATA'],
['Range Name:','Folder:','Extension:','Full Precision:','Separator:','Column Swap:']
];},
// Note that this default is not an array of arrays
// This makes it more convenient for most calls
getDatumDefault : function(){return ['default','./data','.txt',true,'tab',false];}
};
};
// Constructors for getting settings from an array
// Every constructor returns an object containing the functions that return a specific element from the array
var getGeneralSettingsFromArray = function (genSettings){
return {
getVersion: function(){return genSettings[0][1];},
getTabsIdentifier: function(){return genSettings[1][1];},
getDataIdentifier: function(){return genSettings[2][1];},
getUseSettingForSingleExport: function(){return genSettings[3][1];}
}
};
var getTabSettingsFromArray = function (tabSettings){
return {
getRangeName: function(){return array[0];},
getTemplate: function(){return tabSettings[3];},
getOptions: function(){return tabSettings[4];},
getBigstrut: function(){return tabSettings[5];},
getEscapeChars: function(){return tabSettings[6];}
};
};
var getDatumSettingsFromArray = function (datumSettings){
return {
getRangeName: function(){return array[0];},
getFullPrecision: function(){return datumSettings[3];},
getSep: function(){return datumSettings[4];},
getColumnSwap: function(){return datumSettings[5];}
};
};
var getSettingsFromArray = function (array){
// Settings that are common for the tables and data
// It is really needed, it is not only a "shortcut"
return {
getRangeName: function(){return array[0];},
getFolderPath: function(){return array[1];},
getExtention: function(){return array[2];}
};
};
var getNotes = function(){
return {
getGeneralDefaultsNotes : function(){return [
['General Settings below', 'Version\nUsed to detect settings sheet generated by an older version of the Add-on that can be incompatible.'],
['Named Ranges that identify ranges to be exported as Latex tabular should end like this.\n\nPossible values:\n.<Any string>\n\nNote: The dot, ".", is imperative!'],
['Named Ranges that identify ranges to be exported as Data text files should end like this.\n\nPossible values:\n.<Any string>\n\nNote: The dot, ".", is imperative!'],
['When exporting a single tabular or data use the user settings if the selected range matches any of the Named Ranges in the Settings Sheet.\nThis may slow down the export so you can disable it here.\n\nPossible values:\nTRUE - Use user settings when available.\nFALSE - Just export using default settings and prompt for output file path.']
];},
getTabsHeaderNotes : function(){return [
['Settings for each range to be exported as Latex tabular.'],
[null,
'UNIX like folder path in your Drive.\n\nValid paths:\n\
\"/\" - Drive root\n\
\"./\" - This spreadsheet folder\n\.\
\"../\" - Parent folder of this spreadsheet folder\n\n\
Note: new folders are created if do not exist.',
'Output text file extension.\n\n\
Hint: using \".txt\" makes it possible to open the file directly in the Drive.',
'Produce different styles of table, existing templates are:\n\n\
Horizon\n\
_____\n\
\n\
_____\n\n\
Barcode\n\
| | |\n\
| | |\n\
| | |\n\n\
Grid\n\
______\n\
|_|_|_|_|\n\
|_|_|_|_|\n\
|_|_|_|_|\n\n\
Manual\n\n[THE NAMED RANGE MUST NOT INCLUDE ANY CELLS ON LINE 1 OF THE SHEET!]\n\nManually control your table by adding a column to the right of a Named Range with the explicit commands to use (e.g. \\hline). Note: If you want the command to appear before the first line, you have to insert it on the row above your range.',
'Aditional option for each template choosen. Change this value to some integer X to customize the template:\n\n\
Horizon & Barcode: Add an additional horizontal line below row X\n\n\
Grid: Set X to 0 to remove the outer border',
'Setting this field to TRUE includes a small space below and above each horizontal line, useful when you have exponents or indices in your table, as this tend to overlap with the lines.',
'Special latex characters that you want to get printed,\n\
e.g. to escape all special latex characters "&%$#_{}~^\\".'
]
];},
getTabDefaultNotes : function(){return [
['This is the default settings for a tabular.\n\nThey are used when you click \"'+getDevSettings().getMenuLabels()['singleTabular']+'\" AND are also copied below for each new Named Range that is added for tabular export.']
];},
getDataHeaderNotes : function(){return[
['Settings for each range to be exported as Data text file.'],
[null,
'UNIX like folder path in your Drive.\n\nValid paths (comarination may be used):\n/ - Drive root\n./ - This spreadsheet folder\n\../ - Parent folder of this spreadsheet folder\n\nNote: new folders are created if do not exist.',
'Output text file extension.\n\nHint: using \".txt\" makes it possible to open the file directly in the Drive.',
'Choose to export with full numbers precision or just the displayed values.\n\nPossible values:\nTRUE\nFALSE.',
'The character(s) used as data columns separator.\n\nPossible values:\nspace\ntab - a.k.a. \"\\t\"\nenter - a.k.a. "\\r\\n\"\nLF - a.k.a. \"\\n\"\nCR - a.k.a. \"\\r\"\n<Any string>',
'Optionally swamp or omit columns in the corresponding range.\n\nPossible values:\nFALSE - do nothing\ncX[cY...] - e.g. \"c1c3c1c4\" will only output columns 1,3,1 and 4 in this order. Column counting in the Named Range starts with \'1\'.'
]
];},
getDatumDefaultNotes : function(){return [
['This is the default settings for a Data.\n\nThey are used when you click \"'+getDevSettings().getMenuLabels()['singleData']+'\" AND are also copied below for each new Named Range that is added for data export.']
];}
};
};