jsonresume-theme-eloquent
Advanced tools
Comparing version 4.1.0 to 5.0.0
@@ -1,83 +0,113 @@ | ||
var Handlebars = require('handlebars'); | ||
var moment = require('moment'); | ||
var encode = require('email-scramble').encode; | ||
var Handlebars = require("handlebars"); | ||
var encode = require("email-scramble").encode; | ||
const dayjs = require("dayjs"); | ||
var duration = require("dayjs/plugin/duration"); | ||
var relativeTime = require("dayjs/plugin/relativeTime"); | ||
dayjs.extend(relativeTime); | ||
dayjs.extend(duration); | ||
var parseText = function(text, pattern, replacement, lowercase) { | ||
text = Handlebars.escapeExpression(text || ''); | ||
text = text.replace(pattern, replacement); | ||
text = !!lowercase ? text.toLowerCase() : text; | ||
return new Handlebars.SafeString(text); | ||
var parseText = function (text, pattern, replacement, lowercase) { | ||
text = Handlebars.escapeExpression(text || ""); | ||
text = text.replace(pattern, replacement); | ||
text = !!lowercase ? text.toLowerCase() : text; | ||
return new Handlebars.SafeString(text); | ||
}; | ||
var formatDate = function(date, format) { | ||
date = Handlebars.escapeExpression(date || ''); | ||
date = moment(date).format(format); | ||
return new Handlebars.SafeString(date); | ||
var formatDate = function (date, format) { | ||
date = Handlebars.escapeExpression(date || ""); | ||
date = dayjs(date).format(format); | ||
return new Handlebars.SafeString(date); | ||
}; | ||
module.exports = { | ||
nl2br: function(content) { | ||
return parseText(content, /\n/g, '<br>'); | ||
}, | ||
sanitizePhone: function(phone) { | ||
return parseText(phone, /[-\s]/g, '', true); | ||
}, | ||
sanitizeURL: function(url) { | ||
return parseText(url, /http?s:\/\//g, '', true); | ||
}, | ||
normalizeNetwork: function(network) { | ||
return parseText(network, /\s/g, '', true); | ||
}, | ||
normalizeName: function(name) { | ||
return parseText(name, /\s/g, '', true); | ||
}, | ||
obfuscateText: function(html) { | ||
html = Handlebars.escapeExpression(html || ''); | ||
html = html.substring(0, 4) + '<span style="display:none;">1337</span>' + html.substring(4); | ||
return new Handlebars.SafeString(html); | ||
}, | ||
scrambleText: function(text) { | ||
text = Handlebars.escapeExpression(text || ''); | ||
text = encode(text); | ||
return new Handlebars.SafeString(text); | ||
}, | ||
scramblePhone: function(phone) { | ||
return encode(parseText(phone, /[-\s]/g, '', true)); | ||
}, | ||
formatMMMMYYYY: function(date) { | ||
return formatDate(date, 'MMMM YYYY'); | ||
}, | ||
formatMMMDDYYYY: function(date) { | ||
return formatDate(date, 'MMM DD, YYYY'); | ||
}, | ||
formatYYYY: function(date) { | ||
return formatDate(date, 'YYYY'); | ||
}, | ||
humaneDuration: function(start, end) { | ||
start = Handlebars.escapeExpression(start || ''); | ||
var endTimestamp = end ? new Date(end).getTime() : Date.now(); | ||
var duration = endTimestamp - (new Date(start).getTime()); | ||
return new Handlebars.SafeString(moment.duration(duration).humanize()); | ||
}, | ||
mapURL: function(location) { | ||
var googleMaps = 'https://www.google.com/maps?q='; | ||
var fields = [ | ||
Handlebars.escapeExpression(location.address || ''), | ||
Handlebars.escapeExpression(location.postalCode || ''), | ||
Handlebars.escapeExpression(location.city || ''), | ||
Handlebars.escapeExpression(location.region || ''), | ||
Handlebars.escapeExpression(location.countryCode || '') | ||
]; | ||
return new Handlebars.SafeString(googleMaps + encodeURIComponent(fields.join(' ').replace(/\s+/g, ' '))); | ||
}, | ||
itemID: function(category, index, length) { | ||
category = Handlebars.escapeExpression(category || ''); | ||
index = Handlebars.escapeExpression(length - index); | ||
return new Handlebars.SafeString(category + '-' + index); | ||
}, | ||
truncate: function(text, length) { | ||
text = Handlebars.escapeExpression(text || ''); | ||
text = text.substring(0, length); | ||
return new Handlebars.SafeString(text); | ||
} | ||
nl2br: function (content) { | ||
return parseText(content, /\n/g, "<br>"); | ||
}, | ||
sanitizePhone: function (phone) { | ||
return parseText(phone, /[-\s]/g, "", true); | ||
}, | ||
sanitizeURL: function (url) { | ||
return parseText(url, /http?s:\/\//g, "", true); | ||
}, | ||
normalizeNetwork: function (network) { | ||
return parseText(network, /\s/g, "", true); | ||
}, | ||
colorNetwork: function (network) { | ||
const colors = { | ||
github: "#454545", | ||
twitter: "#33ccff", | ||
linkedin: "#007bb6", | ||
skype: "#12a5f4", | ||
stackoverflow: "#8e8e92", | ||
soundcloud: "#e8822d", | ||
pinterest: "#bd091f", | ||
vimeo: "#17b3e8", | ||
behance: "#2c98cf", | ||
codepen: "#1c1c1c", | ||
foursquare: "#fa4778", | ||
reddit: "#545454", | ||
spotify: "#acd200", | ||
dribbble: "#ce366f", | ||
facebook: "#4b6daa", | ||
angellist: "#000000", | ||
bitbucket: "#205081", | ||
}; | ||
const networkSlug = parseText(network, /\s/g, "", true); | ||
return colors[networkSlug]; | ||
}, | ||
normalizeName: function (name) { | ||
return parseText(name, /\s/g, "", true); | ||
}, | ||
obfuscateText: function (html) { | ||
html = Handlebars.escapeExpression(html || ""); | ||
html = | ||
html.substring(0, 4) + "<span hidden>1337</span>" + html.substring(4); | ||
return new Handlebars.SafeString(html); | ||
}, | ||
scrambleText: function (text) { | ||
text = Handlebars.escapeExpression(text || ""); | ||
text = encode(text); | ||
return new Handlebars.SafeString(text); | ||
}, | ||
scramblePhone: function (phone) { | ||
return encode(parseText(phone, /[-\s]/g, "", true)); | ||
}, | ||
formatMMMMYYYY: function (date) { | ||
return formatDate(date, "MMMM YYYY"); | ||
}, | ||
formatMMMDDYYYY: function (date) { | ||
return formatDate(date, "MMM DD, YYYY"); | ||
}, | ||
formatYYYY: function (date) { | ||
return formatDate(date, "YYYY"); | ||
}, | ||
humaneDuration: function (start, end) { | ||
start = Handlebars.escapeExpression(start || ""); | ||
return new Handlebars.SafeString( | ||
dayjs.duration(dayjs(end).diff(dayjs(start))).humanize() | ||
); | ||
}, | ||
mapURL: function (location) { | ||
var googleMaps = "https://www.google.com/maps?q="; | ||
var fields = [ | ||
Handlebars.escapeExpression(location.address || ""), | ||
Handlebars.escapeExpression(location.postalCode || ""), | ||
Handlebars.escapeExpression(location.city || ""), | ||
Handlebars.escapeExpression(location.region || ""), | ||
Handlebars.escapeExpression(location.countryCode || ""), | ||
]; | ||
return new Handlebars.SafeString( | ||
googleMaps + encodeURIComponent(fields.join(" ").replace(/\s+/g, " ")) | ||
); | ||
}, | ||
itemID: function (category, index, length) { | ||
category = Handlebars.escapeExpression(category || ""); | ||
index = Handlebars.escapeExpression(length - index); | ||
return new Handlebars.SafeString(category + "-" + index); | ||
}, | ||
truncate: function (text, length) { | ||
text = Handlebars.escapeExpression(text || ""); | ||
text = text.substring(0, length); | ||
return new Handlebars.SafeString(text); | ||
}, | ||
}; |
{ | ||
"name": "jsonresume-theme-eloquent", | ||
"version": "4.1.0", | ||
"version": "5.0.0", | ||
"description": "An eloquent JSON Resume theme: fluent, persuasive, for developers", | ||
"homepage": "https://github.com/thibaudcolas/jsonresume-theme-eloquent", | ||
"author": "Thibaud Colas", | ||
"license": "MIT", | ||
"main": "index.js", | ||
"homepage": "https://github.com/thibaudcolas/jsonresume-theme-eloquent", | ||
"main": "lib/resume.js", | ||
"files": [ | ||
"lib/" | ||
], | ||
"repository": { | ||
@@ -13,71 +16,10 @@ "type": "git", | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/thibaudcolas/jsonresume-theme-eloquent/issues" | ||
}, | ||
"engines": { | ||
"node": ">=4.0" | ||
}, | ||
"keywords": [ | ||
"jsonresume", | ||
"jsonresume-theme", | ||
"jsonresume-theme-eloquent", | ||
"theme", | ||
"eloquent", | ||
"elegant", | ||
"resume", | ||
"cv", | ||
"curriculum vitae", | ||
"curriculum", | ||
"portfolio", | ||
"json resume", | ||
"jsonresume theme", | ||
"theme" | ||
], | ||
"prettier": { | ||
"printWidth": 80, | ||
"tabWidth": 4, | ||
"useTabs": false, | ||
"semi": true, | ||
"singleQuote": true, | ||
"trailingComma": "es5", | ||
"bracketSpacing": true, | ||
"arrowParens": "always", | ||
"proseWrap": "preserve" | ||
}, | ||
"dependencies": { | ||
"email-scramble": "^2.0.1", | ||
"handlebars": "^4.0.12", | ||
"moment": "^2.22.2" | ||
"dayjs": "^1.11.9", | ||
"email-scramble": "^3.0.0", | ||
"handlebars": "^4.7.8" | ||
}, | ||
"devDependencies": { | ||
"babel": "^5.8.29", | ||
"babelify": "^6.4.0", | ||
"browser-saveas": "^1.0.0", | ||
"browser-sync": "^2.8.2", | ||
"browserify": "^13.0.1", | ||
"chai": "^3.4.0", | ||
"jshint": "^2.5.6", | ||
"mocha": "^3.0.0", | ||
"nodemon": "^1.2.1", | ||
"pleeease-cli": "^4.0.0", | ||
"resume-schema": "0.0.16", | ||
"uglify-js": "^2.5.0", | ||
"webfont-dl": "^0.1.1" | ||
}, | ||
"scripts": { | ||
"build:css": "pleeease-compile", | ||
"build:js": "browserify -t babelify assets/scripts/main.js | uglifyjs > dist/bundle.js", | ||
"build:clean": "rm -rf dist/ && mkdir dist/", | ||
"build": "npm run build:clean -s && npm run build:js -s && npm run build:css -s", | ||
"prepublishOnly": "npm run build -s", | ||
"start": "nodemon server.js -w lib -e js", | ||
"lint": "jshint index.js server.js lib/*.js", | ||
"pretest": "npm run lint -s && npm run build -s", | ||
"test:unit": "mocha --compilers js:babel/register", | ||
"test:unit:watch": "mocha --watch --compilers js:babel/register", | ||
"test:render": "node test/render.js", | ||
"test": "npm run test:unit -s && npm run test:render -s", | ||
"report:package": "npm pack --loglevel notice 2>&1 >/dev/null | sed -e 's/^npm notice //' | tee dist/package.txt && rm *.tgz", | ||
"webfont": "webfont-dl 'https://fonts.googleapis.com/css?family=Open+Sans:400' -o assets/styles/opensans.css --woff1=data --woff2=omit --svg=omit --ttf=omit --eot=omit" | ||
"start": "node test/server.js" | ||
} | ||
} |
@@ -1,22 +0,21 @@ | ||
# Eloquent [![npm](https://img.shields.io/npm/v/jsonresume-theme-eloquent.svg)](https://www.npmjs.com/package/jsonresume-theme-eloquent) [![Build Status](https://img.shields.io/travis/thibaudcolas/jsonresume-theme-eloquent.svg)](https://travis-ci.org/thibaudcolas/jsonresume-theme-eloquent) | ||
# [jsonresume-theme-eloquent](https://www.npmjs.com/package/jsonresume-theme-eloquent) | ||
An eloquent JSON Resume theme: fluent, persuasive, for developers. [See it live](https://rawgit.com/thibaudcolas/jsonresume-theme-eloquent/master/test/resume.html). | ||
An eloquent [JSON Resume](https://jsonresume.org/) theme: fluent, persuasive, for developers. [See it live](https://thibaudcolas.github.io/jsonresume-theme-eloquent/). | ||
[![Theme screenshot](raw/theme-screenshot.png)](https://rawgit.com/thibaudcolas/jsonresume-theme-eloquent/master/test/resume.html) | ||
[![Theme screenshot](raw/theme-screenshot.png)](https://thibaudcolas.github.io/jsonresume-theme-eloquent/) | ||
> [Online demo](https://rawgit.com/thibaudcolas/jsonresume-theme-eloquent/master/test/resume.html) | ||
> [Online demo](https://thibaudcolas.github.io/jsonresume-theme-eloquent/) | ||
## Features | ||
* Mobile First theme based on Bootstrap. | ||
* Download your resume with a single click, in a single file. | ||
* Keep your resume offline if you want to: the theme is self-contained. | ||
* Obfuscates your email address and phone number from spam bots. | ||
* Great Font Awesome icons. | ||
* Gorgeous Open Sans web font. | ||
* Optimized for print and screen readers. | ||
* Contains Schema.org markup to make the most of your content. | ||
* Uses Open Graph & Twitter metas to improve social sharing. | ||
* Optionally use Google Analytics to track page views on your resume. | ||
* All fields are optional, pick what you need! | ||
- Mobile First theme based on Bootstrap. | ||
- Download your resume with a single click, in a single file. | ||
- Keep your resume offline if you want to: the theme is self-contained. | ||
- Obfuscates your email address and phone number from spam bots. | ||
- Great Font Awesome icons. | ||
- Optimized for print and screen readers. | ||
- Contains Schema.org markup to make the most of your content. | ||
- Uses Open Graph & Twitter metas to improve social sharing. | ||
- Optionally use Google Analytics to track page views on your resume. | ||
- All fields are optional, pick what you need! | ||
@@ -34,7 +33,7 @@ ## Usage | ||
```js | ||
'use strict'; | ||
"use strict"; | ||
var theme = require('jsonresume-theme-eloquent'); | ||
var theme = require("jsonresume-theme-eloquent"); | ||
var resume = require('./resume.json'); | ||
var resume = require("./resume.json"); | ||
process.stdout.write(theme.render(resume)); | ||
@@ -51,3 +50,2 @@ ``` | ||
npm install | ||
./.githooks/deploy | ||
# To actively work on the theme. | ||
@@ -57,13 +55,2 @@ npm run start | ||
To run the tests locally: | ||
```sh | ||
# To create a reference resume export. | ||
npm run test | ||
cp test/resume.html test/old-resume.html | ||
# To compare the result of your changes against the reference. | ||
npm run test | ||
diff -u test/old-resume.html test/resume.html | ||
``` | ||
To release a new version: | ||
@@ -80,5 +67,3 @@ | ||
* [Bootstrap](http://getbootstrap.com/): custom build | ||
* [IcoMoon](https://icomoon.io/): custom [Font Awesome](https://fortawesome.github.io/Font-Awesome/) build | ||
* [Open Sans](http://www.google.com/fonts/specimen/Open+Sans): great web font-face, taken from Google Fonts | ||
* [saveAs polyfill](https://github.com/eligrey/FileSaver.js) | ||
- [Bootstrap](http://getbootstrap.com/): custom build | ||
- [IcoMoon](https://icomoon.io/): custom [Font Awesome](https://fortawesome.github.io/Font-Awesome/) build |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
0
572
0
1
92332
1
66
1
+ Addeddayjs@^1.11.9
+ Addeddayjs@1.11.13(transitive)
+ Addedemail-scramble@3.0.0(transitive)
- Removedmoment@^2.22.2
- Removedemail-scramble@2.0.1(transitive)
- Removedmoment@2.30.1(transitive)
Updatedemail-scramble@^3.0.0
Updatedhandlebars@^4.7.8