2022.2

Table Of Contents
* 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.
ThefollowingscriptloadsJSONandthenpassesthatJSONandthecurrentrecordtoaHandlebars
template.
const myJson = loadjson('snippets/myJson.json');
Handlebars.render(myHandlebarsTemplate, { json:myJson, record:record })
Assumingthejsoninthisexamplehasakeycalledkey1andtherecordhasafieldcalledfield1,expres-
sionsinthetemplatecouldlooklikethis:{{json.key1}}{{record.field1}}.
Unsupportedfeatures
ThefollowingfeaturesarenotsupportedinHandlebarstemplatesinOLConnect:
l
TheSafeStringclass.ItisnotneededsincetheresultofablockhelperisnotHTML-escaped
inOLConnect.
l
Inlineescapes.
Page 346