1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2024-11-05 09:56:22 +00:00

Restore canonical output filename.

This commit is contained in:
devlinjd 2015-12-09 05:08:10 -05:00
parent 2abfe4426c
commit 0395792359
2 changed files with 6 additions and 3 deletions

View File

@ -81,6 +81,7 @@ Abstract theme representation.
// Set up a hash of formats supported by this theme. // Set up a hash of formats supported by this theme.
var formatsHash = { }; var formatsHash = { };
var that = this; var that = this;
var major = false;
// Establish the base theme folder // Establish the base theme folder
var tplFolder = PATH.join( this.folder, 'src' ); var tplFolder = PATH.join( this.folder, 'src' );
@ -94,7 +95,7 @@ Abstract theme representation.
// such as "/latex" or "/html", then that format is the output format // such as "/latex" or "/html", then that format is the output format
// for all files within the folder. // for all files within the folder.
var pathInfo = PATH.parse(absPath); var pathInfo = PATH.parse(absPath);
var outFmt = ''; var outFmt = '', isMajor = false;
var portion = pathInfo.dir.replace(tplFolder,''); var portion = pathInfo.dir.replace(tplFolder,'');
if( portion && portion.trim() ) { if( portion && portion.trim() ) {
var reg = /^(?:\/|\\)(html|latex|doc|pdf)(?:\/|\\)?/ig; var reg = /^(?:\/|\\)(html|latex|doc|pdf)(?:\/|\\)?/ig;
@ -106,7 +107,8 @@ Abstract theme representation.
// compact-[outputformat].[extension], for ex, compact-pdf.html. // compact-[outputformat].[extension], for ex, compact-pdf.html.
if( !outFmt ) { if( !outFmt ) {
var idx = pathInfo.name.lastIndexOf('-'); var idx = pathInfo.name.lastIndexOf('-');
outFmt = ( idx === -1 ) ? pathInfo.name : pathInfo.name.substr( idx + 1 ) outFmt = ( idx === -1 ) ? pathInfo.name : pathInfo.name.substr( idx + 1 );
isMajor = true;
} }
// We should have a valid output format now. // We should have a valid output format now.
@ -119,6 +121,7 @@ Abstract theme representation.
var obj = { var obj = {
action: 'transform', action: 'transform',
path: absPath, path: absPath,
major: isMajor,
orgPath: PATH.relative(that.folder, absPath), orgPath: PATH.relative(that.folder, absPath),
ext: pathInfo.ext.slice(1), ext: pathInfo.ext.slice(1),
title: friendlyName( outFmt ), title: friendlyName( outFmt ),

View File

@ -196,7 +196,7 @@ Template-based resume generator base for FluentCV.
var thisFilePath = PATH.join( outFolder, tplInfo.orgPath ); var thisFilePath = PATH.join( outFolder, tplInfo.orgPath );
try { try {
MKDIRP.sync( PATH.dirname(thisFilePath) ); MKDIRP.sync( PATH.dirname(thisFilePath) );
FS.writeFileSync( thisFilePath, mk, { encoding: 'utf8', flags: 'w' } ); FS.writeFileSync( tplInfo.major ? f : thisFilePath, mk, { encoding: 'utf8', flags: 'w' } );
} }
catch(ex) { catch(ex) {
console.log(ex); console.log(ex);