1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2024-07-05 01:20:06 +01:00

Update file headers.

This commit is contained in:
devlinjd 2015-12-17 10:15:59 -05:00
parent 18dbb23168
commit eabab26eef
27 changed files with 120 additions and 60 deletions

View File

@ -1,6 +1,7 @@
/** /**
FRESH to JSON Resume conversion routiens. FRESH to JSON Resume conversion routiens.
@license MIT. Copyright (c) 2015 James M. Devlin / FluentDesk @license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module convert.js
*/ */
(function(){ (function(){

View File

@ -1,6 +1,7 @@
/** /**
The FluentCV date representation. The FluentCV date representation.
@license Copyright (c) 2015 by James M. Devlin. All rights reserved. @license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module fluent-date.js
*/ */
var moment = require('moment'); var moment = require('moment');

View File

@ -1,6 +1,7 @@
/** /**
Definition of the FRESHResume class. Definition of the FRESHResume class.
@license MIT. Copyright (c) 2015 James M. Devlin / FluentDesk @license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module fresh-resume.js
*/ */
(function() { (function() {

View File

@ -1,6 +1,7 @@
/** /**
Definition of the JRSResume class. Definition of the JRSResume class.
@license MIT. Copyright (c) 2015 James M. Devlin / FluentDesk @license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module jrs-resume.js
*/ */
(function() { (function() {

View File

@ -1,6 +1,7 @@
/** /**
Abstract theme representation. Definition of the Theme class.
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk. @license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module theme.js
*/ */
(function() { (function() {

View File

@ -1,25 +1,59 @@
/** /**
Handlebars template generate for FluentCV. Definition of the HandlebarsGenerator class.
@license MIT. Copyright (c) 2015 James M. Devlin / FluentDesk. @license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module handlebars-generator.js
*/ */
(function() { (function() {
var _ = require('underscore');
var HANDLEBARS = require('handlebars');
var FS = require('fs');
var moment = require('moment');
var MD = require('marked');
var H2W = require('../utils/html-to-wpml');
var _ = require('underscore')
, HANDLEBARS = require('handlebars')
, FS = require('fs')
, moment = require('moment')
, MD = require('marked')
, H2W = require('../utils/html-to-wpml');
/**
Perform template-based resume generation using Handlebars.js.
@method generate
*/
module.exports = function( json, jst, format, cssInfo, opts, theme ) { module.exports = function( json, jst, format, cssInfo, opts, theme ) {
// Pre-compile any partials present in the theme.
_.each( theme.partials, function( el ) { _.each( theme.partials, function( el ) {
var tplData = FS.readFileSync( el.path, 'utf8' ); var tplData = FS.readFileSync( el.path, 'utf8' );
var compiledTemplate = HANDLEBARS.compile( tplData ); var compiledTemplate = HANDLEBARS.compile( tplData );
HANDLEBARS.registerPartial( el.name, compiledTemplate ); HANDLEBARS.registerPartial( el.name, compiledTemplate );
}); });
// Register necessary helpers.
registerHelpers();
// Compile and run the Handlebars template.
var template = HANDLEBARS.compile(jst);
return template({
r: json,
filt: opts.filters,
cssInfo: cssInfo,
headFragment: opts.headFragment || ''
});
};
/**
Register useful Handlebars helpers.
@method registerHelpers
*/
function registerHelpers() {
// Set up a date formatting helper so we can do:
// {{#formatDate val 'YYYY-MM'}}
HANDLEBARS.registerHelper("formatDate", function(datetime, format) { HANDLEBARS.registerHelper("formatDate", function(datetime, format) {
if( moment ) { if( moment ) {
return moment( datetime ).format( format ); return moment( datetime ).format( format );
@ -29,19 +63,23 @@ Handlebars template generate for FluentCV.
} }
}); });
// Set up a Markdown-to-WordProcessingML helper so we can do:
// {{#wmpl val [true|false]}}
HANDLEBARS.registerHelper("wpml", function( txt, inline ) { HANDLEBARS.registerHelper("wpml", function( txt, inline ) {
inline = (inline && !inline.hash) || false; inline = (inline && !inline.hash) || false;
txt = inline ? MD(txt.trim()).replace(/^\s*<p>|<\/p>\s*$/gi, '') : MD(txt.trim()); txt = inline ?
MD(txt.trim()).replace(/^\s*<p>|<\/p>\s*$/gi, '') :
MD(txt.trim());
txt = H2W( txt.trim() ); txt = H2W( txt.trim() );
return txt; return txt;
}); });
// Set up a generic conditional helper so we can do:
// {{#compare val otherVal operator="<"}}
// http://doginthehat.com.au/2012/02/comparison-block-helper-for-handlebars-templates/ // http://doginthehat.com.au/2012/02/comparison-block-helper-for-handlebars-templates/
HANDLEBARS.registerHelper('compare', function(lvalue, rvalue, options) { HANDLEBARS.registerHelper('compare', function(lvalue, rvalue, options) {
if (arguments.length < 3) if (arguments.length < 3)
throw new Error("Handlerbars Helper 'compare' needs 2 parameters"); throw new Error("Handlerbars Helper 'compare' needs 2 parameters");
var operator = options.hash.operator || "=="; var operator = options.hash.operator || "==";
var operators = { var operators = {
'==': function(l,r) { return l == r; }, '==': function(l,r) { return l == r; },
@ -53,21 +91,13 @@ Handlebars template generate for FluentCV.
'>=': function(l,r) { return l >= r; }, '>=': function(l,r) { return l >= r; },
'typeof': function(l,r) { return typeof l == r; } 'typeof': function(l,r) { return typeof l == r; }
}; };
if (!operators[operator]) if (!operators[operator])
throw new Error("Handlerbars Helper 'compare' doesn't know the operator "+operator); throw new Error("Handlerbars Helper 'compare' doesn't know the operator "+operator);
var result = operators[operator](lvalue,rvalue); var result = operators[operator](lvalue,rvalue);
return result ? options.fn(this) : options.inverse(this); return result ? options.fn(this) : options.inverse(this);
}); });
}
var template = HANDLEBARS.compile(jst);
return template({
r: json,
filt: opts.filters,
cssInfo: cssInfo,
headFragment: opts.headFragment || ''
});
};
}()); }());

View File

@ -1,6 +1,6 @@
/** /**
Underscore template generate for FluentCV. Definition of the UnderscoreGenerator class.
@license MIT. Copyright (c) 2015 James M. Devlin / FluentDesk. @license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
*/ */
(function() { (function() {

View File

@ -1,6 +1,6 @@
/** /**
Internal resume generation logic for FluentCV. Internal resume generation logic for FluentCV.
@license MIT. Copyright (c) 2015 James M. Devlin / FluentDesk @license MIT. Copyright (c) 2015 James M. Devlin / FluentDesk.
@module fluentcmd.js @module fluentcmd.js
*/ */

View File

@ -1,6 +1,7 @@
/** /**
External API surface for FluentCV:CLI. External API surface for FluentCV:CLI.
@license MIT. Copyright (c) 2015 James M. Devlin / FluentDesk @license MIT. Copyright (c) 2015 James M. Devlin / FluentDesk.
@module fluentlib.js
*/ */
module.exports = { module.exports = {

View File

@ -1,6 +1,7 @@
/** /**
Base resume generator for FluentCV. Definition of the BaseGenerator class.
@license Copyright (c) 2015 | James M. Devlin @license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module base-generator.js
*/ */
(function() { (function() {

View File

@ -1,6 +1,7 @@
/** /**
HTML resume generator for FluentCV. Definition of the HTMLGenerator class.
@license Copyright (c) 2015 James M. Devlin / FluentDesk @license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module html-generator.js
*/ */
(function() { (function() {

View File

@ -1,6 +1,7 @@
/** /**
Definition of the HtmlPdfGenerator class. Definition of the HtmlPdfGenerator class.
@license Copyright (c) 2015 James M. Devlin / FluentDesk @license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module html-pdf-generator.js
*/ */
(function() { (function() {

View File

@ -1,6 +1,7 @@
/** /**
Definition of the JsonGenerator class. Definition of the JsonGenerator class.
@license Copyright (c) 2015 | James M. Devlin @license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module json-generator.js
*/ */
var BaseGenerator = require('./base-generator'); var BaseGenerator = require('./base-generator');

View File

@ -1,7 +1,7 @@
/** /**
A JSON-driven YAML resume generator for FluentLib. Definition of the JsonYamlGenerator class.
@module json-yaml-generator.js @module json-yaml-generator.js
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk @license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
*/ */
(function() { (function() {

View File

@ -1,6 +1,7 @@
/** /**
LaTeX resume generator for FluentCV. Definition of the LaTeXGenerator class.
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk @license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module latex-generator.js
*/ */
var TemplateGenerator = require('./template-generator'); var TemplateGenerator = require('./template-generator');

View File

@ -1,6 +1,7 @@
/** /**
Markdown resume generator for FluentCV. Definition of the MarkdownGenerator class.
@license Copyright (c) 2015 by James M. Devlin. All rights reserved. @license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module markdown-generator.js
*/ */
var TemplateGenerator = require('./template-generator'); var TemplateGenerator = require('./template-generator');

View File

@ -1,6 +1,7 @@
/** /**
Template-based resume generator base for FluentCV. Definition of the TemplateGenerator class.
@license MIT. Copyright (c) 2015 James M. Devlin / FluentDesk. @license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module template-generator.js
*/ */
(function() { (function() {

View File

@ -1,6 +1,7 @@
/** /**
Plain text resume generator for FluentCV. Definition of the TextGenerator class.
@license Copyright (c) 2015 by James M. Devlin. All rights reserved. @license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module text-generator.js
*/ */
var TemplateGenerator = require('./template-generator'); var TemplateGenerator = require('./template-generator');

View File

@ -1,6 +1,7 @@
/** /**
MS Word resume generator for FluentCV. Definition of the WordGenerator class.
@license Copyright (c) 2015 by James M. Devlin. All rights reserved. @license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module word-generator.js
*/ */
(function() { (function() {

View File

@ -1,6 +1,7 @@
/** /**
XML resume generator for FluentCV. Definition of the XMLGenerator class.
@license Copyright (c) 2015 | James M. Devlin @license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module xml-generator.js
*/ */
var BaseGenerator = require('./base-generator'); var BaseGenerator = require('./base-generator');
@ -8,7 +9,7 @@ var BaseGenerator = require('./base-generator');
/** /**
The XmlGenerator generates an XML resume via the TemplateGenerator. The XmlGenerator generates an XML resume via the TemplateGenerator.
*/ */
var XmlGenerator = module.exports = BaseGenerator.extend({ var XMLGenerator = module.exports = BaseGenerator.extend({
init: function(){ init: function(){
this._super( 'xml' ); this._super( 'xml' );

View File

@ -1,7 +1,7 @@
/** /**
A YAML resume generator for FluentLib. Definition of the YAMLGenerator class.
@module yaml-generator.js @module yaml-generator.js
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk @license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
*/ */
@ -13,7 +13,7 @@ A YAML resume generator for FluentLib.
YamlGenerator generates a YAML-formatted resume via TemplateGenerator. YamlGenerator generates a YAML-formatted resume via TemplateGenerator.
*/ */
var YamlGenerator = module.exports = TemplateGenerator.extend({ var YAMLGenerator = module.exports = TemplateGenerator.extend({
init: function(){ init: function(){
this._super( 'yml', 'yml' ); this._super( 'yml', 'yml' );

View File

@ -3,6 +3,7 @@
/** /**
Command-line interface (CLI) for FluentCV:CLI. Command-line interface (CLI) for FluentCV:CLI.
@license MIT. Copyright (c) 2015 James M. Devlin / FluentDesk. @license MIT. Copyright (c) 2015 James M. Devlin / FluentDesk.
@module index.js
*/ */
var ARGS = require( 'minimist' ) var ARGS = require( 'minimist' )

View File

@ -1,3 +1,8 @@
/**
Definition of John Resig's `Class` class.
@module class.js
*/
/* Simple JavaScript Inheritance /* Simple JavaScript Inheritance
* By John Resig http://ejohn.org/ * By John Resig http://ejohn.org/
* MIT Licensed. * MIT Licensed.

View File

@ -1,6 +1,7 @@
/** /**
Plain JavaScript replacement of jQuery .extend based on jQuery sources. Definition of the `extend` method.
@license Copyright (c) 2015 by James M. Devlin. All rights reserved. @license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module extend.js
*/ */
function _extend() { function _extend() {

View File

@ -1,6 +1,7 @@
/** /**
File-exists checker for Node.js. Definition of the `fileExists` method.
@license Copyright (c) 2015 | James M. Devlin @license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module file-exists.js
*/ */
var FS = require('fs'); var FS = require('fs');

View File

@ -1,3 +1,8 @@
/**
Definition of the Markdown to WordProcessingML conversion routine.
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module html-to-wpml.js
*/
(function(){ (function(){
@ -7,7 +12,7 @@
module.exports = function( html ) { module.exports = function( html ) {
var final = ''; var final = '';
var is_bold = false, is_italic = false; var is_bold = false, is_italic = false, is_link = false;
var depth = 0; var depth = 0;
var tokens = HTML5Tokenizer.tokenize( html ); var tokens = HTML5Tokenizer.tokenize( html );

View File

@ -1,6 +1,7 @@
/** /**
String utility functions. Definitions of string utility functions.
@license Copyright (c) 2015 | James M. Devlin @license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module string.js
*/ */
/** /**