2016-01-27 10:29:26 +00:00
|
|
|
(function() {
|
2018-02-12 05:05:29 +00:00
|
|
|
/**
|
|
|
|
Definition of the JsonYamlGenerator class.
|
|
|
|
@module generators/json-yaml-generator
|
|
|
|
@license MIT. See LICENSE.md for details.
|
|
|
|
*/
|
|
|
|
var BaseGenerator, FS, JsonYamlGenerator, YAML;
|
2016-01-27 10:29:26 +00:00
|
|
|
|
|
|
|
BaseGenerator = require('./base-generator');
|
|
|
|
|
|
|
|
FS = require('fs');
|
|
|
|
|
|
|
|
YAML = require('yamljs');
|
|
|
|
|
|
|
|
/**
|
|
|
|
JsonYamlGenerator takes a JSON resume object and translates it directly to
|
|
|
|
JSON without a template, producing an equivalent YAML-formatted resume. See
|
|
|
|
also YamlGenerator (yaml-generator.js).
|
2018-02-12 05:05:29 +00:00
|
|
|
*/
|
|
|
|
module.exports = JsonYamlGenerator = class JsonYamlGenerator extends BaseGenerator {
|
|
|
|
constructor() {
|
|
|
|
super('yml');
|
2016-02-02 18:38:12 +00:00
|
|
|
}
|
|
|
|
|
2018-02-12 05:05:29 +00:00
|
|
|
invoke(rez, themeMarkup, cssInfo, opts) {
|
|
|
|
return YAML.stringify(JSON.parse(rez.stringify()), 2e308, 2);
|
|
|
|
}
|
2016-02-02 18:38:12 +00:00
|
|
|
|
2018-02-12 05:05:29 +00:00
|
|
|
generate(rez, f, opts) {
|
2016-01-27 10:29:26 +00:00
|
|
|
var data;
|
2018-02-12 05:05:29 +00:00
|
|
|
data = YAML.stringify(JSON.parse(rez.stringify()), 2e308, 2);
|
2016-02-02 02:14:36 +00:00
|
|
|
FS.writeFileSync(f, data, 'utf8');
|
|
|
|
return data;
|
2018-02-12 05:05:29 +00:00
|
|
|
}
|
2016-02-02 18:38:12 +00:00
|
|
|
|
2018-02-12 05:05:29 +00:00
|
|
|
};
|
2016-01-27 10:29:26 +00:00
|
|
|
|
|
|
|
}).call(this);
|
2016-02-02 02:14:36 +00:00
|
|
|
|
|
|
|
//# sourceMappingURL=json-yaml-generator.js.map
|