1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2024-11-23 00:40:10 +00:00

Integrate JRSTheme class.

This commit is contained in:
hacksalot 2015-12-30 12:37:26 -05:00
parent b21fd93d66
commit 3e7d9c0411
4 changed files with 25 additions and 11 deletions

View File

@ -17,7 +17,8 @@ Definition of the TemplateGenerator class.
, MKDIRP = require('mkdirp') , MKDIRP = require('mkdirp')
, BaseGenerator = require( './base-generator' ) , BaseGenerator = require( './base-generator' )
, EXTEND = require('../utils/extend') , EXTEND = require('../utils/extend')
, Theme = require('../core/theme'); , FRESHTheme = require('../core/fresh-theme')
, JRSTheme = require('../core/jrs-theme');
@ -220,20 +221,28 @@ Definition of the TemplateGenerator class.
Given a theme title, load the corresponding theme. Given a theme title, load the corresponding theme.
*/ */
function themeFromMoniker() { function themeFromMoniker() {
// Verify the specified theme name/path // Verify the specified theme name/path
var tFolder = PATH.join( var tFolder = PATH.join(
parsePath( require.resolve('fluent-themes') ).dirname, parsePath( require.resolve('fluent-themes') ).dirname,
this.opts.theme this.opts.theme
); );
var exists = require('path-exists').sync;
if( !exists( tFolder ) ) {
tFolder = PATH.resolve( this.opts.theme );
if( !exists( tFolder ) ) {
throw { fluenterror: this.codes.themeNotFound, data: this.opts.theme};
}
}
var t = this.opts.themeObj || new Theme().open( tFolder ); var t;
if( this.opts.theme.startsWith('jsonresume-theme-') ) {
console.log('LOADING JSON RESUME');
t = new JRSTheme().open( tFolder );
}
else {
var exists = require('path-exists').sync;
if( !exists( tFolder ) ) {
tFolder = PATH.resolve( this.opts.theme );
if( !exists( tFolder ) ) {
throw { fluenterror: this.codes.themeNotFound, data: this.opts.theme};
}
}
t = this.opts.themeObj || new FRESHTheme().open( tFolder );
}
// Load the theme and format // Load the theme and format
return { return {

View File

@ -8,7 +8,8 @@ module.exports = {
Sheet: require('./core/fresh-resume'), Sheet: require('./core/fresh-resume'),
FRESHResume: require('./core/fresh-resume'), FRESHResume: require('./core/fresh-resume'),
JRSResume: require('./core/jrs-resume'), JRSResume: require('./core/jrs-resume'),
Theme: require('./core/theme'), FRESHTheme: require('./core/fresh-theme'),
JRSTheme: require('./core/jrs-theme'),
FluentDate: require('./core/fluent-date'), FluentDate: require('./core/fluent-date'),
HtmlGenerator: require('./gen/html-generator'), HtmlGenerator: require('./gen/html-generator'),
TextGenerator: require('./gen/text-generator'), TextGenerator: require('./gen/text-generator'),

View File

@ -6,10 +6,12 @@
, MD = require('marked') , MD = require('marked')
, MKDIRP = require('mkdirp') , MKDIRP = require('mkdirp')
, _opts = require('../core/default-options') , _opts = require('../core/default-options')
, FluentTheme = require('../core/theme') , FluentTheme = require('../core/fresh-theme')
, JRSTheme = require('../core/jrs-theme')
, ResumeFactory = require('../core/resume-factory') , ResumeFactory = require('../core/resume-factory')
, _ = require('underscore') , _ = require('underscore')
, _fmts = require('../core/default-formats') , _fmts = require('../core/default-formats')
, unused = require('string.prototype.startswith')
, _err, _log, rez; , _err, _log, rez;
/** /**
@ -51,6 +53,8 @@
// Load the theme // Load the theme
var theTheme = (new FluentTheme()).open( tFolder ); var theTheme = (new FluentTheme()).open( tFolder );
var theTheme = _opts.theme.startsWith('jsonresume-theme') ?
new JRSTheme().open(tFolder) : new FluentTheme().open( tFolder );
_opts.themeObj = theTheme; _opts.themeObj = theTheme;
var numFormats = theTheme.formats ? Object.keys(theTheme.formats).length : 2; var numFormats = theTheme.formats ? Object.keys(theTheme.formats).length : 2;
_log( 'Applying '.info + theTheme.name.toUpperCase().infoBold + _log( 'Applying '.info + theTheme.name.toUpperCase().infoBold +