mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-11-22 16:30:11 +00:00
Add Markdown format support.
This commit is contained in:
parent
6e4263e58c
commit
189f37b6a1
@ -49,7 +49,8 @@ module.exports = function () {
|
|||||||
( (dst && dst.length && dst) || ['resume.all'] ).forEach( function(t) {
|
( (dst && dst.length && dst) || ['resume.all'] ).forEach( function(t) {
|
||||||
var to = path.resolve(t), pa = path.parse(to), fmat = pa.ext || '.all';
|
var to = path.resolve(t), pa = path.parse(to), fmat = pa.ext || '.all';
|
||||||
targets.push.apply(targets, fmat === '.all' ?
|
targets.push.apply(targets, fmat === '.all' ?
|
||||||
_fmts.map(function(z){ return to.replace(/all$/g,z.name); }) : [to]);
|
_fmts.map(function(z){ return { file: to.replace(/all$/g,z.ext), fmt: z } })
|
||||||
|
: [{ file: to, fmt: z }]);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Run the transformation!
|
// Run the transformation!
|
||||||
@ -64,19 +65,12 @@ module.exports = function () {
|
|||||||
@param f Full path to the destination resume to generate, for example,
|
@param f Full path to the destination resume to generate, for example,
|
||||||
"/foo/bar/resume.pdf" or "c:\foo\bar\resume.txt".
|
"/foo/bar/resume.pdf" or "c:\foo\bar\resume.txt".
|
||||||
*/
|
*/
|
||||||
function single( f ) {
|
function single( fi ) {
|
||||||
try {
|
try {
|
||||||
// Get the output file type (pdf, html, txt, etc)
|
var f = fi.file, fType = fi.fmt.ext, fName = path.basename( f, '.' + fType );
|
||||||
var fType = path.extname( f ).trim().toLowerCase().substr(1);
|
var fObj = _fmts.filter( function(_f) { return _f.ext === fType; } )[0];
|
||||||
var fName = path.basename( f, '.' + fType );
|
|
||||||
|
|
||||||
// Get the format object (if any) corresponding to that type, and assemble
|
|
||||||
// the final output file path for the generated resume.
|
|
||||||
var fObj = _fmts.filter( function(_f) { return _f.name === fType; } )[0];
|
|
||||||
var fOut = path.join( f.substring( 0, f.lastIndexOf('.') + 1 ) + fObj.ext );
|
var fOut = path.join( f.substring( 0, f.lastIndexOf('.') + 1 ) + fObj.ext );
|
||||||
|
_log( 'Generating ' + fi.fmt.name.toUpperCase() + ' resume: ' + path.relative(process.cwd(), f ) );
|
||||||
// Generate!
|
|
||||||
_log( 'Generating ' + fType.toUpperCase() + ' resume: ' + path.relative(process.cwd(), f) );
|
|
||||||
return fObj.gen.generate( rez, fOut, _opts.theme );
|
return fObj.gen.generate( rez, fOut, _opts.theme );
|
||||||
}
|
}
|
||||||
catch( ex ) {
|
catch( ex ) {
|
||||||
@ -98,7 +92,8 @@ module.exports = function () {
|
|||||||
{ name: 'html', ext: 'html', gen: new FLUENT.HtmlGenerator() },
|
{ name: 'html', ext: 'html', gen: new FLUENT.HtmlGenerator() },
|
||||||
{ name: 'txt', ext: 'txt', gen: new FLUENT.TextGenerator() },
|
{ name: 'txt', ext: 'txt', gen: new FLUENT.TextGenerator() },
|
||||||
{ name: 'doc', ext: 'doc', fmt: 'xml', gen: new FLUENT.WordGenerator() },
|
{ name: 'doc', ext: 'doc', fmt: 'xml', gen: new FLUENT.WordGenerator() },
|
||||||
{ name: 'pdf', ext: 'pdf', fmt: 'html', is: false, gen: new FLUENT.HtmlPdfGenerator() }
|
{ name: 'pdf', ext: 'pdf', fmt: 'html', is: false, gen: new FLUENT.HtmlPdfGenerator() },
|
||||||
|
{ name: 'markdown', ext: 'md', fmt: 'txt', gen: new FLUENT.MarkdownGenerator() }
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user