Skip to content

Commit

Permalink
💎🔖 5.2.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
bbody committed Dec 9, 2018
1 parent f1360e1 commit 589b5e4
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 4 deletions.
39 changes: 38 additions & 1 deletion dist/cmd-resume.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* v5.0.1 of CMD Resume by Brendon Body(https://github.com/bbody/CMD-Resume.git) */
/* v5.1.0 of CMD Resume by Brendon Body(https://github.com/bbody/CMD-Resume.git) */
;(function($){
"use strict";

Expand Down Expand Up @@ -124,6 +124,34 @@
return data && (!!isObject || data.length);
};

// Checks is hosted on JSON Resume
var isJsonResumeHosted = function(url) {
if (!url || url.length === 0) {
return false;
}

// jscs:disable maximumLineLength
var match = url.match(/((http|https):\/\/)registry.jsonresume\.org\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/gi);
// jscs:enable maximumLineLength

return !!match && match.length > 0;
};

// Checks if URL ends with JSON
var isJsonFormat = function(url) {
if (!url || url.length === 0) {
return false;
}

var match = url.match(/.json$/);
return !!match && match.length > 0;
};

// Get HTML Version of URL
var getHtmlVersion = function(url) {
return url.replace(/.json$/, ".html");
};

// Calculate the formatting
var mergeFormatting = function(baseStyle, overRideStyle) {
if (overRideStyle.color && isValidColor(overRideStyle.color)) {
Expand Down Expand Up @@ -573,6 +601,11 @@

self.commands = {};

if (isJsonResumeHosted(primaryEndpoint) &&
!isJsonFormat(primaryEndpoint)) {
primaryEndpoint += ".json";
}

self.allCommands = [
{
name: "man",
Expand Down Expand Up @@ -1033,6 +1066,10 @@
self.data.basics.pdfLink = value.url;
}
});

if (!!!self.data.basics.pdfLink && isJsonResumeHosted(primaryEndpoint)) {
self.data.basics.pdfLink = getHtmlVersion(primaryEndpoint);
}
};

self.initGithub = function() {
Expand Down
Loading

0 comments on commit 589b5e4

Please sign in to comment.