mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-11-05 01:56:21 +00:00
Add support for .ignore flag in FRESH and JRS resumes.
Preliminary support for ".ignore" on any non-leaf FRESH or JRS node. Nodes (employment entries, education stints, etc.) decorated with ".ignore" will be treated by HMR as if they weren't present.
This commit is contained in:
parent
47f6aff561
commit
201f39442e
@ -74,6 +74,7 @@
|
||||
"slash": "^1.0.0",
|
||||
"string-padding": "^1.0.2",
|
||||
"string.prototype.startswith": "^0.2.0",
|
||||
"traverse": "^0.6.6",
|
||||
"underscore": "^1.8.3",
|
||||
"webshot": "^0.16.0",
|
||||
"word-wrap": "^1.1.0",
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
Definition of the FRESHResume class.
|
||||
@license MIT. See LICENSE.md for details.
|
||||
@module fresh-resume.js
|
||||
@module core/fresh-resume
|
||||
*/
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ Definition of the FRESHResume class.
|
||||
|
||||
|
||||
/**
|
||||
Initialize the the FreshResume from string.
|
||||
Initialize the the FreshResume from JSON string data.
|
||||
*/
|
||||
FreshResume.prototype.parse = function( stringData, opts ) {
|
||||
return this.parseJSON( JSON.parse( stringData ), opts );
|
||||
@ -66,13 +66,24 @@ Definition of the FRESHResume class.
|
||||
{
|
||||
date: Perform safe date conversion.
|
||||
sort: Sort resume items by date.
|
||||
computer: Prepare computed resume totals.
|
||||
compute: Prepare computed resume totals.
|
||||
}
|
||||
*/
|
||||
FreshResume.prototype.parseJSON = function( rep, opts ) {
|
||||
|
||||
// Ignore any element with the 'ignore: true' designator.
|
||||
var that = this, traverse = require('traverse'), ignoreList = [];
|
||||
var scrubbed = traverse( rep ).map( function( x ) {
|
||||
if( !this.isLeaf && this.node.ignore ) {
|
||||
if ( this.node.ignore === true || this.node.ignore === 'true' ) {
|
||||
ignoreList.push( this.node );
|
||||
this.remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Now apply the resume representation onto this object
|
||||
extend( true, this, rep );
|
||||
extend( true, this, scrubbed );
|
||||
|
||||
// If the resume already has a .imp object, then we are being called from
|
||||
// the .dupe method, and there's no need to do any post processing
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
Definition of the JRSResume class.
|
||||
@license MIT. See LICENSE.md for details.
|
||||
@module jrs-resume.js
|
||||
@module core/jrs-resume
|
||||
*/
|
||||
|
||||
|
||||
@ -60,14 +60,35 @@ Definition of the JRSResume class.
|
||||
|
||||
|
||||
/**
|
||||
Initialize the JRSResume from JSON.
|
||||
Open and parse the specified JRS resume. Merge the JSON object model onto this
|
||||
Sheet instance with extend() and convert sheet dates to a safe & consistent
|
||||
format. Then sort each section by startDate descending.
|
||||
Initialize the JRSResume object from JSON.
|
||||
Open and parse the specified JRS resume. Merge the JSON object model onto
|
||||
this Sheet instance with extend() and convert sheet dates to a safe &
|
||||
consistent format. Then sort each section by startDate descending.
|
||||
@param rep {Object} The raw JSON representation.
|
||||
@param opts {Object} Resume loading and parsing options.
|
||||
{
|
||||
date: Perform safe date conversion.
|
||||
sort: Sort resume items by date.
|
||||
compute: Prepare computed resume totals.
|
||||
}
|
||||
*/
|
||||
JRSResume.prototype.parseJSON = function( rep, opts ) {
|
||||
opts = opts || { };
|
||||
extend( true, this, rep );
|
||||
|
||||
// Ignore any element with the 'ignore: true' designator.
|
||||
var that = this, traverse = require('traverse'), ignoreList = [];
|
||||
var scrubbed = traverse( rep ).map( function( x ) {
|
||||
if( !this.isLeaf && this.node.ignore ) {
|
||||
if ( this.node.ignore === true || this.node.ignore === 'true' ) {
|
||||
ignoreList.push( this.node );
|
||||
this.remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Extend resume properties onto ourself.
|
||||
extend( true, this, scrubbed );
|
||||
|
||||
// Set up metadata
|
||||
if( opts.imp === undefined || opts.imp ) {
|
||||
this.basics.imp = this.basics.imp || { };
|
||||
|
Loading…
Reference in New Issue
Block a user