1 | import { IHtmlEngineHelper } from './html-engine-helper.interface';
|
2 | import * as Handlebars from 'handlebars';
|
3 |
|
4 | export class BreakLinesHelper implements IHtmlEngineHelper {
|
5 | constructor(private bars) {}
|
6 |
|
7 | public helperFunc(context: any, text: string) {
|
8 | text = this.bars.Utils.escapeExpression(text);
|
9 | text = text.replace(/(\r\n|\n|\r)/gm, '<br>');
|
10 | text = text.replace(/ /gm, ' ');
|
11 | text = text.replace(/ /gm, ' ');
|
12 | return new Handlebars.SafeString(text);
|
13 | }
|
14 | }
|