Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat-notices #24

Merged
merged 2 commits into from
Dec 17, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fluentcv",
"version": "0.10.2",
"version": "0.10.3",
"description": "Generate polished résumés and CVs in HTML, Markdown, LaTeX, MS Word, PDF, plain text, JSON, XML, YAML, smoke signal, and carrier pigeon.",
"repository": {
"type": "git",
Expand Down Expand Up @@ -33,7 +33,7 @@
"homepage": "https://github.com/fluentdesk/fluentcv",
"dependencies": {
"colors": "^1.1.2",
"fluent-themes": "~0.6.2-beta",
"fluent-themes": "~0.6.3-beta",
"fresca": "~0.2.1",
"fs-extra": "^0.24.0",
"handlebars": "^4.0.5",
Expand Down
3 changes: 2 additions & 1 deletion src/core/convert.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
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(){
Expand Down
3 changes: 2 additions & 1 deletion src/core/fluent-date.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
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');
Expand Down
3 changes: 2 additions & 1 deletion src/core/fresh-resume.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
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() {
Expand Down
3 changes: 2 additions & 1 deletion src/core/jrs-resume.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
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() {
Expand Down
3 changes: 2 additions & 1 deletion src/core/theme.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
Abstract theme representation.
Definition of the Theme class.
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module theme.js
*/

(function() {
Expand Down
70 changes: 50 additions & 20 deletions src/eng/handlebars-generator.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,59 @@
/**
Handlebars template generate for FluentCV.
@license MIT. Copyright (c) 2015 James M. Devlin / FluentDesk.
Definition of the HandlebarsGenerator class.
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module handlebars-generator.js
*/

(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 ) {

// Pre-compile any partials present in the theme.
_.each( theme.partials, function( el ) {
var tplData = FS.readFileSync( el.path, 'utf8' );
var compiledTemplate = HANDLEBARS.compile( tplData );
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) {
if( moment ) {
return moment( datetime ).format( format );
Expand All @@ -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 ) {
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() );
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/
HANDLEBARS.registerHelper('compare', function(lvalue, rvalue, options) {

if (arguments.length < 3)
throw new Error("Handlerbars Helper 'compare' needs 2 parameters");

var operator = options.hash.operator || "==";
var operators = {
'==': function(l,r) { return l == r; },
Expand All @@ -53,21 +91,13 @@ Handlebars template generate for FluentCV.
'>=': function(l,r) { return l >= r; },
'typeof': function(l,r) { return typeof l == r; }
};

if (!operators[operator])
throw new Error("Handlerbars Helper 'compare' doesn't know the operator "+operator);
var result = operators[operator](lvalue,rvalue);
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 || ''
});

};

}());
4 changes: 2 additions & 2 deletions src/eng/underscore-generator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
Underscore template generate for FluentCV.
@license MIT. Copyright (c) 2015 James M. Devlin / FluentDesk.
Definition of the UnderscoreGenerator class.
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
*/

(function() {
Expand Down
2 changes: 1 addition & 1 deletion src/fluentcmd.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
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
*/

Expand Down
3 changes: 2 additions & 1 deletion src/fluentlib.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
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 = {
Expand Down
5 changes: 3 additions & 2 deletions src/gen/base-generator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
Base resume generator for FluentCV.
@license Copyright (c) 2015 | James M. Devlin
Definition of the BaseGenerator class.
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module base-generator.js
*/

(function() {
Expand Down
5 changes: 3 additions & 2 deletions src/gen/html-generator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
HTML resume generator for FluentCV.
@license Copyright (c) 2015 James M. Devlin / FluentDesk
Definition of the HTMLGenerator class.
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module html-generator.js
*/

(function() {
Expand Down
3 changes: 2 additions & 1 deletion src/gen/html-pdf-generator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
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() {
Expand Down
3 changes: 2 additions & 1 deletion src/gen/json-generator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
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');
Expand Down
4 changes: 2 additions & 2 deletions src/gen/json-yaml-generator.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
A JSON-driven YAML resume generator for FluentLib.
Definition of the JsonYamlGenerator class.
@module json-yaml-generator.js
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
*/

(function() {
Expand Down
5 changes: 3 additions & 2 deletions src/gen/latex-generator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
LaTeX resume generator for FluentCV.
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk
Definition of the LaTeXGenerator class.
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module latex-generator.js
*/

var TemplateGenerator = require('./template-generator');
Expand Down
5 changes: 3 additions & 2 deletions src/gen/markdown-generator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
Markdown resume generator for FluentCV.
@license Copyright (c) 2015 by James M. Devlin. All rights reserved.
Definition of the MarkdownGenerator class.
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module markdown-generator.js
*/

var TemplateGenerator = require('./template-generator');
Expand Down
5 changes: 3 additions & 2 deletions src/gen/template-generator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
Template-based resume generator base for FluentCV.
@license MIT. Copyright (c) 2015 James M. Devlin / FluentDesk.
Definition of the TemplateGenerator class.
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module template-generator.js
*/

(function() {
Expand Down
5 changes: 3 additions & 2 deletions src/gen/text-generator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
Plain text resume generator for FluentCV.
@license Copyright (c) 2015 by James M. Devlin. All rights reserved.
Definition of the TextGenerator class.
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module text-generator.js
*/

var TemplateGenerator = require('./template-generator');
Expand Down
5 changes: 3 additions & 2 deletions src/gen/word-generator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
MS Word resume generator for FluentCV.
@license Copyright (c) 2015 by James M. Devlin. All rights reserved.
Definition of the WordGenerator class.
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module word-generator.js
*/

(function() {
Expand Down
7 changes: 4 additions & 3 deletions src/gen/xml-generator.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
/**
XML resume generator for FluentCV.
@license Copyright (c) 2015 | James M. Devlin
Definition of the XMLGenerator class.
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module xml-generator.js
*/

var BaseGenerator = require('./base-generator');

/**
The XmlGenerator generates an XML resume via the TemplateGenerator.
*/
var XmlGenerator = module.exports = BaseGenerator.extend({
var XMLGenerator = module.exports = BaseGenerator.extend({

init: function(){
this._super( 'xml' );
Expand Down
6 changes: 3 additions & 3 deletions src/gen/yaml-generator.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
A YAML resume generator for FluentLib.
Definition of the YAMLGenerator class.
@module yaml-generator.js
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
*/


Expand All @@ -13,7 +13,7 @@ A YAML resume generator for FluentLib.
YamlGenerator generates a YAML-formatted resume via TemplateGenerator.
*/

var YamlGenerator = module.exports = TemplateGenerator.extend({
var YAMLGenerator = module.exports = TemplateGenerator.extend({

init: function(){
this._super( 'yml', 'yml' );
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/**
Command-line interface (CLI) for FluentCV:CLI.
@license MIT. Copyright (c) 2015 James M. Devlin / FluentDesk.
@module index.js
*/

var ARGS = require( 'minimist' )
Expand Down
5 changes: 5 additions & 0 deletions src/utils/class.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
Definition of John Resig's `Class` class.
@module class.js
*/

/* Simple JavaScript Inheritance
* By John Resig http://ejohn.org/
* MIT Licensed.
Expand Down
5 changes: 3 additions & 2 deletions src/utils/extend.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
Plain JavaScript replacement of jQuery .extend based on jQuery sources.
@license Copyright (c) 2015 by James M. Devlin. All rights reserved.
Definition of the `extend` method.
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module extend.js
*/

function _extend() {
Expand Down
5 changes: 3 additions & 2 deletions src/utils/file-exists.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
File-exists checker for Node.js.
@license Copyright (c) 2015 | James M. Devlin
Definition of the `fileExists` method.
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
@module file-exists.js
*/

var FS = require('fs');
Expand Down
7 changes: 6 additions & 1 deletion src/utils/html-to-wpml.js
Original file line number Diff line number Diff line change
@@ -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(){

Expand All @@ -7,7 +12,7 @@
module.exports = function( html ) {

var final = '';
var is_bold = false, is_italic = false;
var is_bold = false, is_italic = false, is_link = false;
var depth = 0;

var tokens = HTML5Tokenizer.tokenize( html );
Expand Down
Loading