mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2025-05-15 10:07:07 +01:00
Introduce formal generators.
Introduce a shallow hierarchy of simple generator classes, collecting common functionality and allowing for future snap-in generator replacement. Use John Resig's "class"-based inheritance per http://ejohn.org/blog/simple-javascript-inheritance/.
This commit is contained in:
31
src/gen/html-generator.js
Normal file
31
src/gen/html-generator.js
Normal file
@ -0,0 +1,31 @@
|
||||
/**
|
||||
HTML resume generator for FluentCV.
|
||||
@license Copyright (c) 2015 by James M. Devlin. All rights reserved.
|
||||
*/
|
||||
|
||||
var TemplateGenerator = require('./template-generator');
|
||||
var FS = require('fs-extra');
|
||||
var HTML = require( 'html' );
|
||||
|
||||
var HtmlGenerator = TemplateGenerator.extend({
|
||||
|
||||
init: function() {
|
||||
this._super( 'html' );
|
||||
},
|
||||
|
||||
/**
|
||||
Generate an HTML resume with optional pretty printing.
|
||||
*/
|
||||
onBeforeSave: function( mk, themeFile, outputFile ) {
|
||||
var cssSrc = themeFile.replace( /.html$/g, '.css' );
|
||||
var cssDst = outputFile.replace( /.html$/g, '.css' );
|
||||
FS.copy( cssSrc, cssDst, function( e ) {
|
||||
if( e ) err( "Couldn't copy CSS file to destination: " + err);
|
||||
});
|
||||
return true ?
|
||||
HTML.prettyPrint( mk, { indent_size: 2 } ) : mk;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
module.exports = HtmlGenerator;
|
Reference in New Issue
Block a user