-
Notifications
You must be signed in to change notification settings - Fork 6
/
range to string.js
68 lines (58 loc) · 2.18 KB
/
range to string.js
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
function range_to_string(spec){
var range = spec.range;
// Create array of colFeat obj.
// and configure column features:
// is_pmError
var tabFeats = create_tableFeats(spec);
var colFeats = tabFeats.colFeats;
var rowFeats = tabFeats.rowFeats;
var tableType = tabFeats.tableType;
var tableCaption = tabFeats.tableCaption;
var tableLabel = tabFeats.tableLabel;
var tablePlacementSpecifier = tabFeats.tablePlacementSpecifier;
// Create a 2D array of Cell obj.
// each Cell obj. contains properties:
// string dvalue: displayed value on the sheet
// number value: value stored in obj.
// number rowSpan: num. of rows spanned
// number colSpan: num. of columns spanned
var matrix=create_matrix(spec);
// adds a property to the Cell objs. (string errValue)
// errValue holds the uncertainty of a given value as displayed in the sheet
// deletes the uncertainty columns and the column features obj. associated
err_handler({matrix: matrix, colFeats: colFeats});
// adds a property to the Cell objs. (string pvalue)
// pvalue is the string to be printed on the LateX table
// e.g. \multirow{2}{*}{7.5 $\pm$ 0.4}
// using default error notation given by function def_err_printer
set_forPrint({matrix: matrix, colFeats: colFeats},def_err_printer);
// adds & to the end of pvalue
// adds white spaces to pvalue
// to match the sizes of pvalue's on the same columns
add_columnSeparator({matrix: matrix, colFeats: colFeats});
if(tabFeats.manual === true){
var manualColSpec = tabFeats.manualColSpec;
return create_manual_string({
range: range,
matrix: matrix,
colFeats: colFeats,
tableType: tableType,
tableCaption: tableCaption,
tableLabel: tableLabel,
tablePlacementSpecifier: tablePlacementSpecifier,
manualColSpec: manualColSpec,
});
}
// create the printable string
// according to column features and row features of the table
return create_string({
range: range,
matrix: matrix,
colFeats: colFeats,
tableType: tableType,
tableCaption: tableCaption,
tableLabel: tableLabel,
tablePlacementSpecifier: tablePlacementSpecifier,
rowFeats: rowFeats,
});
}