From ccadb0416f8d82fbfe8e117acfd4a125494adf4c Mon Sep 17 00:00:00 2001 From: hacksalot Date: Wed, 30 Dec 2015 15:03:26 -0500 Subject: [PATCH] Move freebie formats out of theme class. --- src/core/fresh-theme.js | 4 ---- src/verbs/generate.js | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/core/fresh-theme.js b/src/core/fresh-theme.js index 1d8fdc2..bf2b414 100644 --- a/src/core/fresh-theme.js +++ b/src/core/fresh-theme.js @@ -67,10 +67,6 @@ Definition of the FRESHTheme class. formatsHash = loadImplicit.call( this ); } - // Add freebie formats every theme gets - formatsHash.json = { title: 'json', outFormat: 'json', pre: 'json', ext: 'json', path: null, data: null }; - formatsHash.yml = { title: 'yaml', outFormat: 'yml', pre: 'yml', ext: 'yml', path: null, data: null }; - // Cache this.formats = formatsHash; diff --git a/src/verbs/generate.js b/src/verbs/generate.js index 276fdf4..c0cd8da 100644 --- a/src/verbs/generate.js +++ b/src/verbs/generate.js @@ -218,9 +218,25 @@ Implementation of the 'generate' verb for HackMyResume. Load the specified theme. */ function load_theme( tFolder ) { + + // Create a FRESH or JRS theme object var theTheme = _opts.theme.indexOf('jsonresume-theme-') > -1 ? new JRSTheme().open(tFolder) : new FluentTheme().open( tFolder ); + + // Add freebie formats every theme gets + theTheme.formats.json = theTheme.formats.json || { + title: 'json', outFormat: 'json', pre: 'json', + ext: 'json', path: null, data: null + }; + theTheme.formats.yml = theTheme.formats.yml || { + title: 'yaml', outFormat: 'yml', pre: 'yml', + ext: 'yml', path: null, data: null + }; + + // Cache the theme object _opts.themeObj = theTheme; + + // Output a message TODO: core should not log var numFormats = Object.keys(theTheme.formats).length; _log( 'Applying '.info + theTheme.name.toUpperCase().infoBold + (' theme (' + numFormats + ' formats)').info);