| 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 |
1
1
1
1
1
57
56
56
56
56
12
12
12
13
13
56
56
56
56
56
1
| 'use strict';
var fs, path, optionsMap, fixtures;
fs = require('fs');
path = require('path');
optionsMap = {
'gfm' : ['gfm', true],
'nogfm' : ['gfm', false],
'tables' : ['tables', true],
'notables' : ['tables', false],
'footnotes' : ['footnotes', true],
'nofootnotes' : ['footnotes', false],
'breaks' : ['breaks', true],
'nobreaks' : ['breaks', false],
'pedantic' : ['pedantic', true],
'nopedantic' : ['pedantic', false]
};
fixtures = fs.readdirSync(path.join(__dirname, 'input'))
.filter(function (filepath) {
return filepath.indexOf('.') !== 0;
}).map(function (filepath) {
var options, filename, input, output, flag, index, size;
filename = filepath.split('.');
filename.pop();
if (filename.length > 1) {
index = 0;
options = {};
while (filename[++index]) {
flag = optionsMap[filename[index]];
options[flag[0]] = flag[1];
}
}
filename = filename.join('.');
input = fs.readFileSync(
path.join(__dirname, 'input', filepath), 'utf-8'
);
output = fs.readFileSync(
path.join(__dirname, 'output', filename + '.json'), 'utf-8'
);
size = fs.statSync(path.join(__dirname, 'input', filepath)).size;
return {
'input' : input,
'output' : output,
'options' : options,
'size' : size,
'name' : filename
};
}
);
module.exports = fixtures;
|