1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2024-12-22 21:37:21 +00:00

Refactor generators to CoffeeScript classes.

This commit is contained in:
hacksalot 2016-02-02 13:38:12 -05:00
parent 63a0c78fc5
commit f72b02a0f4
26 changed files with 276 additions and 183 deletions

View File

@ -1,34 +1,39 @@
/**
Definition of the BaseGenerator class.
@module base-generator.js
@module generators/base-generator
@license MIT. See LICENSE.md for details.
*/
/**
The BaseGenerator class is the root of the generator hierarchy. Functionality
common to ALL generators lives here.
*/
(function() {
var BaseGenerator, Class;
var BaseGenerator;
Class = require('../utils/class');
/**
The BaseGenerator class is the root of the generator hierarchy. Functionality
common to ALL generators lives here.
*/
BaseGenerator = module.exports = Class.extend({
module.exports = BaseGenerator = (function() {
/** Base-class initialize. */
init: function(outputFormat) {
return this.format = outputFormat;
},
function BaseGenerator(format) {
this.format = format;
}
/** Status codes. */
codes: require('../core/status-codes'),
BaseGenerator.prototype.codes = require('../core/status-codes');
/** Generator options. */
opts: {}
});
BaseGenerator.prototype.opts = {};
return BaseGenerator;
})();
}).call(this);

View File

@ -1,12 +1,14 @@
/**
Definition of the HTMLGenerator class.
@module generators/html-generator
@license MIT. See LICENSE.md for details.
@module html-generator.js
*/
(function() {
var FS, HTML, HtmlGenerator, PATH, TemplateGenerator;
var FS, HTML, HtmlGenerator, PATH, TemplateGenerator,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
TemplateGenerator = require('./template-generator');
@ -18,16 +20,20 @@ Definition of the HTMLGenerator class.
require('string.prototype.endswith');
HtmlGenerator = module.exports = TemplateGenerator.extend({
init: function() {
return this._super('html');
},
module.exports = HtmlGenerator = (function(superClass) {
extend(HtmlGenerator, superClass);
function HtmlGenerator() {
HtmlGenerator.__super__.constructor.call(this, 'html');
}
/**
Copy satellite CSS files to the destination and optionally pretty-print
the HTML resume prior to saving.
*/
onBeforeSave: function(info) {
HtmlGenerator.prototype.onBeforeSave = function(info) {
if (info.outputFile.endsWith('.css')) {
return info.mk;
}
@ -36,8 +42,11 @@ Definition of the HTMLGenerator class.
} else {
return info.mk;
}
}
});
};
return HtmlGenerator;
})(TemplateGenerator);
}).call(this);

View File

