mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-11-22 08:20:11 +00:00
Fix PNG output format for JSON Resume themes.
This commit is contained in:
parent
46bd5d51cc
commit
44555da00f
@ -57,7 +57,7 @@ Definition of the JRSTheme class.
|
|||||||
action: 'transform',
|
action: 'transform',
|
||||||
render: this.render,
|
render: this.render,
|
||||||
major: true,
|
major: true,
|
||||||
ext: pathInfo.extname.slice(1),
|
ext: 'html',
|
||||||
css: null
|
css: null
|
||||||
}
|
}
|
||||||
]},
|
]},
|
||||||
@ -66,7 +66,7 @@ Definition of the JRSTheme class.
|
|||||||
action: 'transform',
|
action: 'transform',
|
||||||
render: this.render,
|
render: this.render,
|
||||||
major: true,
|
major: true,
|
||||||
ext: pathInfo.extname.slice(1),
|
ext: 'pdf',
|
||||||
css: null
|
css: null
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
|
@ -4,25 +4,37 @@ Definition of the HtmlPngGenerator class.
|
|||||||
@module html-png-generator.js
|
@module html-png-generator.js
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var TemplateGenerator = require('./template-generator')
|
var TemplateGenerator = require('./template-generator')
|
||||||
, FS = require('fs-extra')
|
, FS = require('fs-extra')
|
||||||
, HTML = require( 'html' );
|
, HTML = require( 'html' );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
An HTML-based PNG resume generator for HackMyResume.
|
An HTML-based PNG resume generator for HackMyResume.
|
||||||
*/
|
*/
|
||||||
var HtmlPngGenerator = module.exports = TemplateGenerator.extend({
|
var HtmlPngGenerator = module.exports = TemplateGenerator.extend({
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
init: function() {
|
init: function() {
|
||||||
this._super( 'png', 'html' );
|
this._super( 'png', 'html' );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
invoke: function( rez, themeMarkup, cssInfo, opts ) {
|
invoke: function( rez, themeMarkup, cssInfo, opts ) {
|
||||||
//return YAML.stringify( JSON.parse( rez.stringify() ), Infinity, 2 );
|
// TODO: Not currently called or callable.
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
generate: function( rez, f, opts ) {
|
generate: function( rez, f, opts ) {
|
||||||
var htmlResults = opts.targets.filter(function(t){
|
var htmlResults = opts.targets.filter(function(t){
|
||||||
return t.fmt.outFormat === 'html';
|
return t.fmt.outFormat === 'html';
|
||||||
@ -30,18 +42,25 @@ Definition of the HtmlPngGenerator class.
|
|||||||
var htmlFile = htmlResults[0].final.files.filter(function(fl){
|
var htmlFile = htmlResults[0].final.files.filter(function(fl){
|
||||||
return fl.info.ext === 'html';
|
return fl.info.ext === 'html';
|
||||||
});
|
});
|
||||||
png(htmlFile[0].data, f);
|
png( htmlFile[0].data, f );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Generate a PNG from HTML.
|
Generate a PNG from HTML.
|
||||||
*/
|
*/
|
||||||
function png( markup, fOut ) {
|
function png( markup, fOut ) {
|
||||||
|
// TODO: Which Webshot syntax?
|
||||||
// require('webshot')( markup , { encoding: 'binary', siteType: 'html' } )
|
// require('webshot')( markup , { encoding: 'binary', siteType: 'html' } )
|
||||||
// .pipe( FS.createWriteStream( fOut ) );
|
// .pipe( FS.createWriteStream( fOut ) );
|
||||||
require('webshot')( markup , fOut, { siteType: 'html' }, function(err) { } );
|
require('webshot')( markup , fOut, { siteType: 'html' }, function(err) { } );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}());
|
}());
|
||||||
|
Loading…
Reference in New Issue
Block a user