2022.2

Table Of Contents
registerHelper('name',
helper)
RegistersafunctionasHelperwiththespecifiedname.
Hereisanexample:
Handlebars.registerHelper('today', function() { return new Date(); });
See:"CreatingcustomHelpers"onpage771.
Note: RegisteringmultipleHelperswithasinglecalltoregisterHelper()isnotsupported.
escapeExpression() HTML-escapesthesuppliedstring.ThismeansthatthosecharactersthathaveaspecialfunctioninHTML:& < > \" ' ` =
arereplacedwithHTMLcharacterreferences.Forexample:&willbechangedinto&amp;.
Seealso:"HTMLvalues"onpage765.
ThisfunctiondoesthesameasescapeHTML(),whichwasintroducedinOLConnect2022.1andisnowdeprecated.
* template
Inallthesefunctions,'template'canbe:
l
thenameofan.hbssnippetinthetemplate(forexample:{{> snippets/Snippet 1.hbs}}
l
thenameofan.hbssnippetondisk(startingwithfile:///)
l
thenameofaremote.hbssnippet(startingwithhttp://orhttps://)
l
astringthatcontainsHTMLandHandlebarsexpressions.
Withasnippetondisk,thecompletesyntaxis:file://<host>/<path>.Ifthehostis"localhost",itcanbe
omitted,resultinginfile:///<path>-notethethreeforwardslashesafterfile:.
Intheremainderofthepathyoucaneitheruseescapedbackwardslashes:
"file:///C:\\Users\\Administrator\\Desktop\\Handlebars_LoadFile.hbs"
orforwardslashes:
"file:///C:/Users/Administrator/Desktop/Handlebars_LoadFile.hbs"
Note: Itisnotpossibletouseloadhtml()inHandlebarsfunctions.HTMLwithHandlebars
expressionsisnotnecessarilyvalidHTML.ProcessingitwithanHTMLparsermightbreakboth
theHandlebarsexpressionsandtheHTML.
** data
Thedatacanbethecurrentrecordorpartofit,oranotherJavaScriptobject.
itisalsopossibletopasstherecordorpartofitalongwithotherdata,sinceJavaScriptobjectsmaycon-
tainmultipleobjects.Hereisanexample.
Page 781