@ -1,12 +1,14 @@
/**
Definition of the HtmlPdfCLIGenerator class.
@module html-pdf-generator.js
@module generators/html-pdf-generator.js
@license MIT. See LICENSE.md for details.
*/
(function() {
var FS, HMSTATUS, HtmlPdfCLIGenerator, PATH, SLASH, TemplateGenerator, _, engines;
var FS, HMSTATUS, HtmlPdfCLIGenerator, PATH, SLASH, TemplateGenerator, _, engines,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
TemplateGenerator = require('./template-generator');
@ -27,13 +29,17 @@ Definition of the HtmlPdfCLIGenerator class.
If an engine isn't installed for a particular platform, error out gracefully.
*/
HtmlPdfCLIGenerator = module.exports = TemplateGenerator.extend({
init: function() {
return this._super('pdf', 'html');
},
module.exports = HtmlPdfCLIGenerator = (function(superClass) {
extend(HtmlPdfCLIGenerator, superClass);
function HtmlPdfCLIGenerator() {
HtmlPdfCLIGenerator.__super__.constructor.call(this, 'pdf', 'html');
}
/** Generate the binary PDF. */
onBeforeSave: function(info) {
HtmlPdfCLIGenerator.prototype.onBeforeSave = function(info) {
var safe_eng;
safe_eng = info.opts.pdf || 'wkhtmltopdf';
if (safe_eng === 'phantom') {
@ -45,22 +51,27 @@ Definition of the HtmlPdfCLIGenerator class.
engines[safe_eng].call(this, info.mk, info.outputFile, this.onError);
return null;
}
},
};
/* Low-level error callback for spawn(). May be called after HMR process
termination, so object references may not be valid here. That's okay; if
the references are invalid, the error was already logged. We could use
spawn-watch here but that causes issues on legacy Node.js.
*/
onError: function(ex, param) {
HtmlPdfCLIGenerator.prototype.onError = function(ex, param) {
var ref;
if ((ref = param.errHandler) != null) {
if (typeof ref.err === "function") {
ref.err(HMSTATUS.pdfGeneration, ex);
}
}
}
});
};
return HtmlPdfCLIGenerator;
})(TemplateGenerator);
engines = {

View File

@ -1,12 +1,14 @@
/**
Definition of the HtmlPngGenerator class.
@module generators/html-png-generator
@license MIT. See LICENSE.MD for details.
@module html-png-generator.js
*/
(function() {
var FS, HTML, HtmlPngGenerator, PATH, SLASH, SPAWN, TemplateGenerator, phantom;
var FS, HTML, HtmlPngGenerator, PATH, SLASH, SPAWN, TemplateGenerator, phantom,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
TemplateGenerator = require('./template-generator');
@ -25,12 +27,16 @@ Definition of the HtmlPngGenerator class.
An HTML-based PNG resume generator for HackMyResume.
*/
HtmlPngGenerator = module.exports = TemplateGenerator.extend({
init: function() {
return this._super('png', 'html');
},
invoke: function(rez, themeMarkup, cssInfo, opts) {},
generate: function(rez, f, opts) {
module.exports = HtmlPngGenerator = (function(superClass) {
extend(HtmlPngGenerator, superClass);
function HtmlPngGenerator() {
HtmlPngGenerator.__super__.constructor.call(this, 'png', 'html');
}
HtmlPngGenerator.prototype.invoke = function(rez, themeMarkup, cssInfo, opts) {};
HtmlPngGenerator.prototype.generate = function(rez, f, opts) {
var htmlFile, htmlResults;
htmlResults = opts.targets.filter(function(t) {
return t.fmt.outFormat === 'html';
@ -39,8 +45,11 @@ Definition of the HtmlPngGenerator class.
return fl.info.ext === 'html';
});
phantom(htmlFile[0].data, f);
}
});
};
return HtmlPngGenerator;
})(TemplateGenerator);
/**

View File

@ -1,12 +1,14 @@
/**
Definition of the JsonGenerator class.
@license MIT. See LICENSE.md for details.
@module generators/json-generator
@license MIT. See LICENSE.md for details.
*/
(function() {
var BaseGenerator, FS, JsonGenerator, _;
var BaseGenerator, FS, JsonGenerator, _,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
BaseGenerator = require('./base-generator');
@ -15,16 +17,18 @@ Definition of the JsonGenerator class.
_ = require('underscore');
/**
The JsonGenerator generates a JSON resume directly.
*/
/** The JsonGenerator generates a JSON resume directly. */
JsonGenerator = module.exports = BaseGenerator.extend({
init: function() {
return this._super('json');
},
keys: ['imp', 'warnings', 'computed', 'filt', 'ctrl', 'index', 'safeStartDate', 'safeEndDate', 'safeDate', 'safeReleaseDate', 'result', 'isModified', 'htmlPreview', 'safe'],
invoke: function(rez) {
module.exports = JsonGenerator = (function(superClass) {
extend(JsonGenerator, superClass);
function JsonGenerator() {
JsonGenerator.__super__.constructor.call(this, 'json');
}
JsonGenerator.prototype.keys = ['imp', 'warnings', 'computed', 'filt', 'ctrl', 'index', 'safeStartDate', 'safeEndDate', 'safeDate', 'safeReleaseDate', 'result', 'isModified', 'htmlPreview', 'safe'];
JsonGenerator.prototype.invoke = function(rez) {
var replacer;
replacer = function(key, value) {
if (_.some(this.keys, function(val) {
@ -36,11 +40,15 @@ Definition of the JsonGenerator class.
}
};
return JSON.stringify(rez, replacer, 2);
},
generate: function(rez, f) {
};
JsonGenerator.prototype.generate = function(rez, f) {
FS.writeFileSync(f, this.invoke(rez), 'utf8');
}
});
};
return JsonGenerator;
})(BaseGenerator);
}).call(this);

View File

@ -1,12 +1,14 @@
/**
Definition of the JsonYamlGenerator class.
@module json-yaml-generator.js
@module generators/json-yaml-generator
@license MIT. See LICENSE.md for details.
*/
(function() {
var BaseGenerator, FS, JsonYamlGenerator, YAML;
var BaseGenerator, FS, JsonYamlGenerator, YAML,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
BaseGenerator = require('./base-generator');
@ -21,20 +23,27 @@ Definition of the JsonYamlGenerator class.
also YamlGenerator (yaml-generator.js).
*/
JsonYamlGenerator = module.exports = BaseGenerator.extend({
init: function() {
return this._super('yml');
},
invoke: function(rez, themeMarkup, cssInfo, opts) {
module.exports = JsonYamlGenerator = (function(superClass) {
extend(JsonYamlGenerator, superClass);
function JsonYamlGenerator() {
JsonYamlGenerator.__super__.constructor.call(this, 'yml');
}
JsonYamlGenerator.prototype.invoke = function(rez, themeMarkup, cssInfo, opts) {
return YAML.stringify(JSON.parse(rez.stringify()), Infinity, 2);
},
generate: function(rez, f, opts) {
};
JsonYamlGenerator.prototype.generate = function(rez, f, opts) {
var data;
data = YAML.stringify(JSON.parse(rez.stringify()), Infinity, 2);
FS.writeFileSync(f, data, 'utf8');
return data;
}
});
};
return JsonYamlGenerator;
})(BaseGenerator);
}).call(this);

View File

@ -1,12 +1,14 @@
/**
Definition of the LaTeXGenerator class.
@license MIT. See LICENSE.md for details.
@module generators/latex-generator
@license MIT. See LICENSE.md for details.
*/
(function() {
var LaTeXGenerator, TemplateGenerator;
var LaTeXGenerator, TemplateGenerator,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
TemplateGenerator = require('./template-generator');
@ -15,11 +17,16 @@ Definition of the LaTeXGenerator class.
LaTeXGenerator generates a LaTeX resume via TemplateGenerator.
*/
LaTeXGenerator = module.exports = TemplateGenerator.extend({
init: function() {
return this._super('latex', 'tex');
module.exports = LaTeXGenerator = (function(superClass) {
extend(LaTeXGenerator, superClass);
function LaTeXGenerator() {
LaTeXGenerator.__super__.constructor.call(this, 'latex', 'tex');
}
});
return LaTeXGenerator;
})(TemplateGenerator);
}).call(this);

View File

@ -1,12 +1,14 @@
/**
Definition of the MarkdownGenerator class.
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module markdown-generator.js
@module generators/markdown-generator
@license MIT. See LICENSE.md for details.
*/
(function() {
var MarkdownGenerator, TemplateGenerator;
var MarkdownGenerator, TemplateGenerator,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
TemplateGenerator = require('./template-generator');
@ -15,11 +17,16 @@ Definition of the MarkdownGenerator class.
MarkdownGenerator generates a Markdown-formatted resume via TemplateGenerator.
*/
MarkdownGenerator = module.exports = TemplateGenerator.extend({
init: function() {
return this._super('md', 'txt');
module.exports = MarkdownGenerator = (function(superClass) {
extend(MarkdownGenerator, superClass);
function MarkdownGenerator() {
MarkdownGenerator.__super__.constructor.call(this, 'md', 'txt');
}
});
return MarkdownGenerator;
})(TemplateGenerator);
}).call(this);

View File

@ -1,12 +1,14 @@
/**
Definition of the TemplateGenerator class. TODO: Refactor
@module generators/template-generator
@license MIT. See LICENSE.md for details.
@module template-generator.js
*/
(function() {
var BaseGenerator, EXTEND, FRESHTheme, FS, JRSTheme, MD, MKDIRP, PATH, TemplateGenerator, XML, _, _defaultOpts, _reg, freeze, parsePath, unfreeze;
var BaseGenerator, EXTEND, FRESHTheme, FS, JRSTheme, MD, MKDIRP, PATH, TemplateGenerator, XML, _, _defaultOpts, _reg, freeze, parsePath, unfreeze,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
FS = require('fs-extra');
@ -38,16 +40,21 @@ Definition of the TemplateGenerator class. TODO: Refactor
@class TemplateGenerator
*/
TemplateGenerator = module.exports = BaseGenerator.extend({
module.exports = TemplateGenerator = (function(superClass) {
extend(TemplateGenerator, superClass);
/** Constructor. Set the output format and template format for this
generator. Will usually be called by a derived generator such as
HTMLGenerator or MarkdownGenerator.
*/
init: function(outputFormat, templateFormat, cssFile) {
this._super(outputFormat);
function TemplateGenerator(outputFormat, templateFormat, cssFile) {
TemplateGenerator.__super__.constructor.call(this, outputFormat);
this.tplFormat = templateFormat || outputFormat;
},
return;
}
/** Generate a resume using string-based inputs and outputs without touching
the filesystem.
@ -57,7 +64,8 @@ Definition of the TemplateGenerator class. TODO: Refactor
@returns {Array} An array of objects representing the generated output
files.
*/
invoke: function(rez, opts) {
TemplateGenerator.prototype.invoke = function(rez, opts) {
var curFmt, results;
opts = opts ? (this.opts = EXTEND(true, {}, _defaultOpts, opts)) : this.opts;
curFmt = opts.themeObj.getFormat(this.format);
@ -80,7 +88,8 @@ Definition of the TemplateGenerator class. TODO: Refactor
return {
files: results
};
},
};
/** Generate a resume using file-based inputs and outputs. Requires access
to the local filesystem.
@ -89,7 +98,8 @@ Definition of the TemplateGenerator class. TODO: Refactor
@param f Full path to the output resume file to generate.
@param opts Generator options.
*/
generate: function(rez, f, opts) {
TemplateGenerator.prototype.generate = function(rez, f, opts) {
var curFmt, genInfo, outFolder;
this.opts = EXTEND(true, {}, _defaultOpts, opts);
genInfo = this.invoke(rez, null);
@ -136,7 +146,8 @@ Definition of the TemplateGenerator class. TODO: Refactor
});
}
return genInfo;
},
};
/** Perform a single resume resume transformation using string-based inputs
and outputs without touching the local file system.
@ -146,7 +157,8 @@ Definition of the TemplateGenerator class. TODO: Refactor
@param cssInfo Needs to be refactored.
@param opts Options and passthrough data.
*/
single: function(json, jst, format, opts, theme, curFmt) {
TemplateGenerator.prototype.single = function(json, jst, format, opts, theme, curFmt) {
var eng, result;
if (this.opts.freezeBreaks) {
jst = freeze(jst);
@ -157,13 +169,11 @@ Definition of the TemplateGenerator class. TODO: Refactor
result = unfreeze(result);
}
return result;
}
});
};
return TemplateGenerator;
/** Export the TemplateGenerator function/ctor. */
module.exports = TemplateGenerator;
})(BaseGenerator);
/** Freeze newlines for protection against errant JST parsers. */

View File

@ -1,12 +1,14 @@
/**
Definition of the TextGenerator class.
@module generators/text-generator
@license MIT. See LICENSE.md for details.
@module text-generator.js
*/
(function() {
var TemplateGenerator, TextGenerator;
var TemplateGenerator, TextGenerator,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
TemplateGenerator = require('./template-generator');
@ -15,11 +17,16 @@ Definition of the TextGenerator class.
The TextGenerator generates a plain-text resume via the TemplateGenerator.
*/
TextGenerator = module.exports = TemplateGenerator.extend({
init: function() {
return this._super('txt');
module.exports = TextGenerator = (function(superClass) {
extend(TextGenerator, superClass);
function TextGenerator() {
TextGenerator.__super__.constructor.call(this, 'txt');
}
});
return TextGenerator;
})(TemplateGenerator);
}).call(this);

View File

@ -1,20 +1,31 @@
/*
Definition of the WordGenerator class.
@license MIT. See LICENSE.md for details.
@module generators/word-generator
@license MIT. See LICENSE.md for details.
*/
(function() {
var TemplateGenerator, WordGenerator;
var TemplateGenerator, WordGenerator,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
TemplateGenerator = require('./template-generator');
WordGenerator = module.exports = TemplateGenerator.extend({
init: function() {
return this._super('doc', 'xml');
module.exports = WordGenerator = (function(superClass) {
extend(WordGenerator, superClass);
function WordGenerator() {
return WordGenerator.__super__.constructor.apply(this, arguments);
}
});
WordGenerator.prototype.init = function() {
return WordGenerator.__super__.init.call(this, 'doc', 'xml');
};
return WordGenerator;
})(TemplateGenerator);
}).call(this);

View File

@ -6,20 +6,25 @@ Definition of the XMLGenerator class.
*/
(function() {
var BaseGenerator, XMLGenerator;
var BaseGenerator, XMLGenerator,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
BaseGenerator = require('./base-generator');
/**
The XmlGenerator generates an XML resume via the TemplateGenerator.
*/
/** The XmlGenerator generates an XML resume via the TemplateGenerator. */
XMLGenerator = module.exports = BaseGenerator.extend({
init: function() {
return this._super('xml');
module.exports = XMLGenerator = (function(superClass) {
extend(XMLGenerator, superClass);
function XMLGenerator() {
XMLGenerator.__super__.constructor.call(this, 'xml');
}
});
return XMLGenerator;
})(BaseGenerator);
}).call(this);

View File

@ -6,7 +6,9 @@ Definition of the YAMLGenerator class.
*/
(function() {
var TemplateGenerator, YAMLGenerator;
var TemplateGenerator, YAMLGenerator,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
TemplateGenerator = require('./template-generator');
@ -15,11 +17,16 @@ Definition of the YAMLGenerator class.
YamlGenerator generates a YAML-formatted resume via TemplateGenerator.
*/
YAMLGenerator = module.exports = TemplateGenerator.extend({
init: function() {
return this._super('yml', 'yml');
module.exports = YAMLGenerator = (function(superClass) {
extend(YAMLGenerator, superClass);
function YAMLGenerator() {
YAMLGenerator.__super__.constructor.call(this, 'yml', 'yml');
}
});
return YAMLGenerator;
})(TemplateGenerator);
}).call(this);

View File

@ -1,25 +1,19 @@
###*
Definition of the BaseGenerator class.
@module base-generator.js
@module generators/base-generator
@license MIT. See LICENSE.md for details.
###
# Use J. Resig's nifty class implementation
Class = require '../utils/class'
###*
The BaseGenerator class is the root of the generator hierarchy. Functionality
common to ALL generators lives here.
###
BaseGenerator = module.exports = Class.extend
module.exports = class BaseGenerator
###* Base-class initialize. ###
init: ( outputFormat ) -> @format = outputFormat
constructor: ( @format ) ->
###* Status codes. ###
codes: require '../core/status-codes'

View File

@ -1,7 +1,7 @@
###*
Definition of the HTMLGenerator class.
@module generators/html-generator
@license MIT. See LICENSE.md for details.
@module html-generator.js
###
@ -14,9 +14,9 @@ require 'string.prototype.endswith'
HtmlGenerator = module.exports = TemplateGenerator.extend
module.exports = class HtmlGenerator extends TemplateGenerator
init: -> @_super 'html'
constructor: -> super 'html'
###*
Copy satellite CSS files to the destination and optionally pretty-print

View File

@ -1,6 +1,6 @@
###*
Definition of the HtmlPdfCLIGenerator class.
@module html-pdf-generator.js
@module generators/html-pdf-generator.js
@license MIT. See LICENSE.md for details.
###
@ -21,11 +21,11 @@ wkhtmltopdf, and other PDF engines over a CLI (command-line interface).
If an engine isn't installed for a particular platform, error out gracefully.
###
HtmlPdfCLIGenerator = module.exports = TemplateGenerator.extend
module.exports = class HtmlPdfCLIGenerator extends TemplateGenerator
init: () -> @_super 'pdf', 'html'
constructor: () -> super 'pdf', 'html'

View File

@ -1,7 +1,7 @@
###*
Definition of the HtmlPngGenerator class.
@module generators/html-png-generator
@license MIT. See LICENSE.MD for details.
@module html-png-generator.js
###
@ -17,9 +17,9 @@ PATH = require 'path'
###*
An HTML-based PNG resume generator for HackMyResume.
###
HtmlPngGenerator = module.exports = TemplateGenerator.extend
module.exports = class HtmlPngGenerator extends TemplateGenerator
init: -> @_super 'png', 'html'
constructor: -> super 'png', 'html'
invoke: ( rez, themeMarkup, cssInfo, opts ) ->
# TODO: Not currently called or callable.

View File

@ -1,20 +1,18 @@
###*
Definition of the JsonGenerator class.
@license MIT. See LICENSE.md for details.
@module generators/json-generator
@license MIT. See LICENSE.md for details.
###
BaseGenerator = require './base-generator'
FS = require 'fs'
_ = require 'underscore'
###*
The JsonGenerator generates a JSON resume directly.
###
###* The JsonGenerator generates a JSON resume directly. ###
JsonGenerator = module.exports = BaseGenerator.extend
module.exports = class JsonGenerator extends BaseGenerator
init: () -> @_super 'json'
constructor: () -> super 'json'
keys: ['imp', 'warnings', 'computed', 'filt', 'ctrl', 'index',
'safeStartDate', 'safeEndDate', 'safeDate', 'safeReleaseDate', 'result',

View File

@ -1,6 +1,6 @@
###*
Definition of the JsonYamlGenerator class.
@module json-yaml-generator.js
@module generators/json-yaml-generator
@license MIT. See LICENSE.md for details.
###
@ -18,9 +18,9 @@ JSON without a template, producing an equivalent YAML-formatted resume. See
also YamlGenerator (yaml-generator.js).
###
JsonYamlGenerator = module.exports = BaseGenerator.extend
module.exports = class JsonYamlGenerator extends BaseGenerator
init: () -> @_super 'yml'
constructor: () -> super 'yml'
invoke: ( rez, themeMarkup, cssInfo, opts ) ->
YAML.stringify JSON.parse( rez.stringify() ), Infinity, 2

View File

@ -1,7 +1,7 @@
###*
Definition of the LaTeXGenerator class.
@license MIT. See LICENSE.md for details.
@module generators/latex-generator
@license MIT. See LICENSE.md for details.
###
TemplateGenerator = require './template-generator'
@ -9,6 +9,6 @@ TemplateGenerator = require './template-generator'
###*
LaTeXGenerator generates a LaTeX resume via TemplateGenerator.
###
LaTeXGenerator = module.exports = TemplateGenerator.extend
module.exports = class LaTeXGenerator extends TemplateGenerator
init: () -> @_super 'latex', 'tex'
constructor: () -> super 'latex', 'tex'

View File

@ -1,7 +1,7 @@
###*
Definition of the MarkdownGenerator class.
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module markdown-generator.js
@module generators/markdown-generator
@license MIT. See LICENSE.md for details.
###
TemplateGenerator = require './template-generator'
@ -9,6 +9,6 @@ TemplateGenerator = require './template-generator'
###*
MarkdownGenerator generates a Markdown-formatted resume via TemplateGenerator.
###
MarkdownGenerator = module.exports = TemplateGenerator.extend
module.exports = class MarkdownGenerator extends TemplateGenerator
init: () -> @_super 'md', 'txt'
constructor: () -> super 'md', 'txt'

View File

@ -1,7 +1,7 @@
###*
Definition of the TemplateGenerator class. TODO: Refactor
@module generators/template-generator
@license MIT. See LICENSE.md for details.
@module template-generator.js
###
@ -27,14 +27,14 @@ plain text, and XML versions of Microsoft Word, Excel, and OpenOffice.
@class TemplateGenerator
###
TemplateGenerator = module.exports = BaseGenerator.extend
module.exports = class TemplateGenerator extends BaseGenerator
###* Constructor. Set the output format and template format for this
generator. Will usually be called by a derived generator such as
HTMLGenerator or MarkdownGenerator. ###
init: ( outputFormat, templateFormat, cssFile ) ->
@_super outputFormat
constructor: ( outputFormat, templateFormat, cssFile ) ->
super outputFormat
@tplFormat = templateFormat || outputFormat
return
@ -149,11 +149,6 @@ TemplateGenerator = module.exports = BaseGenerator.extend
###* Export the TemplateGenerator function/ctor. ###
module.exports = TemplateGenerator
###* Freeze newlines for protection against errant JST parsers. ###
freeze = ( markup ) ->
markup.replace( _reg.regN, _defaultOpts.nSym )

View File

@ -1,7 +1,7 @@
###*
Definition of the TextGenerator class.
@module generators/text-generator
@license MIT. See LICENSE.md for details.
@module text-generator.js
###
TemplateGenerator = require './template-generator'
@ -9,6 +9,6 @@ TemplateGenerator = require './template-generator'
###*
The TextGenerator generates a plain-text resume via the TemplateGenerator.
###
TextGenerator = module.exports = TemplateGenerator.extend
module.exports = class TextGenerator extends TemplateGenerator
init: () -> @_super 'txt'
constructor: () -> super 'txt'

View File

@ -1,11 +1,12 @@
###
Definition of the WordGenerator class.
@license MIT. See LICENSE.md for details.
@module generators/word-generator
@license MIT. See LICENSE.md for details.
###
TemplateGenerator = require './template-generator'
WordGenerator = module.exports = TemplateGenerator.extend
init: () -> @_super 'doc', 'xml'
module.exports = class WordGenerator extends TemplateGenerator
init: () -> super 'doc', 'xml'

View File

@ -6,8 +6,7 @@ Definition of the XMLGenerator class.
BaseGenerator = require './base-generator'
###*
The XmlGenerator generates an XML resume via the TemplateGenerator.
###
XMLGenerator = module.exports = BaseGenerator.extend
init: () -> @_super 'xml'
###* The XmlGenerator generates an XML resume via the TemplateGenerator. ###
module.exports = class XMLGenerator extends BaseGenerator
constructor: () -> super 'xml'

View File

@ -11,5 +11,6 @@ TemplateGenerator = require './template-generator'
YamlGenerator generates a YAML-formatted resume via TemplateGenerator.
###
YAMLGenerator = module.exports = TemplateGenerator.extend
init: () -> @_super 'yml', 'yml'
module.exports = class YAMLGenerator extends TemplateGenerator
constructor: () -> super 'yml', 'yml'