diff --git a/index.js b/index.js index 6e4986e..db9f4dd 100644 --- a/index.js +++ b/index.js @@ -22,6 +22,10 @@ Handlebars.registerHelper('formatDate', dateString => }), ) +Handlebars.registerHelper('formatURL', url => + url.replace(/^(https?:|)\/\//, '').replace(/\/$/, ''), +) + Handlebars.registerHelper('join', (arr, separator) => arr.join(typeof separator === 'string' ? separator : ', '), ) diff --git a/partials/contact.hbs b/partials/contact.hbs index adc5f97..03cfd30 100644 --- a/partials/contact.hbs +++ b/partials/contact.hbs @@ -16,7 +16,7 @@ {{#url}}
Website
- {{.}} + {{formatURL .}}
{{/url}} diff --git a/partials/education.hbs b/partials/education.hbs index fc85a3c..07f50da 100644 --- a/partials/education.hbs +++ b/partials/education.hbs @@ -17,7 +17,7 @@ {{.}} {{/area}} {{#url}} - {{.}} + {{formatURL .}} {{/url}} diff --git a/partials/projects.hbs b/partials/projects.hbs index 49d3529..6d907a8 100644 --- a/partials/projects.hbs +++ b/partials/projects.hbs @@ -22,7 +22,7 @@ {{/entity}} {{#url}} - {{.}} + {{formatURL .}} {{/url}} diff --git a/partials/publications.hbs b/partials/publications.hbs index 9a33538..3441d5a 100644 --- a/partials/publications.hbs +++ b/partials/publications.hbs @@ -18,7 +18,7 @@ {{/publisher}} {{#url}} - {{.}} + {{formatURL .}} {{/url}} diff --git a/partials/volunteer.hbs b/partials/volunteer.hbs index c08fe8c..de25656 100644 --- a/partials/volunteer.hbs +++ b/partials/volunteer.hbs @@ -17,7 +17,7 @@ {{.}} {{/position}} {{#url}} - {{.}} + {{formatURL .}} {{/url}} diff --git a/partials/work.hbs b/partials/work.hbs index cd54d21..806251e 100644 --- a/partials/work.hbs +++ b/partials/work.hbs @@ -17,7 +17,7 @@ {{.}} {{/position}} {{#url}} - {{.}} + {{formatURL .}} {{/url}} diff --git a/tap-snapshots/test-render.js-TAP.test.js b/tap-snapshots/test-render.js-TAP.test.js index 06b1546..c2b7f75 100644 --- a/tap-snapshots/test-render.js-TAP.test.js +++ b/tap-snapshots/test-render.js-TAP.test.js @@ -246,7 +246,7 @@ blockquote > * + * {
Website
- http://richardhendricks.example.com + richardhendricks.example.com
@@ -284,7 +284,7 @@ blockquote > * + * {
CEO/President - http://piedpiper.example.com + piedpiper.example.com

Pied Piper is a multi-platform technology based on a proprietary universal compression algorithm that has consistently fielded high Weisman Scores™ that are not merely competitive, but approach the theoretical limit of lossless compression.

@@ -311,7 +311,7 @@ blockquote > * + * {
Teacher - http://coderdojo.example.com/ + coderdojo.example.com

Global movement of free coding clubs for young people.

@@ -336,7 +336,7 @@ blockquote > * + * {
Information Technology - https://www.ou.edu/ + www.ou.edu

Bachelor

@@ -410,7 +410,7 @@ blockquote > * + * { Published by Hooli - http://en.wikipedia.org/wiki/Silicon_Valley_(TV_series) + en.wikipedia.org/wiki/Silicon_Valley_(TV_series)

Innovative middle-out compression algorithm that changes the way we store data.