1 | import * as Handlebars from 'handlebars';
|
2 | import * as _ from 'lodash';
|
3 |
|
4 | import { BreakCommaHelper } from './html-engine-helpers/break-comma.helper';
|
5 | import { BreakLinesHelper } from './html-engine-helpers/break-lines.helper';
|
6 | import { CapitalizeHelper } from './html-engine-helpers/capitalize.helper';
|
7 | import { CleanParagraphHelper } from './html-engine-helpers/clean-paragraph.helper';
|
8 | import { CompareHelper } from './html-engine-helpers/compare.helper';
|
9 | import { DebugHelper } from './html-engine-helpers/debug.helper';
|
10 | import { ElementAloneHelper } from './html-engine-helpers/element-alone.helper';
|
11 | import { EscapeSimpleQuoteHelper } from './html-engine-helpers/escape-simple-quote.helper';
|
12 | import { FilterAngular2ModulesHelper } from './html-engine-helpers/filter-angular2-modules.helper';
|
13 | import { FunctionSignatureHelper } from './html-engine-helpers/function-signature.helper';
|
14 | import { HasOwnHelper } from './html-engine-helpers/has-own.helper';
|
15 | import { IHtmlEngineHelper } from './html-engine-helpers/html-engine-helper.interface';
|
16 | import { I18nHelper } from './html-engine-helpers/i18n.helper';
|
17 | import { IfStringHelper } from './html-engine-helpers/if-string.helper';
|
18 | import { IndexableSignatureHelper } from './html-engine-helpers/indexable-signature.helper';
|
19 | import { IsInitialTabHelper } from './html-engine-helpers/is-initial-tab.helper';
|
20 | import { IsNotToggleHelper } from './html-engine-helpers/is-not-toggle.helper';
|
21 | import { IsTabEnabledHelper } from './html-engine-helpers/is-tab-enabled.helper';
|
22 | import { JsdocCodeExampleHelper } from './html-engine-helpers/jsdoc-code-example.helper';
|
23 | import { JsdocDefaultHelper } from './html-engine-helpers/jsdoc-default.helper';
|
24 | import { JsdocExampleHelper } from './html-engine-helpers/jsdoc-example.helper';
|
25 | import { JsdocParamsValidHelper } from './html-engine-helpers/jsdoc-params-valid.helper';
|
26 | import { JsdocParamsHelper } from './html-engine-helpers/jsdoc-params.helper';
|
27 | import { JsdocReturnsCommentHelper } from './html-engine-helpers/jsdoc-returns-comment.helper';
|
28 | import { LinkTypeHelper } from './html-engine-helpers/link-type.helper';
|
29 | import { ModifIconHelper } from './html-engine-helpers/modif-icon.helper';
|
30 | import { ModifKindHelper } from './html-engine-helpers/modif-kind-helper';
|
31 | import { ObjectLengthHelper } from './html-engine-helpers/object-length.helper';
|
32 | import { ObjectHelper } from './html-engine-helpers/object.helper';
|
33 | import { OneParameterHasHelper } from './html-engine-helpers/one-parameter-has.helper';
|
34 | import { OrLengthHelper } from './html-engine-helpers/or-length.helper';
|
35 | import { OrHelper } from './html-engine-helpers/or.helper';
|
36 | import { ParseDescriptionHelper } from './html-engine-helpers/parse-description.helper';
|
37 | import { ParsePropertyHelper } from './html-engine-helpers/parse-property.helper';
|
38 | import { RelativeURLHelper } from './html-engine-helpers/relative-url.helper';
|
39 | import { ShortURLHelper } from './html-engine-helpers/short-url.helper';
|
40 | import { StripURLHelper } from './html-engine-helpers/strip-url.helper';
|
41 |
|
42 | export class HtmlEngineHelpers {
|
43 | public registerHelpers(bars): void {
|
44 | this.registerHelper(bars, 'compare', new CompareHelper());
|
45 | this.registerHelper(bars, 'or', new OrHelper());
|
46 | this.registerHelper(bars, 'functionSignature', new FunctionSignatureHelper());
|
47 | this.registerHelper(bars, 'isNotToggle', new IsNotToggleHelper());
|
48 | this.registerHelper(bars, 'isInitialTab', new IsInitialTabHelper());
|
49 | this.registerHelper(bars, 'isTabEnabled', new IsTabEnabledHelper());
|
50 | this.registerHelper(bars, 'ifString', new IfStringHelper());
|
51 | this.registerHelper(bars, 'orLength', new OrLengthHelper());
|
52 | this.registerHelper(bars, 'filterAngular2Modules', new FilterAngular2ModulesHelper());
|
53 | this.registerHelper(bars, 'debug', new DebugHelper());
|
54 | this.registerHelper(bars, 'breaklines', new BreakLinesHelper(bars));
|
55 | this.registerHelper(bars, 'clean-paragraph', new CleanParagraphHelper());
|
56 | this.registerHelper(bars, 'escapeSimpleQuote', new EscapeSimpleQuoteHelper());
|
57 | this.registerHelper(bars, 'breakComma', new BreakCommaHelper(bars));
|
58 | this.registerHelper(bars, 'modifKind', new ModifKindHelper());
|
59 | this.registerHelper(bars, 'modifIcon', new ModifIconHelper());
|
60 | this.registerHelper(bars, 'relativeURL', new RelativeURLHelper());
|
61 | this.registerHelper(bars, 'jsdoc-returns-comment', new JsdocReturnsCommentHelper());
|
62 | this.registerHelper(bars, 'jsdoc-code-example', new JsdocCodeExampleHelper());
|
63 | this.registerHelper(bars, 'jsdoc-example', new JsdocExampleHelper());
|
64 | this.registerHelper(bars, 'jsdoc-params', new JsdocParamsHelper());
|
65 | this.registerHelper(bars, 'jsdoc-params-valid', new JsdocParamsValidHelper());
|
66 | this.registerHelper(bars, 'jsdoc-default', new JsdocDefaultHelper());
|
67 | this.registerHelper(bars, 'linkType', new LinkTypeHelper());
|
68 | this.registerHelper(bars, 'indexableSignature', new IndexableSignatureHelper());
|
69 | this.registerHelper(bars, 'object', new ObjectHelper());
|
70 | this.registerHelper(bars, 'objectLength', new ObjectLengthHelper());
|
71 | this.registerHelper(bars, 'parseDescription', new ParseDescriptionHelper());
|
72 | this.registerHelper(bars, 'one-parameter-has', new OneParameterHasHelper());
|
73 | this.registerHelper(bars, 'element-alone', new ElementAloneHelper());
|
74 | this.registerHelper(bars, 'hasOwn', new HasOwnHelper());
|
75 | this.registerHelper(bars, 'short-url', new ShortURLHelper());
|
76 | this.registerHelper(bars, 'strip-url', new StripURLHelper());
|
77 | this.registerHelper(bars, 't', new I18nHelper());
|
78 | this.registerHelper(bars, 'capitalize', new CapitalizeHelper());
|
79 | this.registerHelper(bars, 'parse-property', new ParsePropertyHelper());
|
80 | }
|
81 |
|
82 | private registerHelper(bars, key: string, helper: IHtmlEngineHelper) {
|
83 | Handlebars.registerHelper(key, function () {
|
84 |
|
85 | return helper.helperFunc.apply(helper, [this, ..._.slice(arguments as any)]);
|
86 | });
|
87 | }
|
88 | }
|