1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2024-11-23 00:40:10 +00:00
This commit is contained in:
hacksalot 2015-12-30 15:11:18 -05:00
parent ccadb0416f
commit 2ff912e687

View File

@ -16,32 +16,37 @@ Definition of the JRSTheme class.
/** /**
The JRSTheme class is a representation of a JSON Resume theme asset. The JRSTheme class is a representation of a JSON Resume
theme asset.
@class JRSTheme @class JRSTheme
*/ */
function JRSTheme() { function JRSTheme() {
} }
/** /**
Open and parse the specified theme. Open and parse the specified theme.
@method open
*/ */
JRSTheme.prototype.open = function( themeFolder ) { JRSTheme.prototype.open = function( thFolder ) {
this.folder = themeFolder; this.folder = thFolder;
// Open the [theme-name].json file; should have the same name as folder // Open the [theme-name].json file; should have the same
var pathInfo = parsePath( themeFolder ); // name as folder
var pathInfo = parsePath( thFolder );
// Open and parse the theme's package.json file. // Open and parse the theme's package.json file.
var packageJsonPath = PATH.join(themeFolder, 'package.json'); var pkgJsonPath = PATH.join( thFolder, 'package.json' );
if( pathExists( packageJsonPath ) ) { if( pathExists( pkgJsonPath )) {
var themePack = require( themeFolder ); var thApi = require( thFolder )
var themePkgJson = require( packageJsonPath ); , thPkg = require( pkgJsonPath );
this.name = themePkgJson.name; this.name = thPkg.name;
this.render = (themePack && themePack.render) || undefined; this.render = (thApi && thApi.render) || undefined;
this.formats = { this.formats = {
html: { title: 'html', outFormat: 'html', ext: 'html' } html: { title:'html', outFormat:'html', ext:'html' }
}; };
} }
else { else {
@ -51,20 +56,30 @@ Definition of the JRSTheme class.
return this; return this;
}; };
/** /**
Determine if the theme supports the specified output format. Determine if the theme supports the output format.
@method hasFormat
*/ */
JRSTheme.prototype.hasFormat = function( fmt ) { JRSTheme.prototype.hasFormat = function( fmt ) {
return _.has( this.formats, fmt ); return _.has( this.formats, fmt );
}; };
/** /**
Determine if the theme supports the specified output format. Return the requested output format.
@method getFormat
*/ */
JRSTheme.prototype.getFormat = function( fmt ) { JRSTheme.prototype.getFormat = function( fmt ) {
return this.formats[ fmt ]; return this.formats[ fmt ];
}; };
module.exports = JRSTheme; module.exports = JRSTheme;
}()); }());