mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-11-22 08:20:11 +00:00
Support implicit PDF generation (interim).
This commit is contained in:
parent
3964d300aa
commit
46bd5d51cc
@ -48,27 +48,32 @@ Definition of the JRSTheme class.
|
|||||||
this.render = (thApi && thApi.render) || undefined;
|
this.render = (thApi && thApi.render) || undefined;
|
||||||
this.engine = 'jrs';
|
this.engine = 'jrs';
|
||||||
|
|
||||||
// Create theme formats (HTML and PDF)
|
// Create theme formats (HTML and PDF). Just add the bare minimum mix of
|
||||||
|
// properties necessary to allow JSON Resume themes to share a rendering
|
||||||
|
// path with FRESH themes.
|
||||||
this.formats = {
|
this.formats = {
|
||||||
html: { outFormat: 'html', files: [
|
html: { outFormat: 'html', files: [
|
||||||
{
|
{
|
||||||
action: 'transform',
|
action: 'transform',
|
||||||
render: this.render,
|
render: this.render,
|
||||||
//path: absPath,
|
|
||||||
major: true,
|
major: true,
|
||||||
//orgPath: PATH.relative(thFolder, absPath),
|
|
||||||
ext: pathInfo.extname.slice(1),
|
ext: pathInfo.extname.slice(1),
|
||||||
//title: friendlyName( outFmt ),
|
css: null
|
||||||
//pre: outFmt,
|
}
|
||||||
// outFormat: outFmt || pathInfo.name,
|
]},
|
||||||
//data: FS.readFileSync( absPath, 'utf8' ),
|
pdf: { outFormat: 'pdf', files: [
|
||||||
|
{
|
||||||
|
action: 'transform',
|
||||||
|
render: this.render,
|
||||||
|
major: true,
|
||||||
|
ext: pathInfo.extname.slice(1),
|
||||||
css: null
|
css: null
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw { fluenterror: 10 };
|
throw { fluenterror: HACKMYSTATUS.missingPackageJSON };
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
@ -37,7 +37,7 @@ Definition of the HtmlPdfCLIGenerator class.
|
|||||||
Generate the binary PDF.
|
Generate the binary PDF.
|
||||||
*/
|
*/
|
||||||
onBeforeSave: function( info ) {
|
onBeforeSave: function( info ) {
|
||||||
console.log('Called');
|
|
||||||
try {
|
try {
|
||||||
var safe_eng = info.opts.pdf || 'wkhtmltopdf';
|
var safe_eng = info.opts.pdf || 'wkhtmltopdf';
|
||||||
engines[ safe_eng ].call( this, info.mk, info.outputFile );
|
engines[ safe_eng ].call( this, info.mk, info.outputFile );
|
||||||
|
@ -184,7 +184,6 @@ Implementation of the 'generate' verb for HackMyResume.
|
|||||||
|
|
||||||
// If targInfo.fmt.files exists, this format is backed by a document.
|
// If targInfo.fmt.files exists, this format is backed by a document.
|
||||||
// Fluent/FRESH themes are handled here.
|
// Fluent/FRESH themes are handled here.
|
||||||
// TODO: Make FRESH and JRS themes render on the same path
|
|
||||||
if( targInfo.fmt.files && targInfo.fmt.files.length ) {
|
if( targInfo.fmt.files && targInfo.fmt.files.length ) {
|
||||||
theFormat = _fmts.filter(
|
theFormat = _fmts.filter(
|
||||||
function(fmt) { return fmt.name === targInfo.fmt.outFormat; })[0];
|
function(fmt) { return fmt.name === targInfo.fmt.outFormat; })[0];
|
||||||
@ -193,25 +192,19 @@ Implementation of the 'generate' verb for HackMyResume.
|
|||||||
return theFormat.gen.generate( rez, f, _opts );
|
return theFormat.gen.generate( rez, f, _opts );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise this is either a) a JSON Resume theme or b) an ad-hoc format
|
//Otherwise this is an ad-hoc format (JSON, YML, or PNG) that every theme
|
||||||
// (JSON, YML, or PNG) that every theme gets "for free".
|
// gets "for free".
|
||||||
// else {
|
else {
|
||||||
//
|
|
||||||
// theFormat = _fmts.filter( function(fmt) {
|
theFormat = _fmts.filter( function(fmt) {
|
||||||
// return fmt.name === targInfo.fmt.outFormat;
|
return fmt.name === targInfo.fmt.outFormat;
|
||||||
// })[0];
|
})[0];
|
||||||
//
|
|
||||||
// var outFolder = PATH.dirname( f );
|
var outFolder = PATH.dirname( f );
|
||||||
// MKDIRP.sync( outFolder ); // Ensure dest folder exists;
|
MKDIRP.sync( outFolder ); // Ensure dest folder exists;
|
||||||
//
|
|
||||||
// // JSON Resume themes have a 'render' method that needs to be called
|
return theFormat.gen.generate( rez, f, _opts );
|
||||||
// if( theme.render ) {
|
}
|
||||||
// return renderJRSTheme( f, outFolder, theme );
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// return theFormat.gen.generate( rez, f, _opts );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
catch( ex ) {
|
catch( ex ) {
|
||||||
_err( ex );
|
_err( ex );
|
||||||
|
Loading…
Reference in New Issue
Block a user