From e0c130ebf91044d7e697d589bf1a85a7126d65fe Mon Sep 17 00:00:00 2001 From: Graeme Maciver Date: Thu, 31 Mar 2016 16:02:26 +0100 Subject: [PATCH] pragraphs on summary text --- index.js | 11 +++++++++++ resume.template | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index c3d18c7..2a3b0cf 100644 --- a/index.js +++ b/index.js @@ -20,6 +20,17 @@ function render(resume) { }); } +Handlebars.registerHelper('paragraphSplit', function(plaintext) { + var i, output = '', + lines = plaintext.split(/\r\n|\r|\n/g); + for (i = 0; i < lines.length; i++) { + if(lines[i]) { + output += '

' + lines[i] + '

'; + } + } + return new Handlebars.SafeString(output); +}); + module.exports = { render: render }; diff --git a/resume.template b/resume.template index fe046c6..d85290c 100644 --- a/resume.template +++ b/resume.template @@ -46,7 +46,7 @@ {{#if summary}} -

{{summary}}

+

{{paragraphSplit summary}}

{{/if}} {{#if profiles.length}} @@ -128,7 +128,7 @@ {{#if summary}}
-

{{summary}}

+

{{paragraphSplit summary}}

{{/if}} {{#if highlights.length}}